SPICE Circuit Simulator Reference Manual




SPICE stands for Simulation Program Integrated Circuits Especially! The program originates from the University of California, Berkeley. Spice is used to provide a reasonably detailed analysis of circuits containing active components such as bipolar transistors, field effect transistors, diodes and lumped components such as resistors, capacitors and inductors. Note that Spice is a circuit simulation program, not a logic simulation program. Thus Spice considers the voltages and currents in a circuit to be continuous quantities, not quantised into high/low values. The original Spice program has given rise to a variety of commercial implementations. At Aberdeen the following versions are available to you:
HSPICE – running on the Unix systems this is a particularly fast version, and is the one you should normally use. A graphics post processor is available.
PSPICE – a useful version on PCs. Again a graphics post processor is available as well as a schematic capture system and other electronics design tools. For a free evaluation copy, which will simulate many usefull small circuits see the microsim home page.
cdsSpice – available on the HP machines in the CAD lab, and on the Sun machines supplied by the Computing Centre as part of the Cadence CAD environment.
Dolphin SMASH – again a PC version of SPICE with very good transistor modelling features. A free evaluation copy is also available which like the Microsim PSPICE product is limited to small circuits.
This handout begins by giving a short description and example of a SPICE input file. This is followed by a manual for standard SPICE (i.e. without the bells and whistles associated with most commercial versions).
Input Data
Spice reads in a sequential text file containing a description of the circuit to be simulated, and a set of commands specifying the required simulation and output data. The input file consists of cards which are either:
Title Card – The first line of an input file is always a title card. The text on this card is used to identify the output.
.END card – every input file should be finished by a .END card (note the leading period), which on some versions MUST be followed by a carriage return to be recognised.
Comment Card – a line beginning with the symbol * is treated as commentary and ignored by Spice.
Element Card – the circuit to be analyzed is described using a set of element cards. These cards give the element name and the numbers of the nodes to which the element is attached. Element cards begin with the name of the element, the first letter of which determines whether the element is a resistor, bipolar transistor, diode and so on. This is followed by the node connections and any parameters, for example the value of a resistor.
Control Card – These cards specify options to the program and the analyses to be performed. Also device models are described in control cards. All control cards begin with the character ‘.’, as in the .END card.
Circuit Description
The circuit to be simulated is best drawn on paper, and each node numbered (note that many CAD tools can automatically generate a Spice circuit description from a computer held circuit schematic – this can be done with Aberdeen University Engineering Department’s CAD Software). By convention the node connected to ground, or the datum node, is numbered 0, Spice requires this convention to be followed. Each element of the circuit should then be named, noting that the first letter of the name determines the type of element, thus R denotes a resistance, C a capacitor. Names should not contain the characters ‘ ‘ (space), ‘=’, ‘,’ (comma), ‘(‘ or ‘)’.
Following the name the node connections are given, and then the parameters specific to the circuit element. Thus for a 1pF capacitor named CLoad:
Cload 10 0 1PF
giving a capacitor connected from node 10 to ground (node 0).
Models
For the more complex elements, bipolar transistors, field effect transistors and diodes, many of the parameters will be the same for each element. For example, with a circuit using MOSFETS parameters such as tox will be identical for each element, since tox is determined by the process line, not by the circuit designer. The channel width and length however will depend on the individual transistor. Spice therefore requires that one of the parameters to transistor and diode elements is a model name, and it is to that model name that the common parameters are given. Model names and the associated parameters are given in a .MODEL card. We may for example have a card for a MOSFET element (NOT a model) with:
Mpullup 100 2 1 0 MPMOS
Somewhere else in the input deck a model card will define the MOSFET model called MPMOS. Note that model names, like element names, can use the first character as a type identifier, although unlike element names, they are not required to:
.MODEL MPMOS PMOS(VTO=-0.8V KP=16U)
In this case, since we are dealing with a p-channel device the threshold voltage is negative. If Spice is to be used for the simulation of circuits built with discrete components, libraries of element models are available for some of the common diodes, transistors and op-amps.

The complete manual

SPICE Version 2G User’s Guide
TYPES OF ANALYSIS
DC Analysis
AC Small Signal Analysis
Transient Analysis
Analysis at Different Temperatures
CONVERGENCE
INPUT FORMAT
CIRCUIT DESCRIPTION
TITLE CARD, COMMENT CARDS AND END CARD
Title Card
END Card
Comment Card
ELEMENT CARDS
Resistors
Capacitors and Inductors
Coupled (Mutual) Inductors
Transmission Lines (Lossless)
Linear Dependent Sources
Linear Voltage-Controlled Current Sources
Linear Voltage-Controlled Voltage Sources
Linear Current-Controlled Current Sources
Linear Current-Controlled Voltage Sources
Independent Sources
Pulse PULSE(V1 V2 TD TR TF PW PER)
Sinusoidal SIN(VO VA FREQ TD THETA)
Exponential EXP(V1 V2 TD1 TAU1 TD2 TAU2)
Piece-Wise Linear PWL(T1 V1 )
Single-Frequency FM SFFM(VO VA FC MDI FS)
SEMICONDUCTOR DEVICES
Junction Diodes
Bipolar Junction Transistors (BJT’s)
Junction Field Effect Transistors (JFET’s)
MOSFET’s
.MODEL Card
Diode Model
BJT Models (both NPN and PNP)
JFET Models (both N and P Channel)
MOSFET Models (both N and P Channel)
SUBCIRCUITS
.ENDS Card
Subcircuit Calls
CONTROL CARDS
.TEMP Card
.WIDTH Card
.OPTIONS Card
.OP Card
.DC Card
.NODESET Card
.IC Card
.TF Card
.SENS Card
.AC Card
.DISTO Card
.NOISE Card
.TRAN Card
.FOUR Card
.PRINT Cards
.PLOT Cards
APPENDIX A: EXAMPLE DATA DECKS
Circuit 1 Determines the dc operating point and small-signal transfer of a differential pair.
Circuit 2 Output characteristics of a MOSFET
Circuit 3 Transient response of an inverter
Circuit 4 Four bit adder using subcircuits
Circuit 5 Transmission-line inverter
APPENDIX B: NONLINEAR DEPENDENT SOURCES
Voltage-Controlled Current Sources
Voltage-Controlled Voltage Sources
Current-Controlled Current Sources
Current-Controlled Voltage Sources
V = I(VIN1)*I(VIN2)