The HSPICE reference manual is on the tutorials webpage
This manual should not be needed for class assignments, but is
available if you are interested in using advanced HSPICE simulation options.
HSPICE simulations are run by typing hspice inverter.cir >
inverter.out, where inverter.cir is the name of the SPICE stack file and the
output is redirected to a file called inverter.out.
A sample SPICE stack containing the description of a CMOS inverter in a 250nm TSMC process is given below:
CMOS Inverter
.lib 'models25.txt' TT
mn1 VSS IN OUT VSS nmos l=0.24u w=0.72u
mp1 VDD IN OUT VDD pmos l=0.24u w=0.72u
cLoad OUT VSS 50fF
vVDD VDD 0 2.5
vVSS VSS 0 0vIN IN 0 pulse( 0 2.5 100ps 100ps 100ps 2ns 4ns )
.dc vIN start=0 stop=2.5 step=0.01
.tran 1ps 8ns
.option post
.endThe same SPICE stack for a 180nm TSMC CMOS process is given below:
CMOS Inverter
.lib 'models18.txt' MOS
mn1 VSS IN OUT VSS nmos l=0.18u w=0.27u
mp1 VDD IN OUT VDD pmos l=0.18u w=0.36u
cLoad OUT VSS 50fF
vVDD VDD 0 1.8
vVSS VSS 0 0vIN IN 0 pulse( 0 1.8 100ps 100ps 100ps 2ns 4ns )
.dc vIN start=0 stop=1.8 step=0.01
.tran 1ps 8ns
.option post
.endThe first line of the SPICE stack is always a comment line. Therefore any statements on this line will be ignored.
The .include line includes the file models.txt, which is assumed to be in the current directory.
The next two lines are an nmos and a pmos transistor. After the transistor name (which must begin with m), the source, gate, drain, and bulk nodes are given. Next is the model. The length and width are specified. For a 0.25um process, the minimum gate length is 0.24um. For a 0.18um process, the minimum length if 0.18um. Source and drain perimeters and areas can also be specified here.
A capacitor of 50fF from node OUT to node VSS is given on the next line.
The two supply nets are defined next.
A pulse voltage source is defined from 0 to VDD with 100ps delay, 100ps rise time, 100ps fall time, 2n pulse width, and 4ns repetition period.
.tran indicates a transient analysis with a plot interval of 1ps and simulation duration of 8ns
.dc indicates a dc sweep of a certain parameter. Here the input voltage is swept to give a voltage transfer curve (VTC).
.option post instructs HSPICE to write an output file ending in .tr0 containing the simulation waveforms.
.end signifies the end of the SPICE stack.
Several files are created by HSPICE:
inverter.ic: Text file containing the circuit initial conditions
inverter.st0: Text file containing a summary of the simulation
inverter.sw0: Binary file containing dc sweep waveforms (Open this file from cscope to get the VTC)
inverter.tr0: Binary file containing transient analysis waveformsThe waveforms can be viewed using CosmosScope. Type cscope to load the results. The following window will appear.
![]()
Click on File > Open > Plotfiles. Click on inverter.tr0, the file that contains the transient analysis.
The inverter Plot File window will open up.
In the inverter Plot File window, plot v(in) by double clicking v(in), or by selecting v(in) and clicking Graph
![]()
The input waveform to the inverter will open up.
To open v(out) in the same graph as the v(in) signal, select v(out) from the inverter Plot File window, and then double-click in the graph window. You can also do this by selecting v(out), right-clicking in the graph window and selecting Plot
Zoom in to 2u and 4u by moving the cursor to the x-axis, clicking 2u, and dragging it to 4u
Now zoom out by clicking on the magnifying glass with the square inside it.
To create a second panel, just double-click on another signal from the inverter Plot File window.
To do the dc analysis, first use cscope to open the sweep file inverter.sw0. The signal selection window will come out as the same as in the previous transient analysis.
By highlight v(in) and click the button "set", v(in) is set to be the x axis value. Then highlight v(out) and click the button "plot". The DC curve vout-vin will be shown.
Click tools -> measurement tool, by clicking the button besides Measurement, you will see many options. Click General->Slope, select signal to be v(out), click "apply", a measurement tool which indicate the slope will be seen in the dc curve.
Drag the measurement tool to the point where slope is -1, move the mouse onto the measurement tool until its color turns from white to red. Rightclick the tool, and select Add Marker -> Horizontal Level and Vertical Level, you can therefore read the value regarding to noise margin.