Home > Community > Forums > Custom IC Design > Statistical values manipulation - Monte Carlo

## Email

Recipients email * (separate multiple addresses with commas)

Message *

 Send yourself a copy

## Subscribe

Intro copy of the newsletter section here, some intro copy of the newsletter. Instruction of how to subscribe to this newsletter.

First Name *

Last Name *

Email *

Company / Institution *

 Send Yourself A Copy

# Statistical values manipulation - Monte Carlo

Last post Thu, May 7 2009 2:00 PM by Andrew Beckett. 5 replies.
 Started by Juan Pablo 04 Apr 2009 08:50 AM. Topic has 5 replies and 5525 views
• #### Sat, Apr 4 2009 8:50 AM

• Juan Pablo
• Joined on Thu, Jul 17 2008
• Porto Alegre, Rio Grande do Sul
• Posts 2
• Points 40
Statistical values manipulation - Monte Carlo
 Dear,Using IC5141 with MMSIM70 a have a doubt concerning Monte Carlo simulation.For a given Histogram is that possible to collect the statistical data (mean and/or standard-deviation) and manipulate this on the ADE Calculator?For example, if I want to obtain the Coefficient of variation which is defined as the ratio of the standard deviation to the mean (sigma/mu). There exist a way to obtain this value (scalar) from an especial function of the ADE calculator or an option of the Analog Statistical Analisys ?One way is to get the values from Simulation Directory and treating on MS Office Excel…but I want to stay on Cadence.Cheers,juan
Filed under: ,
• Post Points: 20
• #### Sat, Apr 4 2009 1:51 PM

Re: Statistical values manipulation - Monte Carlo
 A number of customers use the abStats.il code included in my sourcelink.cadence.com solution - number 11026072 (just search for that number).This has functions to return the mean, median, min, max, standard deviation, percentiles, and various other useful functions related to the results of monte carlo simulations. You might also want to take a look at solution 11474384.Best Regards,Andrew.
• Post Points: 20
• #### Mon, Apr 6 2009 8:42 AM

• Juan Pablo
• Joined on Thu, Jul 17 2008
• Porto Alegre, Rio Grande do Sul
• Posts 2
• Points 40
Re: Statistical values manipulation - Monte Carlo
 Hi Andrew,Thanks a lot for your help.I am an analog guy and my programming skills are practically zero.So, what’s the manner the use/install this code on my system?Do you have any references concerning OCEAN scripts ?On IC6 the ADEXL tool I have an option to insert an OCEAN script. Is that the right way?RegardsJuan
• Post Points: 20
• #### Wed, Apr 8 2009 3:46 AM

Re: Statistical values manipulation - Monte Carlo
 Yes, the functions are a little more geared up for use in OCEAN scripts rather than in ADE.To use them, you'd do:load("abStats.il")and then use the functions as described in the comments at the top of the code. For more info on OCEAN, probably best to start with the OCEAN reference manual - /doc/oceanref/oceanref.pdf Cadence also has a training class on OCEAN.Alternatively, another way you can do things is to use the "save family data" option on the monte carlo form, and then use the same expression you used for your monte carlo scalar expressions in the calculator. This will give you a waveform which has the result of the expression versus the iteration number. Having done that you can use the calculator stddev function to find the standard deviation, or the average function to find the mean. Take note of the second solution number I mention above, as this describes the slight difference you'll get in the mean and standard deviation when doing it this way.Regards,Andrew.
• Post Points: 20
• #### Thu, May 7 2009 8:18 AM

• Micka
• Joined on Thu, May 7 2009
• Posts 3
• Points 60
Re: Statistical values manipulation - Monte Carlo
 Soory, do you maybe have a solution to my problem?I cannot manage to save the results of MC iterations?The code is: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 "3" ?startIter "1"     ?analysisVariation 'mismatch ?sweptParam "None"     ?sweptParamVals "27" ?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-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)Probably, somewher here is an error.Can you help me with this?
• Post Points: 20
• #### Thu, May 7 2009 2:00 PM

Re: Statistical values manipulation - Monte Carlo
 It's not obvious why this isn't working - you didn't give any error messages that it might have given, or what wasn't working.However, what I usually recommend is to use the functions described in sourcelink solution  11026072 - these allow you to read and post-process the scalar results saved in the monte carlo run - so it means you don't have to recompute the expression from the complete family all over again.You may also want to use the  "non-aliased" name (this is mentioned in the documentation too). Use i("..." ?result "tran") instead of "tran-tran" - otherwise you can find yourself getting the nominal result rather than the monte-carlo result... Best Regards,Andrew.
• Post Points: 5