• 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. Verilog-A: How to trigger event, if input parameter changes...

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 125
  • Views 14037
  • 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

Verilog-A: How to trigger event, if input parameter changes in DC sweep

NZimmermann
NZimmermann over 4 years ago

In my analog testbench, I have a Verilog-A block which is using an integer parameter. This parameter is set in the testbench via a variable in my Maestro view. Now I want to sweep over this variable, when doing DC simulations, i.e a linear sweep with step size 1. However, I can see that this parameter is not updated in the simulations. Instead it always uses the first value of the DC sweep, which seems to be read in by the @inital_step event.

Is there a way to create an event in Verilog-A, when a parameter changes, so that the Verilog-A reacts to this change?

Due to different constraints, it is unfortunately not an option for me to do independent DC simulations with different variable settings, instead of sweeping the variable inside the DC simulations.

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    Can you please share the Verilog-A code and explain how you're passing the sweep variable to this parameter? There isn't a way to create an event to do this, primarily because there should be no need to do so - it should just work.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • NZimmermann
    NZimmermann over 4 years ago in reply to Andrew Beckett

    Hi Andrew, 

    please find attached a simplified Verilog-A code which can demonstrate my issue. It seems that the @timer paragraphs breaks the DC simulation result. With this paragraph, the variable Vout_val is constantly kept at the starting value of the DC sweep. Without this paragraph the DC sweep simulation works fine. I need this timer for a transient analysis and would not have assume this to influence the DC analysis, but somehow it does!? 

    Also, I have attached two screenshots, how I pass the variable from the DC sweep in Maestro to the Verilog-A block.

    Do you understand where this is coming from and have an proposal how to fix this? Thanks a lot!

    Best regards
    Niklas

    Fullscreen VA_sweep_example.txt Download
    `include "constants.vams"
    `include "disciplines.vams"
    
    module VA_sweep_example(Vout, VSS);
    
    	output Vout;	
    	input VSS;
    	electrical Vout;
    	electrical VSS;
    	
    	parameter integer sweep_param = 0 from[0:31];
    	
    	integer Vout_val;
    	real delay1 = 1u;
    
    analog begin
    	@(initial_step) begin
    		Vout_val = sweep_param;	
    	end
    
    	@(timer(delay1)) begin
    		Vout_val = Vout_val +1;
    	end
    
    	V(Vout, VSS) <+ Vout_val*1e-3;
    end
    endmodule
    

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to NZimmermann

    The initial_step is going to only get fired for the first point in the DC sweep, so that's why it doesn't work (it's nothing to do with the @timer). So Vout_val only gets set once.

    You could add this:

    if(analysis("dc")) Vout_val = sweep_param;

    and that would fix it. I normally don't like using analysis() in Verilog-A code because generally analysis-specific behaviour is incorrect, but it's not that obvious how you'd resolve this otherwise.

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • NZimmermann
    NZimmermann over 4 years ago in reply to Andrew Beckett

    Hi Andrew, 

    by using analysis() I could resolve my issue. Thank a lot for the hint. 

    The @timer function has some influence on my DC sweep simulation. If I have it included in the Verilog-A code, only the starting value of the DC sweep is used for all sweep values. If I remove it from the code, Vout_val is updated with all the "maestro_var" settings of the sweep. See behavior of Vout in the attached plot for both cases. Maybe this is a bug?

    Regards
    Niklas

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to NZimmermann

    Hi Niklas,

    I think this is because with any complex behaviour (actually anything within the code that alters Vout_val) the simulator determines that the changing parameter doesn't affect the operating point. Without the @(timer) then it recomputes the operating point which triggers the initial_step again. I'm not 100% sure, but I think that's what's going on. Might be worth contacting customer support to investigate further to be sure.

    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