• 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. Mixed-Signal Design
  3. Dinamycally changing errpreset/reltol based on rising edge...

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 64
  • Views 4479
  • 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

Dinamycally changing errpreset/reltol based on rising edge of a given signal

NewScreenName
NewScreenName over 2 years ago

Hi all,

I am running toplevel simulations, and a long time is required from the beginning of the simulation to the time window of interest. Although the first part of the simulation should still not be skipped, it may have way lower accuracy. I know it's possible to change errpreset at a given time, however this time depends on the settling of various circuits, and depending on which PVT is being run, could be quite different, hence the need for the errpreset/reltol change time to be not a priori set, but changing when a powerup done signal rises.

According to what I see here at paragraph "Performing Event-Triggered Analysis During Transient Analysis" https://support.cadence.com/apex/techpubDocViewerPage?xmlName=spectreuser.xml&title=Spectre%20Classic%20Simulator,%20Spectre%20APS,%20Spectre%20X,%20and%20Spectre%20XPS%20User%20Guide%20--%20Analyses%20-%20The%20errpreset%20Parameter&hash=pgfId-852965&c_version=21.1&path=spectreuser/spectreuser21.1/chap7.html#pgfId-852965

I tried to implement the change of reltol, in particular mixing example 1 and example 2 into the following file reltol_settings.scs:

assert1 assert expr="v(trigger_signal)>vdda/2"
simulator lang=spectre
tran tran stop=sim_time param=reltol param_vec=[0 1e-2 "@(assert1)" 1e-5]

where trigger_singal is a node at the testbench top level, while vdda and sim_time are design variables.

Then I included it in the definition files:

Now if I run the simulation with my tran analysis enabled I will get the following error:
 ERROR (SFE-401): Cannot run the simulation because instance `tran' specified at line 2481 in `input.scs' is also already defined at line 3 in`$HOME/workspace/reltol_settings.scs'.

Then if I disable the tran from my ADE assembler analysis (so that only the one in the reltol_settings.scs file is called) I suppose all the other parameters (errpreset, strobing options, infotimes etc) will get the default value? So I was wondering if one of the following (in order of preference) would be possible:
1. Is there a way to set dynamically reltol based on triggering event via the GUI, so to retain the tran analysis form enabled?
2. If not how can I retain the normal tran analysis set from ADE assembler (and all its options) while having this file overwriting only the parameters in it defined? (in my case reltol)
3. And if even this second option is not possible, I imagine this scs file could include all the same options I define in the tran choosing analysis form. Is there a quick way to set them in the choosing analysis form and get them printed in such a way that I could set them there, and then just copy-paste into my scs file?

Thank you

Regards

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    To answer your questions:

    1. Yes. Use the dynamic parameters option on the tran analysis form, and set the time to be "@(assert1)" (with quotes) or @assert1 (with or without quotes). The assert itself should be included via a definition file/model file
    2. No, this is not possible. Because spectre supports multiple analyses of each type (you just need to name them differently), there's no merging of options from duplicate analyses with the same name (note, by "name" I mean the first word on the analysis line preceding the type of analysis (tran in this case).
    3. Yes, you could do that. Do Simulation->Netlist->Create and then copy the lines from there (then disable the tran analysis). However, this seems a bit pointless since you can do 1.

    Andrew

    • Cancel
    • Vote Up +2 Vote Down
    • Cancel
  • NewScreenName
    NewScreenName over 2 years ago in reply to Andrew Beckett

    Thank you. I am now using option 1.

    When it comes to use a bit less basic triggers than a bigger/lesser than condition, see that unfortunately the calculator syntax is not the correct one. For instance, I would like to get an assert at the 5th rising edge of a given signal, the following line will produce an error:

    assert2 assert expr="cross(v("i_top.clk") 0.8*vdd 5 "rising" nil nil  nil )"

    here in the specific case I am not even sure whether the issue is the syntax, or the cross function not being read as a false/true statement?

    How should I write it in the specific case to get an assert at Nth rising edge of a signal?

    And more in general, which syntax has to be used here? Where can I find some documentation to refer to, when more complicated trigger conditions might arise?

    Thank you

    Best regards

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to NewScreenName

    Any expressions for asserts are in Spectre MDL (Measurement Description Language) rather than SKILL (which is what the calculator uses). This is covered in the <SPECTREinstDir>/doc/mdlref/mdlref.pdf .

    There is a cross() function in MDL - here's what. you want:

    assert2 assert expr="cross(V(ip),'rise,5,0.5)" max=0

    Andrew

    • Cancel
    • Vote Up +2 Vote Down
    • Cancel
  • NewScreenName
    NewScreenName over 2 years ago in reply to Andrew Beckett

    Thank you.

    I have tried to implement this:

    content of included file:

    assert1 assert expr="v(test_signal)>vdd/2"
    assert2 assert expr="cross(sig=v(i_top.clk),dir='rise,n=5,thresh=0.5)" max=0

    However I think the second assert does not get triggered, because while I do get in the simulator log a line stating: "The value of parameter 'reltol' was set to 0.01 at time 9.19285e-09 s. The effective value of 'reltol' is now 0.01" which corresponds to the assert1, there is never a similar line for reltol at 1e-5.

    (clearly I did check that signal i_top.clk crosses the 0.5V threshold for at least 5 times during the simulation)

    Plus it seems that the assert2 is properly recognized as the following statement appears: " WARNING (SPECTRE-17003): Assert `assert2' contains an expression that needs to be evaluated by MDL. Using this assert frequently may lead to performance issues because the MDL evaluator is slower than the native assert evaluator. Support for evaluating assert expressions using MDL will be discontinued in future releases."

    Is it possible that the log does not mention the new change in reltol and the assert is still taking place, or the fact that I do not see it means it is not effective? And if so, did I make any mistake? 

    Also from the documentation, there is nothing obvious to me why this would not work (except I read cross function to be defined as crosses somewhere, but even with changing that, I get the same result)

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to NewScreenName

    There seem to be a couple of problems with using cross in an MDL-based assert that I found:

    1. The assertions don't get saved into the SQL database (so if you look at the Checks/Asserts view in ADE, they don't show up). They are actually triggering though. I found a very recent CCR on this (2825621) which was fixed in the last couple of days. I am checking with R&D whether it will fix my example - the root cause is that those using the older MDL flow for asserts are not saved to the SQL database.
    2. The same asserts do not trigger dynamic parameters either (sorry, I didn't notice that when I checked - I only saw the assert message and didn't realise it wasn't changing the errpreset/reltol that I was altering). This might be for the same root reason - I have filed CCR 2850319 for this.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • NewScreenName
    NewScreenName over 2 years ago in reply to Andrew Beckett

    Thank you for coming back with this.

    So is there any other way to do what I was trying to do (varying reltol and/or errpreset based on cross events during the simulation?)

    And if not, will this actually get fixed soon, as you mentioned in your point 1?

    Best regards

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to NewScreenName

    It seems that the fix for CCR 2825621 does indeed fix this, provided that you use the pass-by-order syntax (that I used in my example above) for the cross-function rather than than the pass-by-name syntax that you used. In other words, if you use:

    assert2 assert expr="cross(V(ip),'rise,5,0.5)" max=0

    then this should work. SPECTRE21.1 ISR21 (which contains the fix) is due out around 17th August.

    If you can't wait that long, another approach is to use a Verilog-A module instead to check. I just wrote this:

    `include "disciplines.vams"
    
    module dynassert(trigger);
    input trigger;
    electrical trigger;
    
    parameter real thresh=1.0;
    parameter integer direction=1;
    parameter integer crossnum=1;
    integer crosscount;
    integer assert;
    
    analog 
      @(cross(V(trigger)-thresh,direction)) begin
        crosscount=crosscount+1;
        if(crosscount==crossnum) begin
          $display("Triggered crossing at time ",$abstime);
          assert=1;
        end
      end
    
    endmodule
    

    then you'd instantiate this in your design connected to the signal you're monitoring and set thresh, crossnum and direction parameters appropriately (direction=1 means rising). Then use "@(DA1:assert)" (in quotes) with DA1 being the instance name of the monitoring component as the dynamic parameter event trigger. 

    I tested this - it works fine for me.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to NewScreenName

    It seems that the fix for CCR 2825621 does indeed fix this, provided that you use the pass-by-order syntax (that I used in my example above) for the cross-function rather than than the pass-by-name syntax that you used. In other words, if you use:

    assert2 assert expr="cross(V(ip),'rise,5,0.5)" max=0

    then this should work. SPECTRE21.1 ISR21 (which contains the fix) is due out around 17th August.

    If you can't wait that long, another approach is to use a Verilog-A module instead to check. I just wrote this:

    `include "disciplines.vams"
    
    module dynassert(trigger);
    input trigger;
    electrical trigger;
    
    parameter real thresh=1.0;
    parameter integer direction=1;
    parameter integer crossnum=1;
    integer crosscount;
    integer assert;
    
    analog 
      @(cross(V(trigger)-thresh,direction)) begin
        crosscount=crosscount+1;
        if(crosscount==crossnum) begin
          $display("Triggered crossing at time ",$abstime);
          assert=1;
        end
      end
    
    endmodule
    

    then you'd instantiate this in your design connected to the signal you're monitoring and set thresh, crossnum and direction parameters appropriately (direction=1 means rising). Then use "@(DA1:assert)" (in quotes) with DA1 being the instance name of the monitoring component as the dynamic parameter event trigger. 

    I tested this - it works fine for me.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
Children
No Data

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