Getting Started With Hspice - A Tutorial
Getting Started With Hspice - A Tutorial
Getting Started With Hspice - A Tutorial
GETTING STARTED
WITH HSPICE – A
TUTORIAL
Charles R. Kime
Dept. of Electrical and Computer Engineering
University of Wisconsin – Madison
INTRODUCTION
A SPICE (HSPICE) simulation has three primary steps:
1) Generating the circuit netlist file,
2) Running the simulation, and
3) Displaying, analyzing, and printing the simulation results.
In this tutorial, we will carry out these three steps for an implementation of an Exclusive
OR gate made up of four NAND gates. Since this is a digital circuit, digital electronic
circuit simulation techniques are used rather then analog techniques used in other elec-
tronics courses. Some differences are:
1) Input waveforms: DC, PWL (Piece-Wise Linear) PULSE versus
AC, DC, SIN, EXP.
2) Analysis: DC and TRAN vs. OP, AC, FOUR, NOISE,
SENS, etc.
3) Circuit Elements: V, F(I-controlled I source), C, R,
M(MOSFET), Q(BJT), T(Lossless line), U(Uniform RC line).
The EXOR gate will be hierarchical – made of 4 NAND gates – as shown in Figure 1a).
The logic and circuit design has been completed. In addition, we have enough of a lay-
out to estimate the areas and perimeter of the sources and drains and the capacitive load-
ing on the circuit within an IC.
1
DEVICE MODEL FILES
FILE GENERATION
The netlist file is made up of statements. A SPICE file is case-insensitive except for file
names exported to UNIX as in a .include or .lib statement. * in the left column
designates a comment.
Netlist Structure:
Title (Required)
Circuit
Subcircuit(s)
Device Models
Analysis
Output
.end (Required)
File Entry for the Example 1. Make a directory for the files for this tutorial.
2. Edit the netlist file design.sp.
3. Enter title.
4. Enter the Exclusive OR circuit made up of NAND subcircuits. Assume that the
statement for the NAND subcircuit is:
Xi top_in bot_in out NAND
The component labels and input and output nodes to appear in the above statement for
each gate can be obtained from Figure 1a). Example statement:
X1 101 102 103 NAND
Note that GND is always node 0 and that we will reserve node 1 for VDD.
5. Enter the subcircuit for the NAND gate.
a. Declare the subcircuit by entering:
.SUBCKT NAND top_in bot_in out
4
out
top_in
X
M3
2
bot_in M4
Y
0
+ 101
EXOR
106
VA + 102
– C1 = 0.01pf
VB
0 – 0 0 0
find the two points at which the value is +1 and measure the input voltage at those
points.
Click on Tools:Expressions. In the Expression Builder window, select derivative(_) in
the Functions area and, using the middle mouse button, drag it to the Expression: area
at the top of the window. Next select v(106) in the Results Browser window and drag it
to the point between the parentheses in the Expression: area. Enter the variable name
slope in the Result: area and click on Apply. slope will now appear in the fdarea.
Select it, and using the middle mouse button, drag it to the panel.
Note the scale on the right. Since it ranges from 0 to around 120, it will be very difficult
to find the +1 value. To zoom in on the +1 level on the derivative curve, click on the Y +
zoom in shortcut and draw a short line with the cursor between roughly 4 and 0. Repeat
Y +, drawing a line between 2 and 0.
Next, click on Measure:Measure Label Options, select Current X and enter VIL in
the text area next to it and click OK. Then click on the Point shortcut and place the cur-
sor on the left +1 slope point and click. The value of VIL for the noise margin calcula-
tion will appear. Repeat, entering VIH and using the right +1 slope point. By careful use
of such features, you can very neatly annotate your plots and printouts.
To examine printing options, click on Tools:Print. Note the various options. Click on
File to see the options for printing to a file. Warning: Do not select Landscape when
printing to a file; you will be unhappy with the results.
To return to a full view of the VTC, click on Window:Full.
Next we want to look at the transient analysis results. Click on the V(106) entry in Wave
List and then on Panels:Delete Curves to remove the VTC from the Results Panel.
In the Results Browser, select the transient analysis. Select Voltages in Types, and
select and drag to the Results Panel the voltages V(101), V(102), and V(106). In the
Wave List, click on V(106) to highlight it. Drag across all three voltages to highlight all.
Then click on V(106) again. To highlight only V(101) in addition to V(106), hold down
Control and then click on V(101).
With V(101) and V(106) highlighted, we want to evaluate some delays. Click on Mea-
sure: Measure Label Options and select Delta X, deselecting all others. Click on OK.
To set the voltage level at which to measure the delay, click on Measure:Measure Pref-
erences. Select Lock Horizontal at Y and enter 1.65 which is 50% of 3.3. Click on OK.
Click on the PointtoPoint shortcut, place the marker on V(101) and drag to V(106). The
value displayed is the rising or falling propagate delay from input A to the Output with
B at its value at the time of the measurement. Next, try to measure the risetime for
V(106).
Suppose that you want to display V(101), V(102), and V(106) so that they are more
readable for functional verification. We will use Expressions to do this. To separate the
waveforms, we will add 12 to V(101), 8 to V(102), and 4 to V(106). To add 12 to
V(101), click on the Expressions shortcut. Drag V(101) from the Curves area to the
Expression area, type + followed by 12. Enter A in the Result area and click on Apply.
Perform similar operations for V(102) and V(106), naming the results B and OUT,
respectively. Then drag A, B, and OUT to the Result Panel for display.
For the final measurement, use Add Panel on the Panel List to add a second panel. In
the Results Browser, click on Measures in Types. Drag avg_pow to the new panel. The
average power has no curve, but the value is that listed closest to the center of the verti-
cal axis. Do not attempt to place a second scalar measure on a panel; to see what hap-
pens, drag temper to the panel. Is 25 degrees at the center of the panel?
To exit MetaWaves, enter Design:Exit. Save the configuration if you want to archive
information generated during the session such as expressions, macros and waveforms
derived from the basic waveform data. These can be used in a later session for the same
design by opening the same configuration.
For more information on HSPICE, enter the following:
cd /afs/engr.wisc.edu/apps/hspice/97/docs/hspice/Publish
viewer
or
cd /afs/engr.wisc.edu/apps/hspice/97/docs/hspice/Postscript
ghostview
For more information on MetaWaves(AvanWaves), see the on-line help or use ghost-
view on the following:
/afs/engr.wisc.edu/apps/hspice/97/docs/rel_notes/AvanWavesUG.97.2.ps