• 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. How to plot the difference of simulation result from Monte...

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 125
  • Views 14258
  • 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

How to plot the difference of simulation result from Monte carlo and standard simulation?

Martinsh
Martinsh over 4 years ago

We can run a standard simulation and get curve A. We also can run n point Monte carlo simulation and get curve B1~Bn. I want to plot the difference between curve B1~Bn and curve A, that is B1-A, B2-A, ..., Bn-A. How should I do to plot the curves?

Thanks!

  • Cancel
Parents
  • ShawnLogan
    ShawnLogan over 4 years ago

    Dear Martinsh,

    I apologize if this is obvious to you, but when performing a Monte Carlo simulation, you can select to perform  a "nominal" simulation. The parameters chosen for the "nominal" simulation will correspond to those without any added Monte Carlo variations. Hence, this simulation could be your "standard simulation" which might serve as the basis for your difference signals.

    If that does not meet your objective, then you could either use the Results Browser to select your desired "standard simulation" and use its results in an Assembler expression with your Monte-Carlo simulation data. 

    Finally, a third method is to access both the Monte Carlo data and your "standard simulation" data in an ocean script and perform the differences between the two as part of the script.

    I hope this helps a little and that I understood your question Martinsh!

    Shawn 

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Martinsh
    Martinsh over 4 years ago in reply to ShawnLogan

    Dear Shawn,

    It works. Thanks.

    Martinsh

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

    Martinsh,

    I'm glad "it works" (not sure which approach suggested by Shawn that you used), but I wanted to give another suggestion.

    First of all, I'm not sure what Shawn meant by 'when performing a Monte Carlo simulation, you can select to perform  a "nominal" simulation'. There used to be an option on the form (for ADE XL) but it was removed for ADE Assembler. With ADE XL it was almost entirely useless; it was a hangover from older flows where the nominal was used to validate the expressions and the simulation didn't proceed if the nominal failed. However, even then you couldn't access the nominal results, and once the Monte Carlo flow had changed to not evaluate the expressions within the simulator, it didn't even check the nominal run any more. So that's why it was cleaned up with Assembler. Even if you manually add donominal=yes in the extra field for Monte Carlo, it just runs an extra simulation for each of the parallel runs, but the results are inaccessible.

    The simplest approach (whilst not requiring manual steps afterwards, and not requiring OCEAN scripts) is to use a "Run Plan" in ADE Assembler. I had an output expression called "Voffset" which I wanted to measure the difference from nominal, and my Monte Carlo was set up as normal - I then did these steps:

    1. Create->Run Plan
    2. Click on the "Create Run From Active Setup" icon (leftmost button in Run Plan assistant) twice
    3. Rename the first run plan entry "Nominal" and the second "Monte"
    4. Right Mouse over the simulation mode (Monte Carlo Sampling) on the "Nominal" Run plan and change to "Single Run, Sweeps and Corners"
    5. In the outputs, add a new output for your test: Voffset - calcVal("Voffset" "DC" ?run "Nominal") 

    Press the Play button in the Run Plan Assistant. In the Monte run, you will then get this new output being the difference from the nominal run.

    Pretty easy, and no scripts were harmed in the generation of this output!

    Andrew

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

    Dear Andrew,

    I got the difference data with the second way with results browser given by Shawn.

    Just as you mentioned, I can't find the nominal simulation in ADE Assembler.

    Your solution looks good, but there is problem when I try it.

    I add two expressions in output panal,

    Pout = VS("/pout_dbm")     // pout_dbm is a net name

    Pout_Delta = Pout - calcVal("Pout" "la_ca_tsmc18_sim_sim_am_loop_ocp_1" ?run "Nominal")

    After the plan run, Pout and Pout_Delta are valid in "Nominal" result panal. But Pout_Delta is invalid in "Monte" result panal.

    Expression log:

    \o [2021-05-11 18:34:54.654 +0800] [error] - point:'2' test:'la_ca_tsmc18_sim_sim_am_loop_ocp_1'
    \o Expression:'(Pout - calcVal("Pout" "la_ca_tsmc18_sim_sim_am_loop_ocp_1" ?run "Nominal"))'
    \o because of the following error(s)
    \o *Error* getchar: argument #1 should be either a string or a symbol (type template = "Sx") [Attributes] {"point": 2, "testname": "la_ca_tsmc18_sim_sim_am_loop_ocp_1", "?test": "la_ca_tsmc18_sim_sim_am_loop_ocp_1", "?expression": "Pout_Delta"}

    What's wrong with my setup?

    Martinsh

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Martinsh

    Dear Martinsh ( and Andrew),

    Martinsh said:
    Just as you mentioned, I can't find the nominal simulation in ADE Assembler.



    First and foremost, I must stand corrected! I do see that the "Nominal run" checkbox is no longer available in the Monte-Carlo GUI panel in Assembler - I apologize for any confusion I caused!

    I must also thank you, Andrew, for clarifying to me why the "feature" is no longer supported!

    Martinsh said:
    What's wrong with my setup?



    Secondly, I am not positive Martinsh, but with regard to the error message you are now observing with the calcVal() function, it appears in Andrew's example he is using the result of an expression which is a scalar. In the example you provided, it appears you are using a waveform - which is not a scalar. However, from the SKILL reference for the calcVal() function, the output may be a scalar or a waveform - so using a waveform should be acceptable.

    The calcVal() function is well documented in the On-line support document at URL:

    https://support.cadence.com/apex/RedirectPage?urlType=techPubs&url=/tech-pubs/Docs/maeSKILLref/maeSKILLrefICADVM20.1/maeSKILLref.pdf

    starting on page 1802. Its syntax is:

    calcVal(
    t_outputName
    [ t_testName ]
    [ ?cornerName t_cornerName ]
    [ ?historyName t_historyName ]
    [ ?run t_runName ]
    [ ?result t_resultName ]
    [ ?getFirstSweepPoint t_getFirstSweepPoint ]
    [ ?ignoreParams g_ignoreParams ]
    [ ?matchParams g_matchParams ]
    [ ?defaultVal t_defaultVal ]
    )
    => g_output / nil

    Note its second argument, [t_testName] which is defined as:

    Name of test name to which the given output
    belongs. When not specified, the name of the current test is
    used.

    An example of its use with a waveform is shown on page 1806 as:

    Example 5:
    You can use the waveform from the result, as shown below.
    calcVal("/OUT" "AC" ?result "ac")
    => srrWave:0x40421090

    However, in looking at your Pout_Delta expression, it appears you omitted the simulation type (i.e., "DC" or "tran" or "AC") and included the waveform name (Pout) in double quotes and not the actual node name "/pout_dbm". Pout, according to your prior expression is already defined as a waveform.

    Did you happen to try something like:

    calcVal("/pout_dbm" "analysis_type" "la_ca_tsmc18_sim_sim_am_loop_ocp_1" ?run "Nominal")

    where "analysis_type" is the type of analysis from which "/pout_dbm" is accessible? I think the error you are observing assumes the analysis type ([t_testname], (argument #2 of calcVal()) is:

    Martinsh said:
    "testname": "la_ca_tsmc18_sim_sim_am_loop_ocp_1",

    which is not a valid value for "t_testname".

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Martinsh

    Dear Martinsh ( and Andrew),

    Martinsh said:
    Just as you mentioned, I can't find the nominal simulation in ADE Assembler.



    First and foremost, I must stand corrected! I do see that the "Nominal run" checkbox is no longer available in the Monte-Carlo GUI panel in Assembler - I apologize for any confusion I caused!

    I must also thank you, Andrew, for clarifying to me why the "feature" is no longer supported!

    Martinsh said:
    What's wrong with my setup?



    Secondly, I am not positive Martinsh, but with regard to the error message you are now observing with the calcVal() function, it appears in Andrew's example he is using the result of an expression which is a scalar. In the example you provided, it appears you are using a waveform - which is not a scalar. However, from the SKILL reference for the calcVal() function, the output may be a scalar or a waveform - so using a waveform should be acceptable.

    The calcVal() function is well documented in the On-line support document at URL:

    https://support.cadence.com/apex/RedirectPage?urlType=techPubs&url=/tech-pubs/Docs/maeSKILLref/maeSKILLrefICADVM20.1/maeSKILLref.pdf

    starting on page 1802. Its syntax is:

    calcVal(
    t_outputName
    [ t_testName ]
    [ ?cornerName t_cornerName ]
    [ ?historyName t_historyName ]
    [ ?run t_runName ]
    [ ?result t_resultName ]
    [ ?getFirstSweepPoint t_getFirstSweepPoint ]
    [ ?ignoreParams g_ignoreParams ]
    [ ?matchParams g_matchParams ]
    [ ?defaultVal t_defaultVal ]
    )
    => g_output / nil

    Note its second argument, [t_testName] which is defined as:

    Name of test name to which the given output
    belongs. When not specified, the name of the current test is
    used.

    An example of its use with a waveform is shown on page 1806 as:

    Example 5:
    You can use the waveform from the result, as shown below.
    calcVal("/OUT" "AC" ?result "ac")
    => srrWave:0x40421090

    However, in looking at your Pout_Delta expression, it appears you omitted the simulation type (i.e., "DC" or "tran" or "AC") and included the waveform name (Pout) in double quotes and not the actual node name "/pout_dbm". Pout, according to your prior expression is already defined as a waveform.

    Did you happen to try something like:

    calcVal("/pout_dbm" "analysis_type" "la_ca_tsmc18_sim_sim_am_loop_ocp_1" ?run "Nominal")

    where "analysis_type" is the type of analysis from which "/pout_dbm" is accessible? I think the error you are observing assumes the analysis type ([t_testname], (argument #2 of calcVal()) is:

    Martinsh said:
    "testname": "la_ca_tsmc18_sim_sim_am_loop_ocp_1",

    which is not a valid value for "t_testname".

    Shawn

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

    Shawn, Martinsh,

    The ?result argument is only needed for outputs of type signal. In Martinsh's case, the output was an expression, so it shouldn't be necessary.

    However, you were right - this doesn't seem to work if the output is a waveform not a scalar value. For me (in IC618 ISR18), the expressions work in the Nominal run, but don't work properly in the Monte. I don't get the error (the getchar error), and the output is shown with a waveform icon suggesting that it evaluated OK during the run, but I can't plot the outputs. I think this is a bug.

    I did also try using ?getFirstSweepPoint t in the calcVal argument (which shouldn't be necessary, since the Nominal run is not a sweep). However, that gives an error and doesn't fix it.

    So my idea seemed like a reasonable one, but I'd not catered for the fact that it was a waveform difference that was desired. I would suggest contacting customer support to report the bug.

    Andrew

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

    Dear Andrew, Shawn,

    Thanks for you help. Though there is a bug, I got a solution for my problem.

    Martinsh

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Martinsh

    Dear Martinsh,

    Martinsh said:

    hough there is a bug, I got a solution for my problem.

    I am so very glad you found a method to help you out - and thank you for letting us know too! I also learned a couple things - thanks to your latest calcVal() result and Andrew's prior comments!

    Shawn

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

    BTW, I filed a CCR, 2484563, for the calcVal not working properly with a waveform expression output, since I'd already done most of the work putting together a testcase.

    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