• 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. Transient simulation termination by VerilogA model

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 126
  • Views 11796
  • 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

Transient simulation termination by VerilogA model

Senan
Senan over 3 years ago

Note: By mistake, I have posted this issue in the wrong forum and I am posting it here again

***********************************************************************************************************

Hello,

As I am simulating and optimizing a VCO circuit that generates a clock frequency with comprehensive change due to the optimization space, I fixed the stop time in the transient simulation to cover the lowest possible generated signal. While this time causes an unnecessary huge simulation time for the generated high-frequency signal, a method advised by this forum (by Andrew) to create a Verilog counter model shown below to count the pulses of the generated signal for a reasonable number of periods and the simulation module terminate the simulation regardless the signal frequency. Of course, the stop time in the transient simulation still needed to fit the lowest expected signal frequency. In this module, I am counting 10 periods which is more than enough to calculate the signal frequency using the function "frequency" from the calculator.

I have used the module in the transient simulation testbench and successfully terminate the simulation according to the predefined number of periods (count in this module). The ADE Assembler also was able to plot the signal after the simulation termination.

However, I have found that calculator functions results are not any more computed after termination, it becomes similar to the case when you manually stop the simulation and gives "sim error".

nevertheless, if I send the plotted signal to the calculator and apply the functions then it will work. but this will not solve my problem as I am running tens of corners and need to print the result automatically.

Kindly, I need your help to make the ADE Assembler compute the calculator functions automatically after simulation termination.

I am using Cadence Virtuoso IC6.1.8-64b.500.6

I hope I explained the problem clearly

Thank you in advance

Regards

####################################################################################Code'####################################################################################################

// VerilogA for indirect_measurement, counter, veriloga

`include "constants.vams"
`include "disciplines.vams"


`define SIZE 4
module counter (out, clk);
inout clk;
electrical clk;
output [`SIZE-1 :0] out;
electrical [`SIZE-1 :0] out;
parameter integer setval = 0 from [0:(1<<`SIZE)-1];
parameter real vtrans_clk = 0.6;
parameter real vtol = 0; // signal tolerance on the clk
parameter real ttol = 0; // time tolerance on the clk
parameter real vhigh = 1.2;
parameter real vlow = 0;
parameter real tdel = 30p;
parameter real trise = 30p;
parameter real tfall = 30p;
parameter integer up = 0 from [0:1]; //0=increasing 1=decreasing
parameter integer stepsize = 1;
integer outval;

integer cnt=0;

analog begin
@(initial_step("static","ac")) outval = setval;
@(cross(V(clk)-vtrans_clk,1,vtol,ttol))

begin
outval = (outval +(+up- !up)*stepsize)%(1<<`SIZE);

cnt=cnt+1;
if( cnt == 10) begin
   
            $finish(0);    //command to stop the current simulation
        end
end
generate j (`SIZE-1 , 0) begin
V(out[j]) <+ transition (!(!(outval &(1<<j)))*vhigh+!(outval&(1<<j))*vlow,tdel,trise,tfall);
end
end

  • Cancel
  • FormerMember
    FormerMember over 3 years ago

    Dear Senan,

    Senan said:

    I hope I explained the problem clearly

    I must admit I do not fully understand your problem - sorry! Maybe other experts will.

    1. What is the calculator expression you are trying to evaluate?

    2. What exactly is the error reported in the CIW?

    3. If your expression is operating over the full transient simulation, have you tried doing the measurement on the waveform AFTER you clip it for some subset of the the number of clock periods you have defined in your veriloga routine (i.e., you are running for 10 cycles, hence clip your waveform for the 8 cycles - and not the last 8, and perform the calculation).?

    4. Does your expression use the existing Calculator functions - or is it a custom function you loaded into the Calculator?

    5. I am wondering (concerned?) that the use of your veriloga counter to stop the simulation is not synchronized to your VCO frequency well enough and hence may end the simulation at totally different points of the VCO waveform depending on its frequency and this is causing one of your Calculator expression to fail.

    Shaw

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Frank Wiedmann
    Frank Wiedmann over 3 years ago

    Does https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1O0V00000910leUAA help?

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago in reply to FormerMember

    The issue is because Spectre records whether an analysis started and finished OK, and if the analysis that you're reading data from in a measurement failed, you'll see sim err. You can change the default behaviour for this, but there's a better solution below...

    In fact if you use a more recent Spectre version, it will indeed succeed without error (I don't know exactly when it changed, but it was in a hotfix of SPECTRE20.1).

    However, the best solution is to change the $finish(0) to $finish_current_analysis(0) in the Verilog-A code. That will then behave even in older versions of Spectre (you didn't mention which version you were using - the simulator version is rather important information here, as well as the IC version, which you did provide).

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Senan
    Senan over 3 years ago in reply to Frank Wiedmann

    Dear Frank and Andrew

    Thank you very much for your help and your interaction to my post,

    I would like to inform you that this issue is perfectly solved now upon your suggestion by using the $finish_current_analysis(0) instead of $finish(0).

    So my problem is now solved

    Thank you once again

    Best Regards 

    • 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