Transcript

Running Cadence Simulations using the Ocean EnvironmentAmeya Bhide, EK October 15, 2010

1

Introduction

Typical simulations in the Cadence R Analog Design Environment are run manually in which the user tries out dierent experiments by changing the settings in the GUI. While this works well for the initial simulations of a design, this can be especially time consuming when simulations have to be repeated as a part of the regression process. Also, there is no good way to really document the calculated expressions of the simulation in a spreadsheet like format in this mode. Running simulations across multiple process corners, supply voltages and temperature with a single button click is not possible as well. Each simulation has to be run separately in the manual mode. In order to circumvent this problem, Cadence provides an environment called the Ocean Environment which supports SKILL scripting. SKILL can be utilized to automate the process of running multiple simulations. OCEAN is an acronym that stands for Open Command Environment for Analysis. Using this can help to improve the eciency of ones simulations and also document results in a systematic way. Recently, a new version of the design environment called Cadence IC614 has been released, which helps the user to perform all the aforementioned tasks without the need for scripts. This document is primarily intended for users using older version of design environment and those who would like to improve the eciency of their regression simulations. This document will introduce the users to some of basic features of SKILL which are useful in most simulations.

2

Running your rst script based simulation

In order to run the rst script based simulation, start the Cadence ADE and open any of your existing testbenches by loading a previously loaded state. Now open the Sessions option and click on the Save Script option. Save the le with any name. Your screen should now look something like in Fig. 1 :Now the saved script can be run or loaded by typing the following command in the icfb window :- load Your screen should now look like Fig. 2. Now that we know how to run an ocean script le, lets look at how a typical script might look like and what the various sections are in such a le. The saved script le might look something like in Fig. 3. Now lets look at the various elds in the le starting from the rst line. The various elds are : The rst line ocnWaveformTool( awd ) is used to choose the required waveform viewer. Alternatively WaveScan maybe chosen. simulator( spectre ) chooses the simulator. 1

Figure 1: Saving an ocean le

Figure 2: Loading/Running an ocean le

design() points to the netlist of the design. resultsDir and modelFile specify the results directory and the corner le to be used respectively. save and plot are used to save and plot the signals of interest. corners and temper arrays store the corners and the temperatures at which simulations are required to be run at. analysis lets the user to set the start and stop times, step size and accuracy of the simulation. desVar() lets the user to set all the design variables just like in the GUI. Now that all the we know the functions for the basic settings, its time to use them in the various SKILL language constructs below to iteratively perform some tasks. SKILL supports the usual for,if and while loops like LISP and C. Consider the following example :i = 1 2

Figure 3: Sample Ocean File

foreach(corner corners

-> Looping structure

printf("Iteration no. %s \n",corner) -> Simple print command for debug resultsDir(strcat(defaultDir "/" corner)) ->Setting up the result Dir modelFile( list("/home/ameya/stm130/setupfile_typ_fast_slow.scs" sprintf( nil "%s" corner ) )) analysis(tran ?stop "2m" ?errpreset "moderate" )

desVar( "fsample" 12K ) desVar( "vsupply" 1.2 ) desVar( "trise" 150p ) option( temp nthelem(i temper) ) -> Accessing the ith element in temper temp( nthelem(i temper) ) run() i = i+1 ) This code snippet completed multiple simulations for us and stored the results in separate folders with appropriate names. Next, the stored results need to be accessed and some post-processing is required on there results. Lastly, some calculations like say for e.g. slopes, currents have to be stored in a spreadsheet friendly format.Now consider the code snippet below:;Post processing by dumping results ;to a file directly fp = outfile( "/home/ameya/oceanresult.csv" "w"); fprintf(fp "Skew\tTemp\tIavg\n") i = 1; foreach(corner corners openResults(strcat(defaultDir "/" corner "/psf" )) selectResult( tran ) iavg = average(clip(IT("/idut/vdd") 0.0006 0.0012))*1e9 3 -> Running the sim

fprintf(fp "%s\t%5.2f\t%10.2f\n",corner,nthelem(i temper),iavg) i = i +1 ) close(fp); As can be seen, a for loop is used to iteratively fetch the results using the openResults and selectResults commands. Iavg is calculated using the normal calculator like commands. Finally, a C style le IO structure is used to dump this result into a tab limited le that any spreadsheet program can easily use. While the example above showed a simple transient simluation, the same procedure applies to a DC,AC or a parametric simulation as well. The output results looks as in Fig, 4.

Figure 4: Results saved on to a le

From the examples above, it can be seen that the SKILL follows many of the basic principles of C. Complex data structures like linked lists and user dened data types can be easily handled.There is an initial learning curve involved but in the long run eciency and productivity can be heavily improved.[1] is the ocial SKILL reference guide from Cadence and provides comprehensive information about this.

3

Advanced Uses of SKILL and Useful functions

This section talks about some of the advanced features of SKILL and lists some often used functions. Some of the common used functions are: printf() and fprintf() : As the name suggests, this is used to print outputs on the CIW window or writing to a le. nthelem(i listname) or nth(i listname) : Returns the ith element of a list called listname. strcat() : Concatenates dierent Strings. Very useful when writing and accessing simulations results from/to a path. getData(): Used to access any of the saved signals from a results database thats been opened using the resultsDir() command. setShellEnvVar(): Used to set the any of the environment variables from withing the script say e.g. the parent working directory. sort(): Used to sort any list. As can be seen, SKILL has some basic MATLAB like functions already built into it for easy data manipulation. 4

procedure(): This can be used to write user dened functions. The code snippet below shows the syntax for writing a very basic procedure. procedure( myadd( a b ) printf( " %d PLUS %d is equal to %d \n" a b a+b ) a+b ) => myadd Once the user starts feeling more comfortable with SKILL as a result of running simulations through OCEAN, SKILL can also be utilized to increase the general productivity of the user. Some of the examples of this are: Creating ones own bindkeys and default settings. Typically, the default settings are not what ones wants. For creating templates to be used in layout. For ex:- Automatic placement of decaps in the available area and creating templates for a power grid. Creating forms in order to add your own options for the dierent windows.

4

Final Comments

The aim of the document is to remove the basic fear of scripting in SKILL and to introduce to the user, the vast possibilities of automation that OCEAN/SKILL can provide. The author hopes that the user will now be encouraged to try out some basic simulation on his/her own and explore this further. The SKILL reference guide, as mentioned above is an excellent starting point and a comprehensive guide for those wishing to dig deeper.

5

References

1. SKILL Language User Guide, http://www.cadence.com

5


Recommended