• 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 SKILL
  3. Aborting transient analysis after desired value is foun...

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 143
  • Views 17688
  • 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

Aborting transient analysis after desired value is found

JayJetz
JayJetz over 14 years ago

I am simulating a floating gate memory model custom made in verilog.  I am running several simulations using an Ocean script with varying parameters to determine total charge, time to reach total charge, retention time, etc.  All of these must be done with transient analysis.

 My question is how do I abort a transient analysis once the maximum charge is reached (there is a node in the model that displays the charge that can be read as a voltage).  The problem is when I run transient analysis, it takes an incredibly long time because the charge is constantly changing due to thermal effects and my time step is in the picosecond range.  I have tried setting the step to a larger value using the ?step parameter for the analysis command, but that did not change anything.

 Once the simulation is complete, I have the code to scan the waveform, find the maximum charge, how long it took to reach this value, print the information to a text file, change parameters and repeat.  The only problem is the time to run the simulation.  It takes up to 5 minutes and I have thousands of simulations to run for each data point.   Also, the time it takes to reach the maximum charge varies with the parameters so I can not just set the transient analysis to a very small value.  Right now it is at 1 microsecond.

  So, I am looking for the analysis parameters that would allow me to stop after reaching the maximum charge.  This could be found by a simple if statement that says if the same maximum is reached twice, stop the experiment.  The charge on the floating gate changes by 1 due to thermal effects every few picoseconds and this is why the simulation takes so long.

  • Cancel
  • JayJetz
    JayJetz over 14 years ago

    I feel more clarification is needed.  Here is the output for a 1 second long simulation that I aborted after it reached 30 microseconds (which took more than 10 minutes to run the simulation):

     

        tran: time = 17.72 ps   (1.77 n%), step = 298.4 as    (29.8 f%)
        tran: time = 109 ps     (10.9 n%), step = 106.6 fs    (10.7 p%)
        tran: time = 1.145 ns    (114 n%), step = 891.6 fs    (89.2 p%)
        tran: time = 10.4 ns    (1.04 u%), step = 5.085 ps     (509 p%)
        tran: time = 2.667 us    (267 u%), step = 11.28 ns    (1.13 u%)
        tran: time = 3.373 us    (337 u%), step = 26.15 ps    (2.62 n%)
        tran: time = 4.683 us    (468 u%), step = 21.92 ps    (2.19 n%)
        tran: time = 6.609 us    (661 u%), step = 183.6 ps    (18.4 n%)
        tran: time = 8.076 us    (808 u%), step = 546.5 ps    (54.7 n%)
        tran: time = 10.56 us   (1.06 m%), step = 3.132 ns     (313 n%)
        tran: time = 11.91 us   (1.19 m%), step = 1.13 ns      (113 n%)
        tran: time = 14.02 us    (1.4 m%), step = 89.52 ps    (8.95 n%)
        tran: time = 17.12 us   (1.71 m%), step = 339.6 ps      (34 n%)
        tran: time = 18 us       (1.8 m%), step = 8.234 ps     (823 p%)
        tran: time = 20.87 us   (2.09 m%), step = 9.58 ns      (958 n%)
        tran: time = 22.94 us   (2.29 m%), step = 743.4 ps    (74.3 n%)
        tran: time = 24.04 us    (2.4 m%), step = 89.32 ps    (8.93 n%)
        tran: time = 24.83 us   (2.48 m%), step = 49 ps        (4.9 n%)
        tran: time = 26.18 us   (2.62 m%), step = 401.1 ps    (40.1 n%)
        tran: time = 27.26 us   (2.73 m%), step = 5.733 ns     (573 n%)
        tran: time = 28.01 us    (2.8 m%), step = 2.069 ns     (207 n%)
        tran: time = 29.13 us   (2.91 m%), step = 117.2 ps    (11.7 n%)

     

    The maximum charge was reached at 71 nanoseconds.  I would like the simulation to automatically stop around this time.  The rest of the simulation is updating the waveform when the charge changes from one below the maximum charge back to the maximum charge.  Is there some way to set the minmum step to 10 nanoseconds?  Are there other methods that I could use to abort the simulation?

    Or perhaps is there a way to run a transient simulation manually one step at a time?  For example, step 1 nanosecond, check value, step 5 nanoseconds, check value, etc. 

    Thank you for your help. 

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    Several ways you could do this. One is to use SpectreMDL to run the analyses and make the measurements, and then use the "autostop" facility to stop the simulation. Look in the simulator documentation for the Measurement Description Language info.

    The other approach (which will probably work better if you are using OCEAN or ADE for simulation) is to have a VerilogA block in your schematic which checks for the condition having been met, and then calls $finish_current_analysis when met. See Solution 11488490 .

    An example:

     `include "disciplines.vams"
    module stopearly (a);

    input a;
    electrical a;

    analog

       @(cross(V(a)-0.9)) $finish_current_analysis;

    endmodule

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • JayJetz
    JayJetz over 14 years ago

     Thank you for your quick reply Andrew.  I saw the autostop function, but I do not have much information on how to use it. All it says is 

    "If yes, the analysis is terminated when all event-type
    meaurement expressions have been evaluated. Event-type
    expressions use thresholding, event or delay type functions.
    Possible values are no or yes."

     How do I use this function?  As for putting the code in Verilog directly, the only problem is that I do not know what the maximum charge value is.  The only way to tell is to let the experiment run a little longer and see if the charge decreases or never reaches a higher value.  This maximum charge and time changes for each set of parameters. 

     Is there a way to manually run a transient analysis?  I think this would be easiest and quickest for a large number of experiments because I could just test points around the typical values to get the charging time.  It does not have to be exact, just in the range.

     Thanks again.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 14 years ago

    For MDL-based autostop, there are examples in the installation. Look in <MMSIMinstDir>/tools/spectre/examples/MDL_workshop and you'll find a PDF and gzipped tar file showing you the data. Within the workshop, at least dflip/autostop.mdl is one (you may have others depending on the version you're using - do a grep for autostop). As with the VerilogA based solution, you need to have some criteria by which to decide to stop.

    With VerilogA, there's no reason why you couldn't detect when (say) the derivative of the charge crosses 0 (i.e. the slope flattens and then goes negative). Or you could check it's been negative for a while. Really depends on how you want to decide whether to stop.

    I don't know what you mean by "manually run a transient analysis". You can run spectre from the command line, if that's what you mean?

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • JayJetz
    JayJetz over 14 years ago

    The slope is always zero.  I was not clear earlier.  When I say charge, I mean number of electrons.  So the final graph looks like a staircase with each step being an additional electron.  So, I can't check when the slope goes negative or if the slope stays 0 for a certain amount of time.  Imagine the maximum charge being reached at 70 ns, drops to max - 1 at 82 ns, back to max at 100ns, then drops down to max - 1 at 110 ns.  If I wait for 15 ns I would get the max - 1 value and the incorrect time.  Similar situations can be imagined for any "wait" time. 

      By manually run the transient analysis, I mean check the waveform result at an input time without having to simulate the entire wave.  For the result I posted above:

        tran: time = 17.72 ps   (1.77 n%), step = 298.4 as    (29.8 f%)
        tran: time = 109 ps     (10.9 n%), step = 106.6 fs    (10.7 p%)
        tran: time = 1.145 ns    (114 n%), step = 891.6 fs    (89.2 p%)

    Lets say I wanted to check the values at 1 ns, then the value at 5 ns, so a 5 ns step, so only have two data points for the waveform.  As opposed to the 106.6 fs and 891.6 fs steps.  Or just ask the simulator to simulate a specific time, such as 1.145 ns without having to do the previous steps.

    Or another way to put it, run a transient analysis for 1 ns with 10 ps steps, have the simulation stop so I could check the value, then continue again for another 10 ns with 1 ns steps, stop and check value, with both simulations adding to the same waveform.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • JayJetz
    JayJetz over 14 years ago

    I got it to work using $finish_current_analysis and a couple if statements in Verilog.  Thank you for your help. 

    • 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