HSPICE Tutorial
Introduction
HSPICE is Synopsys' version of SPICE, the
industry-standard circuit simulator. In this tutorial, you will
follow the steps to simulate a CMOS inverter using the AMI 0.5
micron process design rules, and then try simulating a NAND gate
on your own. Please refer to the online HSPICE and AvanWaves
documentation
for clarification as needed.
Setting Up Your Environment
- Create a directory for running the tutorial.
- Save a copy of the model file ami05.md in your tutorial directory
- At the unix prompt, type
source
/usr/local/src/hspice/v2001.4/2001.4/bin/cshrc.meta
You should put this statement into your .cshrc
file so that you don't need enter it for each hspice session.
Running a
Transient Analysis
Editing the Input File
Spice files contain a number of sections:
- title line
- the first line of the file is always
interpreted as the title
- comments
- lines that begin with * or $
- netlist declaration
- a list of the devices in the circuit, with
each device specifying node connections at terminals
- subcircuit definitions
- a mechanism for expressing hierarchy in
the circuit; we won't use it here
- device model definitions
- we'll use AMI 0.5 micron models obtained
from MOSIS
- stimuli
- voltage and current sources and associated
waveforms
- pulses, piecewise linear waveforms,
sinusoids
- simulation control commands
- what kind of simulation: DC, transient, AC
- simulation output format commands
- which node voltages or branch currents to
print, and in what format
Using your favorite text editor, type in
the following lines and save the file in your hspice_tut
directory as inv_transient.sp
A copy of the file can also be found here.
Note: hspice seems to require that there
are no leading blank spaces on each line of the input file. Beware
of this if you cut-and-paste!
Inverter
Transient Analysis (this is the title line)
* enable
post-processing by AvanWaves
.options
post
* device
model file
.include
ami05.md
* transient
analysis: step size = 50 psec, duration = 2 nsec
.tran 50p 2n
* specify
nodes to print (hspice will print them all, anyway)
.print tran
v(in) v(out)
* here's
the inverter netlist declaration
* mosfet:
mxx drain gate source substrate model length width
m1 OUT IN
VDD VDD CMOSP l=.5u w=2u
m2 OUT IN
GND GND CMOSN l=.5u w=2u
* here's
the load capacitor on the inverter output
*
capacitor: cxx node1 node2 capacitance
cload OUT
GND 100f
* constant
voltage source: vxx node1 node2 voltage
VDD VDD GND
5
* pulsed
voltage source:
* vxx node1
node2 PULSE params
* params =
vlow vhigh delay rise fall pulse_width period
VIN IN GND
PULSE 0 5 .5n .1n .1n .5n 2n
.end
Running HSPICE
- At the unix prompt, type: hspice
inv_transient.sp
Viewing Results of Transient Analysis in
AvanWaves
- At the unix prompt, type: awaves
- Open the design from the main menu with Design
> Open > inv_transient.sp
- The Results Browser should pop-up. In the
Results Browser
- select Transient: Inverter Tutorial
- select Types: Voltages
- double-click Curves: in. The input
waveform should appear
- double-click Curves: out. The output
waveform should appear
- Measure propagation delay for a high-to-low
output transition. This is defined as the time between the point where
the rising input waveform is at its 50% level (2.5 volts) and the point
where the falling output reaches its 50% level.
- Measure > Label Options , , ,
- select X1, Y1, Current X, Current Y,
Delta X, Delta Y
- Zoom into area of interest using Window
> Zoom In X
- Measure using Measure > PointToPoint
- Next, we'll make a change to the design and
observe the effect. Back in the text editor, change the load
capacitance to 200f and save.
- Re-run hspice as above
- Update the plot with Panels > Update
Generating a
Voltage Transfer Characteristic (Vout vs. Vin Plot)
To obtain a
voltage transfer characteristic for a circuit, we run a DC parameter
sweep in HSPICE. This is done with a command of the form:
.DC
<voltage source> <start voltage> <end voltage>
<increment>
The file inv_vtc.sp
contains an example and is also listed below. Run HSPICE on this
file as above.
Inverter Voltage
Transfer Characteristic
* enable post-processing by AvanWaves
.options post
* device
model file
.include
ami05.md
* here's the
inverter netlist declaration
* mosfet: mxx
drain gate source substrate model length width
m1 OUT IN VDD
VDD CMOSP l=.5u w=2u
m2 OUT IN GND
GND CMOSN l=.5u w=2u
* constant
voltage source: vxx node1 node2 voltage
VDD VDD GND 5
* Define a
voltage source connected to Vin and initialize voltage to 0
Vin IN Gnd 0
* Sweep Vin
from 0 to 5 volts in increments of .1 volt
.DC Vin 0 5 .1
* Print the
voltage at OUT
.print dc
v(OUT)
.end
Viewing
Voltage Transfer Characteristic in AvanWaves
- run awaves
- Open the design from the main menu with Design
> Open > inv_vtc.sp. This will open the results browser.
- Apply the input voltage to the X-Axis with the
following steps:
- single click Types:Voltages
- single click Curves:in
- single
click Current X-Axis:Apply
- Apply the
output voltage to the Y-Axis
Generating
MOSFET IV Characteristics
To get IV
characteristics for a MOSFET, we need to run a nested DC voltage sweep,
that varies the drain voltage in the inner loop and the gate voltage in
the outer loop. The HSPICE input file nmos_iv.sp provides an example
of generating IV characteristics for an NMOS device. The
file is also listed below:
NMOS IV
Characteristics
.options post
.include ami05.md
* There's only a
single MOSFET in the netlist
m1 drain gate Gnd
Gnd CMOSN l=0.5u w=2u
* Voltage sources
on the gate and drain initially set to 0
Vgate gate Gnd 0
Vdrain drain Gnd 0
* perform a nested
voltage sweep
* inner sweep:
Vdrain from 0 to 5 by .1
* outer sweep:
Vgate from 0 to 5 by 1
.DC Vdrain 0 5 .1
Vgate 0 5 1
* printing MOS
currents: I1-drain, I2-gate, I3-source
.print dc I1(m1)
.end
Viewing IV
Characteristics in AvanWaves
- run awaves
- Open the design from the main menu with Design
> Open > nmos_ivt.sp. This will open the results browser.
- Apply the drain voltage to the X-Axis with the
following steps:
- single click Types:Voltages
- single click Curves:drain
- single
click Current X-Axis:Apply
- <><>Apply
the m1 drain current to the Y-Axis>>
- single click Types:Current 1
- double click i1(m1)