Parametric Analysis With OCEAN

For most simulations I need to run, I try and avoid SKILL and OCEAN if at all possible.  I can usually achieve the same results easier and faster using Python.  Yesterday however, I decided to run a parametric transient analysis using Spectre, and OCEAN was certainly the easiest way to get it done (though I’m not convinced at this point that it is the fastest.)  Just as an aside for those who are unfamiliar, OCEAN is an interpreter that let’s you write simulation scripts to control standard circuit simulators such as Spectre, Ultrasim, etc.  The nice thing about it is that the script generation is integrated into the Cadence analog design environment.  You can setup a simulation graphically, and then just say File->Save Script and you will get text file that can be run using OCEAN.  To run it, just add Cadence_Install_location/dfII/tools/bin to your path and type OCEAN.  Then a simple: load “mySimScript.ocn” will get things rolling.

My parametric simulation however, caused me a bit of grief.  If you have an expression in your output list (AVERAGE, VALUE, FREQ, etc.) then Cadence assumes you want to view it as a waveform when the simulation completes.  Saving your OCEAN script will result in something like this:

analysis(‘tran ?stop “40m”  ?outputstart “10u”  )
paramAnalysis(“someVariable” ?values ‘(1 2 3 4 5))
selectResult( ‘tran )
myExpression = value(VT(“/someWave” “/myDesign/spectre/schematic”) 0.04 ?histoDisplay nil ?noOfHistoBins 1)
plot( myExpression ?expr ‘( “My Expression” ) )
So what if you don’t want to plot your expression, but instead want to save it to a file and plot it with some other software?  This took a bit of guess and check, but here is the trick – get rid of the path in the expression.  If you leave the path there, you’ll only get a single output point since each parametric run produces its own output directory.  I’m also not sure if “selectResult” is different than “selectResults” but the latter makes more sense to me. Changing the script to this gives the desired results:
selectResults( ‘tran )
myExpression = value(VT(“/someWave”) 0.04 ?histoDisplay nil ?noOfHistoBins 1)
ocnPrint( ?output “./paramOutput.txt” ?numberNotation ‘scientific myExpression)
Now you’ll get a nicely formatted file with each point in your parametric run.