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!!!
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.
In reply to Andrew Beckett:
Ok, here is the problem:
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 );
MCresults = outfile( "/home/scard/results/SBOX_mc_htypefinal/sbox_mc_results.txt" "a")
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???
In reply to Micka:
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
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?