Simulation Tutorial

From Vlsiwiki
Revision as of 21:59, 13 October 2008 by Mrg (Talk | contribs) (Setting Up Manual Stimulus)

Jump to: navigation, search

Select Analog Environment

With the schematic file open, Ultrasim can be invoked from within Virtuoso.

Select Launch → Simulation → Spectre.

This creates a new menu item called "Spectre" next to "NCSU".

Select Simulator (Spectre)

Virtuoso Analog Design Environment supports various simulators such is hSpice, Spectre, and Ultrasim. Spectre was previously chosen. Now, run

Select Spectre → Initialize.

A follow up window will pop up giving your simulator options. Press ok.

Ultrasim setup3.jpg


Simulation Run Directory indicates where your simulation files will be stored. The generated netlist file will be stored within in a file called "netlist". All of the other options are stored in this directory as well in separate files. When you run the simulation, all the options are put together in a single file called si.inp

Setting Up Manual Stimulus

If you did not add voltage sources to drive the inputs and outputs, you can edit a stimulus file directly by choosing: Ultrasim → Stimulus → Edit Stimulus File This will open a file in vi where you can add something like this:

// Spectre Source Statements
vdd (vdd! 0) vsource dc=1.8
gnd (gnd! 0) vsource dc=0
vin (A 0) vsource type=pulse val0=0 val1=1 period=100n delay=10n rise=0.1n fall=0.1n width=50n


To save in vi, press escape and then type ":wq". These options are saved in a file in your simulation directory called spectre.inp. For more information on Spectre commands you can look at the Spectre manual:

/mada/software/cadence/MMSIM61/doc/spectreuser/spectreuser.pdf

Choosing Analysis Type and Length

From the Analog Environment window

Select Spectre → Stimulus → Edit Analysis/Options File

This will bring up a smaller window where you should uncomment the line shown here and change it with an appropriate simulation length:

// Analyses
// dc1 dc oppoint=logfile homotopy=all
tran1 tran stop=300n errpreset=moderate

These options are saved in a file in your simulation directory called spectre.sim.


Be sure to choose a stop time that is greater than the period of the input signal. Spectre supports the SI prefixes so 500u would be 500 micro seconds.

Adding Model Library Files

The next step is to add the spice data for the simulator.

Select Spectre → Stimulus → Model Include Files .

We will be adding the data for the NMOS and PMOS transistor using the TSMC 180nm process.

Ultrasim setup5.jpg


Click on Add File and add these files:

/mada/software/techfiles/ncsu/models/hspice/public/publicModel/tsmc18dN
/mada/software/techfiles/ncsu/models/hspice/public/publicModel/tsmc18dP

Select OK when finished.

Running Simulation and Ouput Window

Select Spectre → Netlist/Simulate

This will generate the netlist file, run the simulation, and save the results for the waveform viewer.


If this pops up a window that says it failed, fix the previous options. If it succeeded, you can select Spectre → Waveform Tool . When you do this, you get three windows:

Waveform graph.jpg Waveform browser.jpg Waveform results.jpg

Select the appropriate "raw" result file in the browser. When you double click on it, you should see signal names that correspond to your design. Double click on "A" to add it. Double click on "Z" to add it as well. If there are problems with vdd! and gnd! you can debug that here.

You should get something that looks similar to this in the graph window:

Output waveform.jpg

Waveform - Zooming and Trace

With the waveform window open, you can zoom in and find exact values.

Zoom

Select Zoom → X Zoom .
Now click and drag in the waveform window to select the x-range you want to zoom to.

Tracing

Select Marker → Place → Trace Marker

Zoom waveform.jpg

Click on one of the waveforms in the window. This places a small label on the waveform. You can drag this marker anywhere on the waveform.

Power/Energy Analysis

This Section needs to be updated for Spectre...


To enable power analysis in Ultrasim

1) go to Simulation->Options->Analog
2) In the "Advanced Checks" section, check the button near "Power analysis" and click on Setting
3) In the window that opens up
3.1) Enter * for the "subckt name"
3.2) Select max in the "Output Sorting" section
3.3) Click on the power and enabled button
3.4) Click on Add at the top
3.4) Click OK to close the window
4) Click OK to close the "Simulator Options" window
5) Simulate as usual (Simualte->Netlist and Run)
6) Look for a file called "input.pa", most likely under /cse/grads/USERNAME/cadence/simulation/comb_adder/UltraSim/schematic/psf/input.pa
The file will list Max,Avg and RMS power for each pin in your design, and the time in which the maximal power consumption occurred.

Energy is simply the RMS power multiplied by time

Power.jpg

Documentation

Finally, for more help...


Open file:///home/cadence/MMSIM61/doc/UltraSim_User/UltraSim_UserTOC.html in your web browser on firedance.