PSPICE by MicroSim Corporation. This is available at Aston on IBM PC-compatibles and Apple Macintoshes but both are restricted versions which will only operate on very small circuits. The PC version does not require a maths coprocessor but will use one if it is present. It runs extremely slowly without a coprocessor. The Macintosh version requires a coprocessor or a coprocessor emulator. It runs unbelievably slowly with an emulated coprocessor. These restricted versions of PSPICE are public domain software and you can take copies to run on your own machines if you wish. Refer to the document 'PSPICE User Guide' for more information.
HSPICE by Meta Software. This is available at Aston on the Sun Workstations. This is probably the most powerful version of SPICE available. It is highly optimised and will take advantage of specialised floating point hardware in Sparc1, Sparc2 and Sparc10 processors. It will handle circuits of almost any size (e.g. 250,000 gate simulations at transistor level) and runs very quickly. This document covers the basic information required to prepare a circuit description for HSPICE simulation on a Sun workstation, run the simulation and then examine the results using the graphical analysis program ViewTrace. It assumes you have a working knowledge of the use of Sun SPARC workstations (logging on, file handling, window manipulation using the Open Look Window Manager etc.). An on-line tutorial is provided for using the OpenWindows system on the Suns.
This document is also available in PostScript format on the Aston University WWW server. (URL http://www.eeap.aston.ac.uk/eeap/documents/user-guides.html).
Boldface Exact input or Menu items
Italics Variable user input
Courier File names and file extensions
Underline Used for emphasis only
The symbol n represents the Powerview Red-Square menu.
Sequences of menu choices are shown as a list of items linked by arrows (È). e.g.
Add Graphic È Box.
1. Log on to a workstation with your own user name and password. Allow OpenWindows to start up.
2. In the command tool type powerview & to start the Powerview cockpit running (as a background process).
3. Using the Left mouse button select the Current toolbox menu. From the options choose the toolbox 'Aston Signals and Systems'.
4. Using the Left mouse button select Project È Create.
5. When the dialogue box appears, in the section Project type, select ViewDraw. Then enter a project name of the form ~/project-name, where project-name is your chosen name. Do not omit the tilde (~) character which refers to your home directory
6. Double click Left on the TextEdit icon in the cockpit. When prompted for an HSPICE source file name, Enter example1.hsp . The editor will ask you to confirm that you want to create a new file. Wait for the text editor to start up.
7. Enter the file below:
* RLC Passive Circuit
.OPTIONS CSDF
R1 1 2 20
L1 2 3 1mH
C1 3 0 1uF
VIN 1 0 AC PULSE(0 1 0 0 0 1 5)
.AC DEC 20 10 1MEG
.TRAN 5us 500us
.END
8. Pull down the File menu of the text editor and select Save File.
9. Double-click the left mouse button on the HSPICE icon in the Powerview cockpit. You will be prompted for an HSPICE file name (if you have previously run HSPICE the filename will already be there). Enter the filename example1 and click on 'Accept'.
10. HSPICE will run and you will see a message in the Powerview cockpit log. If you see the message *** HSPICE job concluded then continue to step 12. If you see the message *** HSPICE job aborted then proceed to step 11.
11. In the TextEdit window use File Open to select the file example1.lis . Try and determine why HSPICE failed. If possible, correct example1.hsp with the text editor and repeat step 9.
12. Double-click the left mouse button on the ViewTrace icon in the Powerview cockpit. After a while you will see the ViewTrace File Open dialogue box. Select the 'All' box with the left mouse button. You should see (among others) the files example1.ac0 and example1.tr0. Select example1.ac0 and then click on 'Accept'.
13. A ViewTrace waveform window should appear with two vertical axes - A Voltage axis with three traces V(1), V(2) and V(3), and a Current axis with a single trace I(Vin).
14. Select File È Open from the ViewTrace menu bar. From the File Open dialogue box select example1.tr0 . When the waveform window opens you will see the transient response with the same voltage and current axes as the AC response.
15. Click the red square menu and quit each Powerview program in turn.
16. Now read the rest of this guide.
Start Powerview (as a background process) by entering the command:
powerview &.
You will then see the Powerview Cockpit.
Create a new project (or set your current project to an existing project) by pulling down the Project menu and select Project È Create or Project È Set Current. When you next run Powerview your previous project setting will be remembered.
Select the Current Toolbox to Aston Signals and Systems. The Powerview cockpit should then appear as in Fig. 3.1.
Fig 3.1. Aston Signals and Systems Toolbox
The Signals and Systems toolbox has just one drawer called Signals and Systems Design which holds three tools: TextEdit, HSPICE and ViewTrace. To launch a tool just double-click on the appropriate icon. You can leave both the editor and ViewTrace running and open different HSPICE source files and data files respectively from within them. You will need to re-launch the HSPICE simulator each time you use it.
The design flow is shown in Fig. 3.2. The programs are represented by rectangles. Circles represent files. The text inside the circles shows the appropriate file extension. Use the file extension .hsp for source files. All other file extensions are automatically generated.
Fig. 3.2. HSPICE Program and data flow
When you launch HSPICE you will see a prompt (see Fig. 3.3) for an HSPICE source file. Enter just the first part of the filename. Do not give a file extension such as .hsp.
Fig. 3.3. HSPICE source file prompt.
When HSPICE runs you will see a status message in the Powerview Cockpit log window. HSPICE should exit with a status code of zero. If this is not so then you will need to check the log file (.lis) to determine the cause.
When the simulation has finished you should always check the .lis file for errors (using the editor) before attempting any graphical analysis of the results. In addition the results of some analysis tools are reported in this file.
design-name.hsp (HSPICE source file)
design-name.lis (program statistics and error messages)
design-name.stn (DC analysis including device characteristics)
design-name.trn (Transient analysis)
design-name.acn (AC analysis, frequency response)
xxx, yyy, zzz Arbitrary alphanumeric strings
<...> Optional data fields
UPPERCASE Keywords, parameter names etc.
lower case Variables to be replaced with a numeric or symbolic value
... Indicates that the item may be repeated any number of times
+ A continuation of the preceding line
* Upper and lower case are not distinguished except in Unix filenames.
* Lines may be no longer than 80 characters. Lines may be continued by entering a plus sign (+) in column 1 of the next line
* Names must begin with a letter and must not contain spaces or other delimiters. Only the first 16 characters of names are significant.
* Numbers may be written as integers (2, -347), floating point (3.141, 4.6) or floating point with exponent (1E3, 5.62E6). Integer or floating point numbers may be followed by any of the scale factors below.
K = 10[3] MEG = 10[6] G = 10[9 ]T = 10[12 ]
M = 10[-3] U = 10[-6] N = 10[-9] P = 10[-12]
* Letters immediately following the number (which are not scale factors) and any letters following the scale factor are ignored.
* Comment statements may be indicated by an asterisk (*) in the first column.
Title Implicit first line; becomes input netlist title
* Comments to describe circuit
Netlist Circuit description (See Sect. 4.3)
.MODEL Detailed parameters of a device (See Sect. 4.3.1.2)
.LIBRARY Specifies location of device models (See Sect. 4.3.1.3)
Sources Sets input stimuli (See Sect. 4.3.2)
Analyses Statements to perform required analysis (See Sect. 4.4)
.OPTIONS Set simulation conditions (See Sect. 4.5)
.END Terminates file
The first statement in an HSPICE file must be a title statement and the last must be the end statement (.END). The other Statements may be in any order.
Each circuit element must have its characteristics defined to the HSPICE program. In general the type of element is indicated by the first letter of the component name. If more sophisticated device characteristics are used then a .MODEL statement is required.
Capacitor Cxxx n+ n- <modelname> value
Inductor Lxxx n+ n- value
Mutual Inductors Kxxx Lyyy Lzzz value
Junction Diode Dxxx n+ n- modelname
Bipolar Transistor Qxxx nc nb ne modelname
Junction, MESFET and GASFET Jxxx nd ng ns modelname
MOSFET Mxxx nd ng ns modelname
Voltage controlled current source Gxxx n+ n- nc+ nc- value
Voltage controlled voltage source Exxx n+ n- nc+ nc- value
Current controlled current source Fxxx n+ n- vname value
Current controlled voltage source Hxxx n+ n- vname value
n1,n2 Nodes of unpolarised device.
n+,n- Positive and negative device nodes.
nc,nb,ne Collector, base and emitter nodes of bipolar transistor.
nd,ng,ns Drain, gate and source nodes of field-effect transistor
modelname Parameter which specifies which device model is to be used. The device description is given in the .MODEL statement.
nc+,nc- Positive and negative controlling nodes of dependent linear sources.
vname Name of the voltage source through which a controlling current flows.
value Component value in the appropriate units.
.SUBCKT subname n1 <n2 n3 ...> $ Sub-circuit definition
sub-circuit description here...
.ENDS <subname> $ End of definition
Xyyy n1 <n2 n3 ...> subname $ Instance of sub-circuit
For example, the RLC series section (rlc1) in Fig 4.1a is placed twice
in the circuit shown in Fig. 4.1b. Note that nodes 1 and 2 (the terminals) of
the sub-circuit are not the same as nodes 1 and 2 of the main circuit.
Fig.4.1a. RLC Sub-circuit. 4.1b. RLC sub-circuit in main circuit
.SUBCKT rlc1 1 2 R1 1 2 100
R1 1 3 100 X1 2 0 rlc1
C1 3 4 10n R2 2 3 100
L1 4 2 2m X2 3 0 rlc1
.ENDS R3 3 4 100
The form of the .MODEL statement is given below:
.MODEL modelname type <parameter-name=value> ...
modelname User defined name for this model.
type Selects the model type which is one of:
AMP Operational amplifier
C Capacitor
D Diode
L magnetic core mutual inductor
NJF N-channel JFET
NMOS M-Channel MOSFET
NPN NPN Bipolar junction transistor
PJF P-channel JFET
PMOS P-channel MOSFET
PNP PNP Bipolar junction transistor
R Resistor
parameter There are many possible parameters for each device type. It is beyond the scope of this document to describe these here.
Some simple examples:
Bipolar NPN transistor with forward Beta of 200
Q1 3 2 0 bjtmod1
.MODEL bjtmod1 NPN BF=200
Operational Amplifier (internal compensation) with gain of 100,000 and internal feedback compensation capacitance of 27 pF .
XA1 4 3 2 5 6 ampmod1
.MODEL ampmod1 AMP DEF=0 AV=1E5 C2=27P
In practice you can call up models for most devices from a library. See the next section.
.INC '<path>filename'
Some useful libraries provided are:
/usr/local/hspice/h93a/parts/bjt Bipolar transistors, e.g. t2n2222a.inc
/usr/local/hspice/h93a/parts/dio Diodes, e.g. d1n4001.inc
/usr/local/hspice/h93a/parts/behave Op-amps etc. e.g. alm741.inc
Vxxx n+ n- <DC value> <AC AC-mag> <AC-phase> <Tran-func>
Iyyy n+ n- <DC value> <AC AC-mag> <AC-phase> <Tran-func>
DC specification
* Voltage sources need not be grounded.
* If a voltage source is time-invariant (e.g. a power supply) then the value may be preceded by the option DC.
Example: A DC supply of 6 Volts between nodes 10 and ground.
VCC 10 0 DC 6
AC specification
AC-mag is the magnitude and AC-phase is the AC phase (in degrees). The source is set to this value in the AC analysis. If the magnitude is omitted a value of unity is assumed. If the phase is omitted it is assumed to be zero.
Example: An AC current source of 1 Amp and 45 degrees phase from nodes 13 to 2.
ISRC 13 2 AC 1 45.0
Transient specification
Any independent source may be assigned a time-varying value for transient analysis. There are several useful specifications described below.
v1 Initial value in Volts or Amps.
v2 Pulsed value in Volts or Amps.
td Delay time in seconds. Default=0.0.
tr Rise time in seconds. Default=TSTEP.
tf Fall time in seconds. Default=TSTEP.
pw Pulse width in seconds. Default=TSTEP.
per Period in seconds. Default=TSTEP.
For example: Vpulse 1 0 PULSE (0 1 1m 1n 1n 2m)
vo Offset in Volts or Amps.
va Amplitude in Volts or Amps.
freq Frequency in Hertz.
td Delay in seconds. Default= 0.0.
theta Damping factor in 1/seconds. Default=0.0.
phi Phase delay in degrees. Default=0.0.
For example: Vsin 2 0 SIN (0 1 1k)
v1 Initial value in Volts or Amps
v2 Pulsed value in Volts or Amps
td1 Rise delay time in seconds. Default=0.0.
td2 Fall delay time in seconds. Default= td1 + TSTEP.
tau1 Rise time constant in seconds. Default=TSTEP
tau2 Fall time constant in seconds. Default=TSTEP.
For example: Vexp 4 0 EXP (0 1 1m 2m 50u 50u)
t1, t2 ... Times of linear segments in seconds
v1, v2 ... Voltage or current values in Volts or Amps.
R Causes waveform to repeat.
For example: Vpwl 5 0 PWL (0 0 1m 1 2m 1 3m 0)
vo Offset in Volts or Amps
va Amplitude in Volts or Amps
fc Carrier frequency in Hz
mdi Modulation index. Default=0.0
fs Signal frequency in Hz
For example: Vfm 6 0 SFFM (0 1 1k 0.1 10k)
sa Signal amplitude
oc Offset constant
fm Modulation frequency
fc Carrier frequency
td Delay time.
For example: Vam 7 0 AM (0 0.1 100 1k 0)
.DC src1 start1 stop1 incr1 <src2 start2 stop2 incr2>
src1, src2 Name of independent voltage or current source.
start1, start2 Starting voltage or current
stop1, stop2 Final voltage or current
incr1, incr2 Voltage or current increment value
.OP <format> <time> ...
format One of the following keynames (only the first letter is required)
All Full operating point information.
Brief One line summary for each element.
time Times at which the report is printed
ov1 Branch current or nodal voltages for DC component sensitivity analysis.
If this analysis is requested HSPICE calculates the DC small-signal sensitivities of each specified output variable relative to every circuit parameter. These measurements are the partial derivatives of each output variable with respect to the value of a given circuit element, taken at the operating point and normalised to the total change in output magnitudes. This may create large amount of information even for small circuits.
ov Small-signal output variable
srcnam Small-signal input source.
If this analysis is requested HSPICE calculates the DC small-signal value of the transfer function (input/output), input resistance and output resistance.
.AC type np fstart fstop
type One of the following:
DEC - decade variation
OCT - Octave variation
LIN - Linear variation
POI - List of points.
np Number of points per decade, octave or just number of points, depending on type keyword.
fstart Starting frequency
fstop Final frequency
Rload The resistor element name of the output load resistor into which the output power is fed.
inter The number of frequency points at which a distortion measure summary is printed.
skw2 The ratio of the second frequency F2 to the nominal frequency F1. the default ratio is 0.9.
refpwr Reference power. The default is 1 mW measured in dBM.
spwf Amplitude of second frequency F2 . The default is 1.0.
Calculates the distortion characteristics of the circuit in an AC small-signal steady-state sinusoidal analysis. The analysis is performed assuming that one or two signal frequencies are imposed at the input. The first frequency F1 is the nominal analysis frequency set by the .AC statement. The optional second input frequency F2 is set implicitly by specifying skw2 (=F2/F1). The distortion analysis is written to the log file (.lis) and contains the following measures at the load resistor:
DIM2 Intermodulation distortion, difference. Relative magnitude and phase of F1-F2.
DIM3 Intermodulation distortion, second difference. Relative magnitude and phase of 2*(F1-F2).
HD2 Second order harmonic distortion. Relative magnitude and phase of 2*F1.
HD3 Third order harmonic distortion. Relative magnitude and phase of 3*F1.
SIM2 Intermodulation distortion, sum. Relative magnitude and phase of F1+F2.
ovv Nodal voltage output variable defining the node at which noise is summed.
srcnam Name of the independent voltage or current source to be used as the noise input reference.
inter Number of frequency points at which a noise summary is to be printed
Calculates the output noise based on the complex AC nodal voltages which in turn are based on the DC operating pint. A noise source is assumed to be not statistically correlated to the other noise sources in the circuit. The total output noise voltage is the RMS sum of the individual noise contributions.
.TRAN tstep tstop <tstart>
tstep Suggested computing time increment. This is modified automatically by HSPICE if necessary.
tstop Time at which transient analysis stops.
tstart If tstart is omitted it is assumed to be zero.
freq Fundamental frequency.
ov1, ov2 Output variables for which the analysis is required.
This causes HSPICE to perform Fourier analysis as part of the transient analysis.
input Independent voltage or current input source.
output Output variable. Any node voltage or branch current.
This analysis uses the Muller method to calculate the roots of the network transfer function polynomials and reports the results in the HSPICE log (.lis) file.
.OPTIONS option ...
Some of the more common options are:
CSDF Generate graphical output in Common Simulation Data Format
ACCT Generate accounting and run-time statistics
TNOM=x Sets nominal temperature (Default = 25 [[ring]]C, 298 K)
LIMPTS=x Sets the total number of points used for AC analysis. Default=2001.
NODE Causes a cross-check listing of all element nodes to be printed
INTERP Limits output file size for transient analysis by interpolating data
* Circuit elements
R1 1 2 20
L1 2 3 1mH
C1 3 0 1uF
* Voltage Source (A 5V pulse)
Vsupply 1 0 PULSE(0 5 0 0 0 1 2)
* Transient Analysis for 500 micro-seconds
.TRAN 100ns 500us
* The CSDF options statement ensures all data is captured
.OPTIONS CSDF
.END
* ELEMENTS
R1 1 2 1K
R2 2 3 1K
C1 2 4 226N
C2 3 0 113N
* USE A VOLTAGE CONTROLLED VOLTAGE SOURCE FOR THE OP-AMP
E1 4 0 3 4 100K
VIN 1 0 AC 1 PULSE(0 1 0 0 0 1 5)
.AC DEC 100 10 100K
* PRINT THE MAGNITUDE AND PHASE OF THE OUTPUT
.TRAN 100NS 2MS
.OPTIONS CSDF
.END
Invoke ViewTrace by double-clicking on the ViewTrace icon in the Powerview Cockpit. You will see a dialogue box (Fig. 5.1) where you can enter the name of your waveform file. You must enter a name here. The file extension must be included. If you click on the All box you will see all the valid HSPICE output files in the current project.
Fig. 5.1 ViewTrace Input dialogue box
When ViewTrace starts it displays the ViewTrace window such as the example shown in Fig 5.2. You can use the File commands to read and write other waveform files.
Fig. 5.2. ViewTrace Window
Note the following features of the ViewTrace window shown in Fig. 5.2.
Names Region Contains names of waveforms displayed in Waveforms region. Names which have been hidden or deleted do not appear. Names may be selected by clicking or dragging with the left mouse button.
Values Region Shows value of each waveform at the current 'Point'. You can adjust the 'Point' position.
Waveform Region Shows a graphic representation of each waveform.
(Y) Axis Vertical axis. For digital waveforms this is dimensionless and simply labelled 'Digital'.
(X) Axis Horizontal axis. Gives a time scale corresponding to the portion of the simulation in the wave region.
Point & Mark Moveable points which can be positioned anywhere in the Waveforms region. Used in conjunction with the Info box to measure coordinates and differences.
File È Open Allows you to open another waveform file for editing.
File È Write Allows you to save your waveform file. You will be given a list of filetypes (CSDF, PWL, GEN, CMD, BAD) which may be used. It is important that you save waveforms as CSDF (Common Simulation Data Format) files.
Fig. 5.3. ViewTrace Function key assignments
Change È Axis È Type Allows you to change the form of the axis display. Select the axis in the ViewTrace window with the left mouse button. Then select a type from the dialogue box shown in Fig 5.4.
Fig. 5.4. ViewTrace Change Axis Type dialogue box
Change È Axis È Label Allows you change the name displayed on any vertical or horizontal axis. Select the axis in the ViewTrace window with the left mouse button.
Change È Axis È Grid Allows you to display or remove the grid for any vertical or horizontal axis. Select the axis in the ViewTrace window with the left mouse button.
Change È Signal È Colour Allows you to change the displayed colour for a selected signal. You can choose the colour from a palette.
Change È Display È Info Allows you to turn the Info box on or off. The Info box is a small, moveable box which displays the current X-Y coordinates of the Point, the Mark, their difference and their slope.
Fig. 5.5. ViewTrace Maths dialogue box
Signal È FFT Performs a Fast Fourier Transform on all currently displayed signals and displays the transform in a new window.
Axis È Add Creates a new vertical axis containing only selected signals from the ViewTrace window. Before using this command select (with the left mouse button) the signals you want to appear on the new axis.
Axis È Join Joins two or more selected vertical axes, combining all signals. Before using this command select (with the left mouse button) the axes you want to join.
Axis È Remove Deletes a vertical axis from the ViewTrace window.
Axis È Split Splits signals on a selected axis into two groups, creating a new axis with the selected signals. Useful for displaying signals with widely varying ranges. Before using this command select (with the left mouse button) the signals you want to appear on the new axis.
NB. You will be charged for laser printing. Refer to the documents produced by Information Systems.
1. Create your print files.
n È Plot Setup Define the plotting parameters:
Set the plotting device to POSTSCRIPT
Set the paper size to A4 or A3 as required
Set the output device to FILE and change the filename if required. The default filename will be name.001p.
Set the plot contents to FULL SHEET or ZOOMED VIEW as required.
Select APPLY to update parameter changes
Select ACCEPT to update parameter changes and create the plot.
n È Plot Go
Once you have defined the plotting parameters with Plot Setup and if the parameters have not changed you can use Plot Go directly from the red square menu.
Note that this also uses the same filename each time so it is only suitable if you have already printed the previous file.
Wait for the plotting process to complete. You will see messages showing its progress. It will rarely take longer than 30 seconds.
2. Send print files to printer
The print files are created in your current project directory. Each file may be printed with the lp command using the appropriate options or with the OpenWindows Print Tool.
e.g. lp -d paylaser name.001p
NB. The correct printer queues are paylaser for A4 Postscript files and a3ps for A3 PostScript files.
Your prints will be delivered to the pigeon holes by the computer room on the 4th floor of the main building.
n È Plot Setup Define the plotting parameters:
Set the plotting device to EPSON 5 (there are several EPSON print devices with varying dot resolutions. The higher resolutions take much longer to print).
Set the output device to SPOOL
Set the plot contents to FULL SHEET or ZOOMED VIEW as required.
Select APPLY to update parameter changes
Select ACCEPT to update parameter changes and create the plot.
n È Plot Go
Once you have defined the plotting parameters with Plot Setup and if the parameters have not changed you can use Plot Go directly from the red square menu.
Note that this also uses the same filename each time so it is only suitable if you have already printed the previous file.
Wait for the plotting process to complete. You will see messages showing its progress. It will rarely take longer than 30 seconds.
If you have any difficulties printing to the dot matrix printer (output quality is very poor, text is missing etc.) then create a plot file and use the command:
lp -d nw402dr filename