• 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. Processing raw Spectre Monte Carlo data ?

Stats

  • Locked Locked
  • Replies 23
  • Subscribers 127
  • Views 29171
  • 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

Processing raw Spectre Monte Carlo data ?

MarkGr15
MarkGr15 over 10 years ago

I am using OceanXL (within ADEXL created scripts) to kick off Monte Carlo simulations. I would like to be able to post process the data myself, to be able to calculate the mean, sigmas etc... 

Is the raw data available for this, and how is it organized? I am having a hard time deciphering the file structure etc....

I do see the results listed in an output log, when I add " -log ocean_montecarlo_output.log" as a an option to the command line that I use to kick off my scripts.

The upshot is I want to be able to find the raw data in the output directory, and post process the measured data.

I am using IC6.1.6-64b.500.9.  

spectre -W  => sub-version  13.1.1.049

thanks

Mark

  • Cancel
  • ShawnLogan
    ShawnLogan over 10 years ago

    Dear Mark,

    > Is the raw data available for this, and how is it organized? I am having a hard time deciphering the file structure etc....

    > The upshot is I want to be able to find the raw data in the output directory, and post process the measured data.

    I do this quite often in ADE-XL using both corners and Monte-Carlo analyses with an ocean script. I retrieve the data (as well as some pertinent variables such as corner simulated, temperature, and supply voltage), post-process it and write the results to a file. I often use a while() loop to run through the simulation directory. If it is useful at all, I've included an example. The results were stored in the directory "Interactive.17". You can navigate to your results and substitute the appropriate paths and number of simulations (sim_num_max). Of course, for Monte-carlo, the directory is not going to be named "Interactive.XX". I hope I understood your question!

    Shawn

    sim_num = 1
    sim_num_max = 20

    while( sim_num < (sim_num_max + 1)

    sprintf(sim_num_val "%d" sim_num)

    results_dir = strcat(sim_num_val "/sd12gepf1_TB:test_cdr12g_clocksyn_newdivide:1")

    base_results = strcat("/home/patmp35/sml_1/simulation/sd12gepf1_TB/test_cdr12g_clocksyn_newdivide/adexl/results/data/Interactive.17/")
    results = strcat( base_results results_dir)

    printf("Results directory:\n%s\n" results)

    resultsDir( results )

    ; Load results

    openResults(results)
    selectResult('tran)

    ; Find variable values and section simulated

    vdda_val = VAR("vdda_val")
    sim_temp_val = VAR("temp")
    grep_cmd = strcat("grep section " results "/netlist/input.scs > section.txt")
    rm_cmd = strcat("rm section.txt")
    system(grep_cmd)
    section_file =infile("section.txt")
    gets( section_string section_file)
    process_val = substring(section_string nindex(section_string "=")+1)
    process_string_length = strlen(process_val)
    process_val = substring(process_val 1 process_string_length-1)
    system(rm_cmd)

    ....

    sim_num = sim_num + 1) ; End sim_num loop

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MarkGr15
    MarkGr15 over 10 years ago
    Shawn, I am not sure that you are addressing my question, however, it still looks interesting for other reasons. I want the monte carlo sims to take performance measurements (an output voltage at a specific time would be an example). For each monte carlo iteration, I would like to know the value of that measurement. I do not know where it puts the value of the measurement. I only see the post-processed values (mean, sigma, etc...) in my output log. thanks Mark
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 10 years ago

    Hi Mark,

    > I am not sure that you are addressing my question

    >  I want the monte carlo sims to take performance measurements (an output voltage at a specific time would be an example).

    > For each monte carlo iteration, I would like to know the value of that measurement.

    You are right, I did not understand your question as it was not clear to me you were looking only for the results of its measurements - not the raw data. Dumb question on my behalf, but is there a reason you cannot just take the data from the ADE-XL results data as a comma-separated file? You can access the data directly without having to access the results. If you are using IC6.1.6.500.9 or later, you can use the procedure described in Solution ID 20309689.

    Irrespective of that comment though, unlike when running Monte-Carlo prior to ADE-XL, I have not found the results of the measurements saved in a file as it was in IC 5.41 in the results directory.

    I often just run an ocean script, pull out the data and recompute it to get the statistics. I find this easier than creating a new expression and re-evaluating the data from a run. This assumes, of course, that you have checked the option to save the data for all the runs!

    My apologies for not understanding your question Mark,

    Shawn

    Shawn

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MarkGr15
    MarkGr15 over 10 years ago

    Shawn,

    by this comment : "Dumb question on my behalf, but is there a reason you cannot just take the data from the ADE-XL results data as a comma-separated file?" I get the impression that you think I am kicking off the sim with ADE-XL. I am not.  I am using Ocean Scripts, generated from ADE-XL. There is a difference.  The scripts only report the mean, and sigmas on a performance metric that I tell the scripts to measure.

    I am using the scripts b/c I do not like ADE-XL. I am trying to avoid using any GUI.  When I look in the directories for each test, I can not find any of the measurement results.

    I may be misunderstanding you. 

    Mark

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

    Mark,

    A couple of approaches.

    There are some files that get generated for legacy reasons called mcdata and mcparam. In current versions, if you have a run directory called Ocean.6 (for example) then these will be under psf/<testName>/monteCarlo and summarize the entire results for that test.

    You then could use my SKILL code in solution 11026072

    to read these files and do analysis on it. I've not used this for a while - I wrote it originally for IC51 (or even earlier) and something appears to be slightly broken - I'll look at it on Monday (it seems to get the number of samples wrong in my experiments).

    The other alternative is to use the axlReadHistoryResDB API. This returns an object for all the scalar results data, and you can then collect all the scalar results yourself. ADE XL (and OCEAN XL) store the evaluated results of the expressions into a database, and this API is a way to get at that database.

    So more later - would do it today, but I have to dash...

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MarkGr15
    MarkGr15 over 10 years ago

    Andrew,

    I am using the ocnxlOutputSummary() function:

    ocnxlOutputSummary(?yieldSummary t ?exprSummary nil ?specSummary nil ?detailed nil)

    However, my manager wants me to provide the raw results to a higher level program we are using internally. If theaxlReadHistoryResDB API function will help me  do that, I would prefer to do that.  However, looking at the function itself in the Skill-reference, I do not have an idea of how to use it. It appears to be more involved than just using that function.

    thanks

    Mark

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

    Mark,

    I'll aim to put together a short example early next week (it's a bit late to do it today, as it's 11:30pm here...), both using a fix of my abStats package and also the rdb approach.

    Even though you're running the sims from OCEAN, you could always open the results in ADE XL and export the results that way (as a stop-gap).

    Anyway, more next week (all being well)

    Regards,

    Andrew.

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

    I need to update my solution with the latest version of my abStats.il code - it turns out I'd already solved the problem, but haven't updated the solution for a little while (that's version 1.6, and I'm now on 1.10).

    Anyway, whilst I'm sorting out the logistics of how I update that code on the Cadence Online Support site, here's the "RDB" way of doing it.

    If you've got an OCEAN XL script, then before the call to ocnxlEndXLMode() - which you could comment out while you're debugging, you could use these types of approaches:

    rdb=axlReadHistoryResDB(ocnxlGetCurrentHistory() ?session ocnxlGetSession())
    foreach(point rdb->points()
      printf("Point %d\n" point->id)
      foreach(corner point->corners()
        printf(" Corner %L\n" corner->name)
        foreach(test corner->tests()
          printf("  Test %L\n" test->name)
          foreach(output test->outputs()
            when(output->type=='expr
              ; take your pick
              ;printf("    Output %s = %s\n" output->name output->valueAsString())
              printf("    Output %s = %L\n" output->name output->value)
            )
          )
        )
      )
    )
    
    ; If you know the output name, the test name, the corner name, and the 
    ; point id, you can also do:
    
    ;            OUTPUT     TEST  CORNER  POINT
    rdb->output("SlewRate" "TRAN" "monte" 5)->value
    
    ;so:
    numPoints=length(rdb->points())
    for(i 1 numPoints
      printf("%d: %L\n" i rdb->output("SlewRate" "TRAN" "monte" i)->value)
    )

    The last of these outputs:

    1: 3.506975
    2: -0.2851584
    3: -17.87033
    4: nil
    5: 0.00175099
    6: nil
    7: nil
    8: nil
    9: nil
    10: nil

    (note I have some evaluation errors in my results, hence the nil; this was intentional for testing purposes). Using a different output which was successful:

      printf("%d: %L\n" i rdb->output("InputRandomOffset" "AC" "monte" i)->value)

    Then I get:

    1: 3.890861e-05
    2: 1.782552e-05
    3: 7.01937e-05
    4: 3.299102e-05
    5: 2.447977e-05
    6: 2.647171e-05
    7: 1.15022e-05
    8: 3.805743e-06
    9: 4.781233e-05
    10: 5.209653e-05

    In general you can get more help by doing rdb->help()

    Regards,

    Andrew.

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

    I've now updated the abStats.il code in solution 11026072 to version 1.10. With this you can do:

    data=abReadMonteData("./simulation/libName/cellName/viewName/results/data/historyName/psf/testName/monteCarlo" ?noSweep t)

    and then the rest of the comments in the code should tell you how to use it.

    Regards,

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • MarkGr15
    MarkGr15 over 10 years ago

    Andrew:

    1)  Are you saying I can do For Loops, etc... within my OceanXL coding that I have set up based on the ADE-XL testbench?

    2) for the abStats.il code :   the file says " Modified   Jul 30, 2013 " ...., do I have the correct file?  Or did you forget to update your comments.

    I'm sure I will have other questions, but I'll start there.

    thanks!

    Mark

    • 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