SPICE: Tutorial

advertisement
Tutorial on PSPICE
References:
G. W. Roberts, A. Sedra , SPICE,
© Oxford University Press, 2/e, 1977
1
Introduction



SPICE = Simulation Program with Integrated Circuits Emphasis
SPICE underlying engine solves numerically the various
continuous time differential equations describing the circuit
How to use SPICE ? We have to write an input file, also called
“deck”.
Deck
ASCII
SPICE
Engine
Program
Output
ASCII
The SPICE deck
The input file must contain:
1.
2.
3.
4.
Title statement:
.END statement:
Circuit statements:
Control statements:
5.
always on the first line of the input file
always on the last line of the input file
lines that contains the description of a circuit element
lines that contains an analysis request or
measurements nodes or model parameters
Comment statements: lines starting with an asterisk (*)




The order of the SPICE lines is not important except for the title line and the .END line
SPICE is case insensitive and words can be separated by any number of spaces
Components must be uniquely labeled
Every node of the circuit is designated by a number. The ground node is labeled 0.
Example of an input file
Title
The + sign
means that
the previous
statement is
continued on
this line.
Positive
Terminal
(n+)
Low Pass Filter
** Circuit Description
Vin 1 0 PWL(0s, 0V, 1ms, 0V,
+ 1.0001ms, 1V)
R1 1
2
1kohm
C1 2
0
1uF
* Analysis Request
.OP
.TRAN 0.1ms 5ms
.end
.END
command
Negative
Terminal
(n-)
Dimensions and scale-factors
Common circuit elements
First letter
Element
C
capacitor
D
diode
R
resistor
L
inductor
Q
bipolar transistor
M
MOS Field Effect transistor
I
independent current source
V
independent voltage source
E
voltage-controlled voltage source
F
current-controlled current source
G
voltage-controlled current source
H
current-controlled voltage source
Independent Sources
Analysis and output requests
Besides the circuit description we need to:


Specify the type of analysis for our simulation
Choose the circuit variables that we want to display
Analysis Requests
Operating point
DC sweep
AC frequency response
Transient response
.OP
.DC source_name start_value stop_value step_value
.AC DEC points_per_decade freq_start freq_stop
.AC OCT points_per_octave freq_start freq_stop
.AC LIN total_points freq_start freq_stop
.TRAN printing_time_step time_stop [time_start, max_time_step]
Output Requests
Sub circuits
The definition in SPICE for a subcircuit is as follow:
.SUBCKT subcircuit_name list_of_nodes
Circuit Description
.ENDS
To incorporate the sub circuit into the main design
use the following statement, which starts with the
letter “X”:
Xname node_connections subcircuit_name
Example using a sub circuit
Download