Home > Community > Forums > Custom IC SKILL > How to print the Monte Carlo iterations results

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 How to print the Monte Carlo iterations results 

Last post Thu, Aug 19 2010 12:00 AM by AMRUT. 4 replies.
Started by Micka 07 May 2009 07:25 AM. Topic has 4 replies and 3011 views
Page 1 of 1 (5 items)
Sort Posts:
  • Thu, May 7 2009 7:25 AM

    • Micka
    • Not Ranked
    • Joined on Thu, May 7 2009
    • Posts 3
    • Points 60
    How to print the Monte Carlo iterations results Reply

    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...

    • Post Points: 20
  • Thu, May 7 2009 2:07 PM

    Re: How to print the Monte Carlo iterations results Reply

    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.

    • Post Points: 20
  • Sat, May 9 2009 4:46 AM

    • Micka
    • Not Ranked
    • Joined on Thu, May 7 2009
    • Posts 3
    • Points 60
    Re: How to print the Monte Carlo iterations results Reply

    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...

    • Post Points: 20
  • Mon, May 11 2009 5:23 AM

    Re: How to print the Monte Carlo iterations results Reply

    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

     

    • Post Points: 20
  • Thu, Aug 19 2010 12:00 AM

    • AMRUT
    • Not Ranked
    • Joined on Wed, Aug 18 2010
    • Posts 1
    • Points 5
    Re: How to print the Monte Carlo iterations results Reply

    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?  

     

    • Post Points: 5
Page 1 of 1 (5 items)
Sort Posts:
Started by Micka at 07 May 2009 07:25 AM. Topic has 4 replies.