January 29, 1998
Displaying HSPICE Output .....................................................................................6
Output Printing.........................................................................................................6
HSPICE User’s Manual and MetaWaves Help and Manual ....................................7
HSPICE COMMANDS ...................................................................................................7
INPUT WAVEFORMS ....................................................................................................9
OUTPUT VARIABLES .................................................................................................10
EXPRESSIONS .............................................................................................................10
SPECIFIC ANALYSES AND OUTPUT.......................................................................12
I-V Curves ..............................................................................................................12
Family of I-V Curves .............................................................................................14
I-V Curve for Parameter Extraction .......................................................................15
Voltage Transfer Characteristic (VTC) ..................................................................17
Transient (Delay) Analysis.....................................................................................17
CONVERGENCE PROBLEMS....................................................................................19
DC Analysis ...........................................................................................................19
Transient Analysis ..................................................................................................19
Diode Convergence ................................................................................................19
DIGITAL CIRCUIT
SIMULATION USING
HSPICE
Charles R. Kime
Dept. of Electrical and Computer Engineering
University of Wisconsin – Madison
TABLE OF CONTENTS
GETTING STARTED WITH HSPICE............................................................................2
The HSPICE Netlist File..........................................................................................2
An Example HSPICE File........................................................................................3
Executing HSPICE...................................................................................................4
1
EXECUTING HSPICE FROM THE COMMAND LINE.............................................19
GETTING STARTED WITH HSPICE
REFERENCES...............................................................................................................19
FEEDBACK ...................................................................................................................20
GETTING STARTED WITH HSPICE
Avant!’s HSPICE (more recently Star-HSPICE) is available on the HP Unix worksta-
tions at CAE. HSPICE executes in batch mode using the Unix command line or a graph-
ical user interface called MetaWaves (more recently AvanWaves). Here we will
emphasize the use of MetaWaves on HP Unix workstations, with a brief section at the
end on use of command line execution of HSPICE.
HSPICE uses a netlist file design.sp, where design is the name of your circuit, as
a source file. This text file contains the circuit netlist, element models, analysis com-
mands and output commands. Execution of HSPICE produces a number of files depend-
ing on user-specified options. By use of the appropriate options, files are produced
which act as the input files for MetaWaves for displaying, analyzing, and printing results
from HSPICE.
In addition, text files for reading and printing and graphic files for direct printing from
HSPICE can be produced.
The HSPICE Netlist File Although some versions of SPICE required the use of upper case letters, you may also
use lower case letters with this version. Further, this version is not case sensitive, so Vin
and vin are recognized as the same variable! Lines containing comments begin with *.
Comments within other lines begin with one or more spaces followed by $. To continue
a statement on multiple lines, each line after the first must have a + in the first column,
or each line of the statement except for the last line must end with \ or \\. \\ removes all
spaces. For example,
ABC \
DEF
gives ABC DEF. But,
ABC \\
DEF
gives ABCDEF.
An Example HSPICE File An NMOS depletion-mode load inverter illustrates the components of a typical digital
circuit HSPICE file. The numbers appearing on the right of the file are
not part of the
file but appear only for reference.
NMOS Depletion-Mode Inverter (file: nmos_inv.sp) 1
*Last revised 1/11/97 2
*Power Supplies 3
Vdd 1 0 DC +5V 4
2 DIGITAL CIRCUIT SIMULATION USING HSPICE
GETTING STARTED WITH HSPICE
Vbb 2 0 DC -2V 5
*Input Signal 6
*Vin 3 0 PWL 0ns 0V 0.4ns 5V 14.6ns 5V 0.4ns 0V 7
Vin 3 0 PULSE (0 5 0n 0.4n 0.4n 14.6n 30n) 8
*Inverter Circuit 9
M1 4 3 0 2 NENH L=2u W=4u AD=32p 10
M2 1 4 4 2 NDEP L=4u W=2u AS=32p 11
Cout 4 0 0.1pf 12
*Vout 4 0 13
*Include statement to obtain MOS model file 14
.INCLUDE "full_path_to_spice_model/nmos.3" 15
* 16
*For Voltage Transfer Characteristic (VTC) 17
.DC Vin 0 5 0.1 18
.PROBE DC V(4) 19
*For propagation delay and power 20
.TRAN 0.1ns 60ns 21
*For propagation delay 22
.PROBE TRAN V(3) V(4) 23
*For average power over one full Vin cycle 24
.MEAS TRAN avgpow AVG POWER FROM=30n TO=60n 25
.OPTIONS PROBE POST MEASOUT 26
.END 27
The first line of the SPICE file contains the name of the circuit. This line must always be
present. As in the second line, all lines beginning with an asterisk (*) are comments and
are optional. This file is more heavily commented than usual.
Lines 4 and 5 specify power supplies which are independent voltage sources. A voltage
source identifier always begins with V or v. In order to interconnect components, nodes
represented by integers are used. For example, Vdd is connected with its + terminal on
node 1 and its – terminal on node 0. Note that 0 is always used as the ground node. Vdd
is identified as a DC source with value +5V. The + and V are optional. This circuit is
somewhat unusual in that it has a substrate bias voltage Vbb ≠ 0 to give different cir-
cuit characteristics.
Vin in lines 7 and 8 is the input voltage to the circuit for transient analyses. Two alter-
native specifications, PWL (Piece-Wise Linear) and PULSE are given. The PWL speci-
fication begins with *; it is commented out and thus is not used although these two
specifications are identical for the first 30 ns. PULSE is useful for simple periodic wave-
forms such as clocks and PWL is useful for non-periodic waveforms. See the on-line
SPICE manual for the format of these waveform specifications.
Lines 10 and 11 describe the two MOSFETs in the inverter. The use of M# as the identi-
fier designates a MOSFET. The order of the nodes is drain(D), gate(G), source(S) and
substrate(B). For example, node 4 is connected to the drain of M1 and to the gate and
source of M2. Next, NENH and NDEP give the name of the model for each of the transis-
tors. The length L and width W of the channel of each device is given. The abbreviation
u designates “micro” which, for length in the MKS system, gives microns, µ. In addi-
tion, for transient analysis, the areas of the drain of M1 and the source of M2 are given.
The abbreviation p designates "pico" which is µ2. Line 12 specifies a capacitive load on
the inverter output of 0.1 pf. Line 15 includes the file nmos.3 containing the models
DIGITAL CIRCUIT SIMULATION USING HSPICE 3
GETTING STARTED WITH HSPICE
for the MOS transistors in this file. "full_path_to_spice_model" is the abso-
lute Unix path to the location where you place a copy of the spice model nmos.3. Note
that ~your_name as a part of this path will not work. The contents of this file appear
later in this section.
The remaining lines specify analyses and outputs. Line 18 performs a DC analysis that
produces the voltage transfer characteristic for the circuit. The voltage Vin sweeps from
0 volts to 5 volts in 0.1 volt increments. Line 19 along with the word PROBE on line 26
specifies the output to be V(4). Line 21 performs a transient analysis that will permit the
propagate delays, rise and fall times, and average power to be measured. This command
begins with .TRAN and specifies an output every 0.1 ns for 60 ns. Line 23 along with
the word PROBE in line 26 specifies that the only outputs are to be the voltages on nodes
3 and 4 which correspond to the input and output of the inverter. Otherwise, HSPICE
outputs all voltages plus the power supply currents.
Line 25 uses .MEAS (which is the same as .MEASURE) to find a scalar value for the
average power over a single full period of the Vin waveform. The key word POWER
causes the instantaneous power dissipated by the circuit as a function of time to be cal-
culated. The measurement function AVG (average) then takes the average of POWER
over the time interval specified by FROM and TO and assigns the value to the output vari-
able avgpow.
In general, PROBE in a .OPTIONS statement as on line 26 restricts the outputs to those
specified in .PROBE, .PRINT, .PLOT and .GRAPH statements. POST in .OPTIONS
causes the output files to be prepared for MetaWaves. Finally, .END designates the end
of the SPICE file.
The model file nmos.3 follows.
*Model for Enhancement-Mode MOSFET 1
.MODEL NENH NMOS LEVEL=3 RSH=0 TOX=300E-10 LD=0.21E-6 2
+ XJ=0.3E-6 VMAX=15E4 ETA=0.18 GAMMA=0.4 KAPPA=0.5 3
+ NSUB=35E14 UO=700 THETA=0.095 VTO=0.781 CGSO=2.8E-10 4
+ CGDO=2.8E-10 CJ=5.75E-5 CJSW=2.48E-10 PB=0.7 MJ=0.5 5
+ MJSW=0.3 NFS=1E10 6
*Model for Depletion-Mode MOSFET 7
.MODEL NDEP NMOS LEVEL=3 RSH=0 TOX=300E-10 LD=0.21E-6 8
+ XJ=0.3E-6 VMAX=15E4 ETA=0.18 GAMMA=0.4 KAPPA=0.5 9
+ NSUB=35E14 UO=700 THETA=0.035 VTO=-2.231 CGSO=2.8E-10 10
+ CGDO=2.8E-10 CJ=5.75E-5 CJSW=2.48E-10 PB=0.7 MJ=0.5 11
+ MJSW=0.3 NFS=1E10 12
Lines 2 through 6 and 8 through 12 describe the models for the enhancement-mode and
depletion-mode transistors, respectively. Each model begins with .MODEL followed by
the name of the model, the transistor type, and the HSPICE model parameters for a
Level 3 model. Note the + at the beginning of each subsequent line of the model param-
eter list. The + designates the continuation of a line. Thus, in HSPICE, each model is a
single statement.
Executing HSPICE HPSPICE places almost all of the output files from a run in the run directory, i.e., the
directory from which it is executed. So you should change to the directory in which you
4 DIGITAL CIRCUIT SIMULATION USING HSPICE
GETTING STARTED WITH HSPICE
would like the result files to appear before executing Metawaves or HSPICE. If you are
analyzing a new circuit design, use your favorite editor to enter the initial version of
design.sp. Then start MetaWaves by entering:
mwaves
To open a design, click Design:Open. In the Open text area, enter the design file path
name if necessary. Then select design.sp and click OK. If you have not run HSPICE
on design.sp, you will get a message indicating that you should use Run HSPICE.
Next, click Tools:Run HSPICE. The first time you use the Run Manager, click on
Preferences and select the editor you wish to use. Depending on the editor you use, you
may also need to specify xterm in the Xterm command. Ordinarily, Machine and
Version will be left blank. Click on OK to return to the Run Manager.
Select the source file you wish to run on the Design list and click on Run. If you wish to
interrupt the run, click on Stop. To restart the run, click on Run. The Status area will
give the status of the run. Warning:: If design.lis already exists, then the run will end
with an Error in the Status area and will not write any output files. You must remove the
design.lis file after each run. In a separate Xterm window, enter rm
design.lis and then, before each run on design.sp, enter !r to remove the
design.lis file. When the run completes, you can examine design.lis by click-
ing on Listing. This file provides a lot of useful information about the parameter values
for the run and also indicates errors. Finally, to modify the source file design.sp with
your editor, click on Source.
The HSPICE run will place the various results in files named design.* where * rep-
resents the file extensions given in Table 1. The *.lis file will appear in
design.ext. # in Table 1 is a sweep number or hardcopy file number.
Displaying HSPICE Output MetaWaves is used to provide a high-resolution interactive display of HSPICE outputs.
It is most easily executed from the directory containing the relevant HSPICE output
files. If you are not already in MetaWaves, enter mwaves. You can access the various
result files by clicking on Design: Open. Warning: Each time you run HSPICE, you
must click Panel:Update to display the new results! The Results Browser window con-
tains various output files for your circuit. Clicking on a particular file in the listing and
variable type in the Types area causes the corresponding variable names to appear in the
Curves area. To display a particular curve, select it with the left mouse button and drag
it with the middle mouse button to the Panel in the Results Display window. Repeat the
select and drag for each curve you wish to display.
If there are curves from a number of sweeps for a given result variable, it is possible to
highlight specific sweeps by double clicking on the waveform name in the Wave List.
This will cause the names of the individual sweeps to appear. Double clicking on a spe-
cific sweep name will highlight that sweep. If you want to display only selected sweeps,
you can click using the right button in the waveform display area to obtain the context-
sensitive menu. Click on Sweep Filter and click or drag on those sweeps you want to
display. Then click on OK or Apply. These features are illustrated in the MetaWaves
tutorial.
DIGITAL CIRCUIT SIMULATION USING HSPICE 5
GETTING STARTED WITH HSPICE
Zooming on the waveform display area can be achieved in three different ways: 1) by
clicking on Zoom in the context-sensitive menu, 2)by clicking on the shortcuts menu
bar or 3) by clicking on Window: Zoom.
Various measurements can be made on or between waveforms by clicking on Measure.
For example, suppose you want to measure the propagation delay tPHL for an inverter
with input voltage V(3) and output voltage V(4) where the 50% voltage value on the
waveforms is at 2.5 V. First, it is necessary to make sure that the right data appears in the
resulting measurement label. To set up the data that appears, click on Measure:Label
Options. Then select only the option Delta X and deselect all others since the X axis of
the display is Time. Then click on OK. Next, select the two waveforms V(3) and V(4) in
Wave List. To automate the measurement at the 2.5 V level, click on Measure:Mea-
sure Preferences and select Lock Horizontal at Y Value and enter 2.5. Then click on
Apply. To actually perform the measurement, click on the PointtoPoint shortcut or on
Measure:PointtoPoint. Then use the left button to select V(3) and drag to V(4). The
measurement points will automatically appear at 2.5 V on V(3) and V(4) and a label
appears containing Delta X, the propagation delay value.
Output Printing Plain ASCII outputs such as design.lis can be printed using the normal print com-
mands. We advise you to edit out irrelevant text first.
To print from MetaWaves, click on the print
icon in the Shortcut menu and make the
appropriate selections in the Print menus. You can print to a printer or send postscript to
a file. Warning: Use only Portrait, not Landscape, to print to a file. Otherwise, the result
will be too wide to be viewed or printed.
TABLE 1.
File Extensions
These files appear unconditionally:
.lis
or user-specified .ext Output listing including print and ASCII plot outputs
.st# Output status
This file appears if there are subcircuits in the circuit:
.pa# Subcircuit cross-listing (if there are subcircuits)
These files appear in response to corresponding .MEASURE statements in design.sp:
.mt# Transient analysis measurement results
.ms# DC analysis measurement results
.ma# AC analysis measurement results
These files appear in response to .OPTIONS POST and corresponding analyses in design.sp:
.tr# Transient analysis results for MetaWaves
.sw# DC analysis results for MetaWaves
.ac# AC analysis results for MetaWaves
This file appears in response to a .SAVE in design.sp:
.ic Operating point node voltages (initial conditions)
6 DIGITAL CIRCUIT SIMULATION USING HSPICE
HSPICE COMMANDS
To print plots from HSPICE directly, you must use the .GRAPH command. See the on-
line manual for details.
HSPICE User’s Manual and
MetaWaves Help and Manual
HSPICE is a very complex and sophisticated circuit analysis tool. As a consequence, we
have only touched upon a very small portion of its features here. A three-volume
HSPICE User’s Manual is available on-line for your use. A Framemaker version is
available in:
/afs/engr.wisc.edu/apps/hspice/97/docs/hspice/Publish
The various table of contents, indexes and chapters can be viewed with Frameviewer by
entering viewer. The table of contents (TOC) and indexes (IX) are hypertext, so you
can click on entries to go to the content location. Also, Frameviewer has a Find com-
mand which allows you to search for keywords. Alternatively, a postscript version is in
Postscript instead of Publish.
MetaWaves provides an on-line help capability. There is also a manual available in post-
script form:
/afs/engr.wisc.edu/apps/hspice/97/docs/rel_notes/AvanWavesUG.97.2.ps
In case of persistent problems, you might want to see if you have encountered a known
bug by consulting the release notes in:
/afs/engr.wisc.edu/apps/hspice/97/docs/rel_notes/1997.2.Hspice_rn.ps
HSPICE COMMANDS
In this section, we briefly describe some of the HSPICE commands. The commands
may be written using either upper or lower case.
.ALTER .ALTER allows statements in the file to be replaced and a new run to be performed with
the new statements. See the manual for more details.
.DATA .DATA allows repeated runs to be performed with the variable values given in a data
table. See the manual for more details.
.DC .DC performs a DC analysis. For example .DC Vin 0 5 0.1 performs a DC analy-
sis using a sweep of Vin from 0 V to 5 V in 0.1 V increments.
.END .END is required at the end of an HSPICE netlist file.
.GLOBAL .GLOBAL declares a variable to be the same whether in the main circuit or any subcir-
cuit. For example, .GLOBAL Vdd will cause all nodes throughout the netlist file labeled
Vdd to be connected together. This avoids extra nodes in defining subcircuits.
DIGITAL CIRCUIT SIMULATION USING HSPICE 7
HSPICE COMMANDS
.GRAPH .GRAPH can be used to plot output directly from HSPICE. Plots from all .GRAPH
statements in a design.sp file appear in a single postscript file. Note that .GRAPH is
capable of handling a sweep of only one variable. If a second variable is swept, each of
its values produces a separate plot. The outputs of .GRAPH are design.gr#, where #
is an integer.
.IC .IC is useful for setting initial conditions for transient solutions. This is essential in
whenever the circuit stores information, such as in latches, flip-flops or on dynamic
storage nodes. For example, .IC V(1)=5 V(2)=0 initializes node 1 to 5 V and node
2 to 0V. To use for initialization of a transient solution, include UIC in the .TRAN state-
ment. A similar command useful for DC solutions is .NODESET.
.INCLUDE Used to include text from one file in another at run time. For example,
.INCLUDE ’/pong/usr5/k/kime/public_html/555/spice_models/scn06hp.L3’
is used to include the text in the file scn06hp.L3 for