Experiment No.
OBJECTIVE
Study and Introduction of following tools to be used in the lab:
a) SPICE Tools: Tanner:- T-spice, s-edit
b) And with help of simple RC circuits and perform Transient Analysis
1. INTRODUCTION
SPICE is a powerful general purpose analog circuit simulator that is used to verify circuit
designs and to predict the circuit behavior. This is of particular importance for integrated
circuits. It was for this reason that SPICE was originally developed at the Electronics
Research Laboratory of the University of California, Berkeley (1975), as its name
implies:
Simulation Program for Integrated Circuits Emphasis.
SPICE can do several types of circuit analyses. Here are the most important ones:
Non-linear DC analysis: calculates the DC transfer curve.
Non-linear transient analysis: calculates the voltage and current as a function of
time when a large signal is applied.
Linear AC Analysis: calculates the output as a function of frequency. A bode plot
is generated.
Noise analysis
Sensitivity analysis
Distortion analysis
Fourier analysis: calculates and plots the frequency spectrum.
In this slab you will be using T-SPICE. You will be using the following components
during this lab experiments.
Resistors
Capacitors
Diodes
MOS transistors
Independent voltage and current sources
2. HOW TO SPECIFY THE CIRCUIT TOPOLOGY AND ANALYSIS?
A SPICE input file, called source file, consists of three parts.
1. Data statements: description of the components and the interconnections.
2. Control statements: tells SPICE what type of analysis to perform on the circuit.
3. Output statements: specifies what outputs are to be printed or plotted.
Although these statements may appear in any order, it is recommended that they be given
in the above sequence. Two other statements are required: the title statement and the end
statement. The title statement is the first line and can contain any information, while the
end statement is always .END. In addition, you can insert comment statements, which
must begin with an asterisk (*) and are ignored by SPICE.
TITLE STATEMENT
ELEMENT STATEMENTS
.
.
COMMAND (CONTROL) STATEMENTS
OUTPUT STATEMENTS
.END
Format: The statements have a free format and consist of fields separated by a blank. If
one wants to continue a statement to the next line, one uses a "+" sign (continuation sign)
at the beginning of the next line. Numbers can be integers, or floating points. For
example,
RES1 1 0 3500 or RES1 1 0 3.5E3
One can also use the following scale factors:
T(= 1E12 or 10+12) Tera ; G(= E9) Giga ; MEG(= E6) Mega; K(= E3) Kilo; M(= E-3)
Milli; U(= E-6) micro; N(= E-9) nano; P(= E-12) pico, and F(= E-15) femto.
As an example, one can specify a capacitor of 225 pico farad in the following ways:
225P, 225p, 225pF; 225pFarad; 225E-12; 0.225N, etc.
2.1 Data Statements to Specify the Circuit Components and Topology
a. Resistors:
The name of a resistance must start with R or r.
Rname N1 N2 Value
Example:
R1 1 0 10K
b. Capacitors
The name of a capacitor must start with C or c.
Cname N1 N2 Value <IC>
N1 is the positive node.
N2 is the negative node.
IC is the initial condition (DC voltage)
The symbol < > means that the field is optional. If not specified, it is assumed to
be zero.
Example: Cap5 3 4 35E-12 5
c. Independent DC Sources
Voltage source: Vname N1 N2 Type Value
Current source: Iname N1 N2 Type Value
N1 is the positive terminal node
N2 is the negative terminal node
Type can be DC, AC or TRAN, depending on the type of analysis (see Control
Statements)
Value gives the value of the source
The name of a voltage and current source must start with V and I, respectively.
Examples:
Vin 2 0 DC 10
Is 3 4 DC 1.5
The positive current direction through the current or voltage source is from the positive
(N1) node to the negative (N2) node:
Voltage and Current Conventions:
1. Spice always assigns a positive reference mark to the 1st node and uses the
passive sign convention to assign the current reference.
2. Spice uses the node-voltage analysis. It solves for the unknown node voltages and
also the unknown currents through independent voltage sources. This gives us a
way to find currents flowing in elements: one has to ask for the current through a
voltage source. Thus one can insert an independent voltage source of zero value in
series with the element in which one wants to know the current, as shown in the
example below:
The value of the current will be positive if it flows from the positive to the
negative terminal through the source, as in the above example. Some versions of
Spice allow you to ask for a current through a resistor without using a voltage
source (EX: I (R1,terminal) give the current in the resistor R1).
d. Sinusoidal sources
Vname N1 N2 SIN(VO VA FREQ TD THETA PHASE)
which is a damped sinusoidal voltage source:
Vname = VO + VA exp[-THETA.(t - TD)] sin[2pi.f (t - TD) + (Phase/360)]
VO - offset voltage in volt.
VA - amplitude in volt.
f = FREQ - the frequency in Hz.
TD - delay in seconds
THETA - damping factor per second
Phase - phase in degrees
If TD, THETA and PHASE are not specified, it is assumed to be zero.
Example: VG 1 2 SIN (5 10 50 0.2 0.1)
VG2 3 4 SIN (0 10 50)
The last example is an undamped, undelayed sinusoid with amplitude of 10V and
frequency of 50 Hz.
To generate a cosine function, you can make use of the phase relationship between the
sinusoid and cosine. Here is an example of an undelayed cosine with an amplitude of 5V
and frequency of 50 Hz.
Vcos 1 2 SIN(0 5 50 0 0 90)
e. Piecewise linear source (PWL)
Vname N1 N2 PWL(T1 V1 T2 V2 T3 V3 ...)
Where, (Ti Vi) specifies the value Vi of the source at time Ti
Example:
Vgpwl 1 2 PWL(0 0 10U 5 100U 5 110U 0)
f. Pulse
Vname N1 N2 PULSE(V1 V2 TD Tr Tf PW Period)
V1 - initial voltage; V2 - peak voltage; TD - initial delay time; Tr - rise time; Tf - fall
time; pwf - pulse-width; and Period pulse period.
The .MODEL statement allows you to specify the parameters of a variety of devices
used in SPICE, such as diodes, transistors, MOS.
Semiconductor Devices
Most of the elements that have been described above require only a few parameters to
specify its electrical characteristics. However, the models for semiconductor devices
require many parameter values. A set of device model parameters is defined in a separate
.MODEL statement and assigned a unique name. This method alleviates the need to
specify all of the model parameters on each device element card. Thus a semiconductor
device is specified by two command lines: an element and model statement.
The syntax for the model statement is:
.MODEL MODName Type (parameter values)
MODName is the name of the model for the device. The Type refers to the type of device
and can be any of the following:
D: Diode
NPN: npn bipolar transistor
PNP: pnp bipolar transistor
NMOS: nmos transistor
PMOS: pmos transistor
The parameter values specify the device characteristics as explained below.
m1. Diode
Element line:
Dname N+ N- MODName
Model statement: .MODEL MODName D(IS=
N=
Rs=
CJO=
Tt=
BV=
IBV=
The element name starts with D to indicate that the element is a diode,
N+ and N- are the two node numbers and
MODName is the name of the model of the diode which is specified in the model
line.
The values one can specify include: the saturation current, IS (default=1E-14A), the
emission coefficient, N (=1), the series resistance, RS (=0 ohm), junction capacitance,
CJO (=0F), transit time, TT (=0sec), reverse bias breakdown voltage, BV (=infinite) and
the reverse bias breakdown current, IBV (=1xE-10A). If a parameter is not specified the
default value (given in parenthesis) is assumed.
As an example, the model parameters for a 1N4148 commercial diode are as follows:
.model D1N4148 D (IS=0.1PA, RS=16 CJO=2PF TT=12N BV=100 IBV=0.1PA)
Note: The values of parameter may vary for different model
and companies.
m2. MOSFETS
Element: Mname ND NG NS NB ModName L=
W=
The MOS transistor name (Mname) has to start with M
ND, NG, NS and NB are the node numbers of the Drain, Gate, Source and Bulk
terminals, respectively.
ModName is the name of the MOS model.
L and W are the length and width of the MOS
The above parameters are usually sufficient when specifying discrete transistors.
However, for integrated circuit simulations one need to specify several other parameter
values
related
to
the
transistor
geometry.
These
are
optional.
Mname ND NG NS NB ModName L W AD AS PD PS NRD
where
AD and AS are the area of source and drain diffusion
PD and PS are the value of the perimeter of the source and drain.
NRD is the number of squares of the drain diffusion for resistance calculations.
Model statement:
.MODEL ModName NMOS (LEVEL =
KP= VT0= lambda= gamma=)
Where, KP=uCox and VTO is the threshold voltage
LEVEL refers to the MOSFET model that describes the terminal I-V characteristics of the
transistors. LEVEL 1 is the simplest MOS model and is in general sufficient for
describing discrete transistors for this lab courses.
However to simulate integrated circuit transistors, one need to use a more sophisticated
models. LEVEL 2 includes extensive second-order models, while LEVEL 3 is a semiempirical model that is better suited for short-channel transistors..
NMOS
.MODEL CMOSN NMOS LEVEL=3 PHI=0.600000 TOX=2.1200E-08 XJ=0.200000U
+TPG=1 VTO=0.7860 DELTA=6.9670E-01 LD=1.6470E-07 KP=9.6379E-05
+UO=591.7 THETA=8.1220E-02 RSH=8.5450E+01 GAMMA=0.5863
+NSUB=2.7470E+16 NFS=1.98E+12 VMAX=1.7330E+05 ETA=4.3680E-02
+KAPPA=1.3960E-01 CGDO=4.0241E-10 CGSO=4.0241E-10
+CGBO=3.6144E-10 CJ=3.8541E-04 MJ=1.1854 CJSW=1.3940E-10
+MJSW=0.125195 PB=0.800000
PMOS
.MODEL CMOSP PMOS LEVEL=3 PHI=0.600000 TOX=2.1200E-08 XJ=0.200000U
+TPG=-1 VTO=-0.9056 DELTA=1.5200E+00 LD=2.2000E-08 KP=2.9352E-05
+UO=180.2 THETA=1.2480E-01 RSH=1.0470E+02 GAMMA=0.4863
+NSUB=1.8900E+16 NFS=3.46E+12 VMAX=3.7320E+05 ETA=1.6410E-01
+KAPPA=9.6940E+00 CGDO=5.3752E-11 CGSO=5.3752E-11
+CGBO=3.3650E-10 CJ=4.8447E-04 MJ=0.5027 CJSW=1.6457E-10
+MJSW=0.217168 PB=0.850000
Another model that is especially suited to model short-channel effects is called the BSIM
model.
2.2 Commands or Control Statements to Specify the Type of Analysis
a) .OP Statement
This statement instructs Spice to compute the DC operating points:
voltage at the nodes
current in each voltage source
operating point for each element
b) .DC Statement
This statement allows you to increment (sweep) an independent source over a certain
range with a specified step. The format is as follows:
.DC SRC-name START STOP STEP
in which SRC name is the name of the source you want to vary,
START and STOP are the starting and ending value, respectively; and STEP is the size of
the increment.
Example: .DC V1 0 20 2
Notes
When the Start and Stop values are identical (and the Step is non-zero), the .DC
command produces only one value.
You can nest the DC sweep command which is often used to plot MOS
characteristics, such as the Drain current (ids) versus the Drain-source voltage
(Vds) for different gate voltages Vgs. This can be done as follows:
.DC SRCname1 START STOP STEP SRCname2 START STOP STEP
Example: .DC Vds 0 5 0.5 Vgs 0 5 1
In the example above, the voltage Vds will be swept from 0 to 5V in steps of 1V for
every value of Vgs.
c) .TRAN Statement
This statement specifies the time interval over which the transient analysis takes place,
and the time increments. The format is as follows:
.TRAN TSTEP TSTOP <TSTART <TMAX>> <UIC>
TSTEP is the printing increment.
TSTOP is the final time
TSTART is the starting time (if omitted, TSTART is assumed to be zero)
TMAX is the maximum step size.
UIC stands for Use Initial Condition and instructs PSpice not to do the quiescent
operating point before beginning the transient analysis. If UIC is specified, PSpice
will use the initial conditions specified in the element statements (see data
statement) IC = value.
d) .IC Statement
This statement provides an alternative way to specify initial conditions of nodes (and thus
over capacitors).
.IC Vnode1 = value Vnode2 = value
e) .AC Statement
This statement is used to specify the frequency (AC) analysis. The format is as follows:
.AC LIN NP FSTART FSTOP
.AC DEC ND FSTART FSTOP
.AC OCT NO FSTART FSTOP
in which
LIN stands for a linear frequency variation, DEC and OCT for a decade and
octave variation respectively.
NP stands for the number of points and ND and NO for the number of frequency
points per decade and octave.
FSTART and FSTOP are the start and stopping frequencies in Hz
Example: .AC DEC 10 1000 1E6
2.3 Output Statements
These statements will instruct Spice what output to generate. If you do not specify an
output statement, Spice will always calculate the DC operating points. The two types of
outputs are the prints and plots.
.PRINT TYPE OV1 OV2 OV3 ...
.PLOT TYPE OV1 OV2 OV3 ...
in which TYPE specifies the type of analysis to be printed or plotted and can be:
DC
TRAN
AC
The output variables are OV1, OV2 and can be voltage or currents in voltage sources.
Node voltages and device currents can be specified as magnitude (M), phase (P), real (R)
or imaginary (I) parts by adding the suffix to V or I as follows:
M: Magnitude
DB: Magnitude in dB (deciBells)
P: Phase
R: Real part
I: Imaginary part
Examples:
.PLOT DC V(1,2) V(3) I(Vmeas)
.PRINT TRAN V(3,1) I(Vmeas)
.PLOT AC VM(3,0) VDB(4,2) VM(2,1) VP(3,1) IR(V2)