• 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. How to print the Monte Carlo iterations results

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 144
  • Views 14878
  • 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 print the Monte Carlo iterations results

Micka
Micka over 16 years ago

Hello,

I am pretty new with writing ocean scripts.

I have a task to run Monte Carlo simulations and print or save results of iterations.

For example, for each input of CMOS_S_BOX I have to find mean value of leackage cuurent,

but I want to have saved these iteration results in a file...Where am I wrong?::

ocnWaveformTool( 'wavescan )
simulator( 'spectre )
design(  "/home/scard/simulation/CMOSSbox_test_new_htype/spectre/schematic/netlist/netlist")
resultsDir( "/home/scard/simulation/CMOSSbox_test_new_htype/spectre/schematic" )
definitionFile(
    "models.scs"
)
analysis('tran ?stop "1u" )
desVar(   "tclk" 1u )
desVar(   "j" 0 )
desVar(   "del" 200n )
option( 'temp  "25.0"
 'iabstol  "1e-14"
 'vabstol  "1e-8"
 'reltol  "1e-6"
)
save( 'i "/V4/PLUS" )
temp( 25.0 )
MCresults = outfile( "/home/scard/results/SBOX_mc_htypefinal/sbox_mc_results.txt" "w")
monteCarlo( ?numIters "10" ?startIter "1" ?analysisVariation 'mismatch ?sweptParam "None" ?sweptParamVals "25" ?saveData t ?nomRun "yes" ?append nil)
monteExpr( "leak" "-average(clip(i(\"/V4/PLUS\" ?result \"tran-tran\") 5e-07 1e-06))" )
monteRun()
Imc_mean = average(-average(clip(i("/V4/PLUS" ?result "tran") 5e-07 1e-06)))
fprintf( MCresults "%3.4f \n" Imc_mean*1e9 );
close(MCresults);
MCresults = outfile( "/home/scard/results/SBOX_mc_htypefinal/sbox_mc_results.txt" "a")
)
close(MCresults)

In this bolded area I am obviously doing mistakes, because in the mcdata file I get same results for all 10 iterations, but running an usual MC simulation I am getting different values...HELP,  PLEASE!!!

Thank you...

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 16 years ago

    I think I answered this in the other posting, but you need to worry about aliased versus non-aliased results names.

    Look in <ICinstDir>/doc/aatoolsuser/aatoolsuser.pdf and search for the word "aliased". You'll find a section (around page 94 in IC5141 doc) which talks about "Data Access Function Types" and on the next page "Data Name Aliasing". Both of those explain this pretty well.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Micka
    Micka over 16 years ago

    Ok, here is the problem:

    monteRun()

    Imc_mean = average(-average(clip(i("/V4/PLUS" ?result "tran") 5e-07 1e-06)))

    fprintf( MCresults "%d \t\t %3.4f \t\t %2.3f \n" j Imc_mean*1e9 Imc_std*1e9 );

    close(MCresults);

    MCresults = outfile( "/home/scard/results/SBOX_mc_htypefinal/sbox_mc_results.txt" "a")

    )

    close(MCresults)

    Ok, with this bolded command I get the average value of 400 MC runs, and I wana have in sbox_mc_results.txt results of all 400 MC runs.

    How do I achieve that?

    If I put only

    Imc_mean = -average(clip(i("/V4/PLUS" ?result "tran") 5e-07 1e-06))

    it gives me like a result some strange letters.

     So, my question is what instruction do I have to use, so I could save average results of all 400 MC iterations???

    Thank you...

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

    What you'll get that way is something like srrWave:NNNN or drwave:NNNN depending on the version you're using.

    If you use the ocnPrint() function, you can print out the values of waveform objects. So I suspect that's what you want.

    Or you could use the abStats.il code I pointed you to in a previous post, and then do:

    mcData=abReadMonteData(strcat(openResults() "/monteCarlo"))
    valtab=mcData->datatab["leak"]
    for(i 0  mcData->N - 1
      fprintf(MCresults "%g\n" valtab[i])
    ) ; for

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • AMRUT
    AMRUT over 15 years ago

    Even I am facing the similar problem. I want to save the iteration values i.e. using iterVsValue command , in monte carlo simulation.

    I need to save it in a file, how can I do that?  

     

    • 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