• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. staircase function

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 125
  • Views 17305
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

staircase function

vvdb
vvdb over 5 years ago

To measure the offset of a comparator, I need a staircase funnction as shown in the figure. How can I generate this function in Cadence. I thought maybe with Verilog A, but I am not used to work with Verilog. For example, I would like to have a staircase function from 1.1V to 1.4V with step size 100 uV.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago

    Since this wasn't a SKILL question, I moved it into the Custom IC Design forum.

    Verilog-A is the simplest way. Potentially you could have used an existing Verilog-A model for a DAC, and then maybe an ideal ADC to drive that, but then  you need the right resolution. It's easy enough with Verilog-A.

    Here's the code:

    // VerilogA for rampgenerator
    
    `include "constants.vams"
    `include "disciplines.vams"
    
    //	vramp,  (output) input voltage for comparator, non-inverting
    //      clk,  clock signal for the comparator
    
    module rampgenerator(vramp, clk);
    input		clk ;
    output		vramp ;
    electrical 	vramp, clk ;
    
    parameter	vth=1 ;			// clk threshold voltage
    parameter	resolution=100u ;	// resolution of the ramp
    parameter   maxin = 0.8 ;		// maximum input level
    parameter   minin = 0.5 ;
    parameter   td = 100p ;	// delay time
    parameter	tr = 100p ;	// rise time 
    parameter   initdirection = 1;
    
    real    offset ;
    integer direction ;
    
    analog
    begin
       @(initial_step("static","tran")) begin  // On initialization,
        if (initdirection > 0) begin
    	    offset = minin;
            direction = 1 ;
        end
        else begin
    	    offset = maxin;
            direction = -1 ;
        end
       end
    
       @( cross( V(clk)>vth, -1 )) begin
    	offset = offset + (direction * resolution) ;
       end 
       
       if(offset > maxin-resolution/2) begin
          direction = -1 ;
       end
       else if(offset < minin+resolution/2) begin
          direction = 1;
       end
       
       V(vramp) <+ transition( offset, td, tr, tr ) ;
    	
    end
    endmodule

    You'd need to set minin to 1.1, and maxin to 1.4 on the instance of the symbol (use the "Use tools filter" to see the available parameters on the edit properties for the instance of the ramp generator), set the rise times of the steps appropriately (don't make them too sharp if your ramp is rising slowly) and then use a pulse source to clock the input - that allows you to control the rate of the ramp. Here's a zoomed in picture of the graph it produces:

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information