../
THE SPICE BOOK
Andrei Vladimirescu
John Wiley & Sons, Inc.New York Chichester Brisbane Toronto Singapore
A C Q U IS IT IO N S E D IT O R S te v e n E ll io t
M A R K E T IN G M A N A G E R S u sa n E lb e
P R O D U C T IO N SU P E R V IS O R R ic h a rd B la n d e r
D E S IG N E R K ev in M u rp h y
M A N U FA C T U R IN G M A N A G E R In e z P e tt is
IL L U S T R A T IO N C O O R D IN A T O R A n n a M e lh o rn
T h is b o o k w a s s e t in T im e s R om an b y P u b lic a t io n S e rv ic e s a n d p r in te d
a n d b o u n d b y M a llo y L ith o g ra p h in g . T h e c o v e r w a s p r in te d b y P h o e n ix C o lo r C o rp .
T h e p a p e r in th is b o o k w a s m an u fa c tu re d b y a m ill w h o s e fo re s t m a n a g em en t p ro g ram s
in c lu d e su s ta in e d y ie ld h a rv e s t in g o f i ts t im b e r la n d s . S u s ta in e d y ie ld h a rv e s t in g p r in c ip le s
e n su re th a t th e n um b e r o f tre e s c u t e a c h y e a r d o e s n o t e x c e e d th e am o u n t o f n ew g row th .
C o p y r ig h t @ 1 9 9 4 , b y Jo h n W ile y & S o n s , In c .
A ll r ig h ts re s e rv e d . P u b lis h e d s im u lta n e o u s ly in C a n a d a .
R e p ro d u c tio n o r tra n s la t io n o f a n y p a r t o f
th is w o rk b e y o n d th a t p e rm it te d b y S e c tio n s
1 0 7 a n d 1 0 8 o f th e 1 9 7 6 U n ite d S ta te s C o p y r ig h t
A c t w ith o u t th e p e rm is s io n o f th e c o p y r ig h t
ow n e r is u n law fu l . R e q u e s ts fo r p e rm is s io n
o f fu r th e r in fo rm a tio n sh o u ld b e a d d re s s e d to
th e P e rm is s io n s D e p a r tm e n t, J o h n W ile y & S o n s , In c .
Library of Congress Cataloging in Publication Data:
V la d im ire s c u , A n d re i .
T h e sp ic e b o o k / A n d re i V la d im ire s c u .
p . cm .
In c lu d e s b ib l io g ra p h ic a l re fe re n c e s .
IS B N 0 -4 7 1 -6 0 9 2 6 -9
1 . S P IC E (C om p u te r f i le ) 2 . E le c tr ic c irc u it a n a ly s is -D a ta
p ro c e s s in g . S . E le c tro n ic c irc u it d e s ig n -D a ta p ro c e s s in g .
I . T it le .
T K 4 5 4 .V 5 8 1 9 9 4
6 2 1 .3 1 9 '2 '0 2 8 5 5 3 -d c 2 0
P r in te d in th e U n ite d S ta te s o f A m e r ic a
1 0 9 8 7 6 5 4 3 2 1
9 3 -3 3 6 6 7
C IP
PREFACE
T h is book is w ritten fo r e lec trica l eng in ee ring s tud en ts and p ro fess ion a ls w ho u se one
o f th e m any ve rs ion s o f th e SP IC E p rog ram to ana ly ze and des ign c ircu its . T he top ic s
p re sen ted in th is book a re un iv e rsa lly v a lid fo r SP IC E use rs no m atte r w h ich ve rs ion
th ey u se . T h is po in t is re in fo rced in th e tex t by u sing th e m ost popu la r SP IC E vers ion s
to run th e exam p les d eve loped in th e chap te rs .
S P IC E has becom e th e s tanda rd com pu te r p rog ram fo r e lec trica l s im u la tio n , w ith
ove r 40 ,000 cop ie s in u se w o rldw id e . T he nam e SP IC E stand s fo r Simulation Program
with Integrated Circuit Emphasis and w as in sp ired by th e app lica tio n to in teg ra ted
c ircu it (IC ) d es ign , w h ich m ade com pu te r s im u la tio n m anda to ry . T oday , SP IC E in its
m any ve rs ion s is u sed no t on ly fo r IC design bu t a lso fo r an a log p rin ted c ircu it bo a rd s ,
pow er e lec tron ic s , and o th e r app lica tio n s .
T he m ajo rity o f th e com m erc ia l S P IC E packages a re b ased on and suppo rt th e
func tion a lity o f SP IC E 2 , v e rs ion G 6 , from the U n iv e rs ity o f C a lifo rn ia a t B erk e ley .
T he cu rren t c ircu it s im u la tio n deve lopm en t a t th e U n iv e rs ity o f C a lifo rn ia a t B erk e ley
is d evo ted to th e SP IC E 3 p rog ram . F ew comm erc ia l p roduc ts a re b ased on SP IC E 3 ,
bu t a num ber o f th ese p rog ram s suppo rt S P IC E 3 func tion a lity th a t is no t av a ilab le in
SP IC E 2 . A comm erc ia l v e rs ion o f SP IC E th a t h as g a in ed popu la rity in un iv e rs itie s
is PS p ice , from the M ic roS im C o rpo ra tio n . P S p ice , w h ich w as firs t in troduced as a
P e rsona l C om pu te r P rog ram , h as b ecom e very popu la r b ecau se o f th e w id e u se o f PC s.
T he m ate ria l in th is book w as deve loped based on th e SP IC E 2 p rog ram , w ho se
func tion a lity and syn tax a re suppo rted by a ll o th e r SP IC E sim u la to rs . T he SP IC E ne tlis t
s tanda rd is d e fin ed by SP IC E 2 , and a ll d e riv a tiv es o f th e p rog ram accep t a SP IC E 2
inpu t file ; fun c tion a lity sp ec ific to a ce rta in SP IC E p rog ram and no t av a ilab le in SP IC E 2
is in troduced as an ex ten s ion to th e SP IC E language and is docum en ted in th e re sp ec tiv e
u se r 's gu id e . E xam p les th roughou t th is book a re s im u la ted a lte rn a tiv e ly on SP IC E 2 ,
SP IC E 3 , o r PSp ice . F unc tion a lity av a ilab le on ly in SP IC E 3 is docum en ted , and u se fu l
fea tu re s p rop rie ta ry to PSp ice a re m en tion ed .
T h is book com b in es in a na tu ra l p rog ress ion a tu to ria l app ro ach on how to advance
from hand so lu tio n s o f typ ica l e lec trica l and e lec tron ic c ircu it p rob lem s to u sing SP IC E ,
w ith som e re fe ren ce in fo rm a tion on th e p rog ram necessa ry fo r th e m o re advanced u se r.
VII
viii PREFACE
The text should be useful to the SPICE novice as well as to the experienced user. The
reader is assumed to have a basic electrical engineering background and be able to use
a computer.
The approach in this book emphasizes that SPICE is not a substitute for knowledge
of circuit operation, but a complement. The SPICE Book is different from previously
published books on this subject in the approach of solving circuit problems with a com-
puter. The solution to most circuit examples is sketched out by hand first and followed
by a SPICE verification. For more complex circuits it is not feasible to find the solution
by hand, but the approach stresses the need for the SPICE user to understand the re-
sults. A lthough the program can detect basic circuit specification errors, it cannot flag
conceptual errors. It is up to the user to question the program through the various anal-
ysis modes in order to get insight into what is wrong with the circuit. Briefly stated,
the results of SPICE are only as accurate as the circuit description and the component
models used.
The first six chapters provide information about SPICE relevant to the analysis
of both linear passive circuits and electronic circuits. Each of these chapters starts out
with a linear example accessible to any new user of SPICE and proceeds with nonlinear
transistor circuits.
The latter part of the book goes into more detail on such issues as functional and hi-
erarchical models, distortion models and analysis, basic algorithms in SPICE, analysis
option parameters, and how to direct SPICE to find a solution when it fails.
This book is ideally suited as a supplement to a wide range of circuits and electron-
ics courses and textbooks. It is of special interest in junior, senior, and graduate courses,
from introductory courses on electric circuits up to analog and digital integrated circuits
courses.
The subject of computer-aided circuit simulation is put in a historical perspective in
the Introduction to this book. The milestones of the research in the late 1960s and early
1970s that led to the SPICE program are presented first. The proliferation of SPICE
versions and the salient features of the most popular programs are described. The In-
troduction follows the evolution of the SPICE effort at the University of California at
Berkeley from the beginning to the present day. This historical perspective concludes
with the current research in the area of electrical computer simulation and the possible
future SPICE developments in the 1990s.
Chapter 1 is an introduction to the computer simulation of electrical circuits and
the program SPICE. The approach used in SPICE to solve electrical problems is de-
scribed in simple terms of the Kirchhoff voltage law , the Kirchhoff current law , and
branch constitutive equations. A linear RLC circuit is used to exemplify the workings
of SPICE. The reader is also introduced to the SPICE input language, the network spec-
ification, the analysis commands, and the types of result output available. The sequence
of events for simulating a circuit is completed by examples on how to run SPICE on
the most common computers.
Chapter 2 presents in detail the circuit specification in terms of elements, models,
and the conventions used. The SPICE syntax is detailed for two-term inal elements, such
as resistors, capacitors, inductors, and voltage and current sources, and multi term inal
elements, such as controlled sources, switches, and transm ission lines.
PREFACE ix
C hap te r 3 in tro d u ce s th e sem ico n d u c to r d ev ic e e lem en ts an d m od e ls av a ila b le in
S P IC E . T h e d u a l sp e c if ic a tio n a s d ev ic e an d m od e l is ex p la in ed fo r sem ico n d u c to r
e lem en ts . O n ly th e f irs t-o rd e r m od e ls a re d e sc r ib ed in th is ch ap te r fo r d ev ic e s rep -
re sen ted b y sev e ra l le v e ls o f com p lex ity . T h e m od e l p a ram e te rs a re re la ted to th e
b ran ch -co n s titu tiv e eq u a tio n s o f th e d ev ic e a s w e ll a s to e le c tr ic a l ch a ra c te r is tic s .
T h e m o s t im po rtan t p h y s ic a l e ffe c ts an d co rre sp o n d in g p a ram e te rs a re d e sc r ib ed fo r
th e f iv e sem ico n d u c to r d ev ic e s su p p o rted : d io d e s , b ip o la r ju n c tio n tran s is to rs (B JT s) ,
ju n c tio n fie ld e ffe c t tra n s is to rs (JF E T s) , m e ta l-o x id e -sem ico n d u c to r f ie ld e ffe c t tra n -
s is to rs (M O SFE T s) , a n d m e ta l-sem ico n d u c to r f ie ld e ffe c t tra n s is to rs (M E SFE T s) . T h is
ch ap te r d o e s n o t co v e r th e d e ta ils o f e a ch m od e l b u t p ro v id e s re fe ren ce s d ed ic a ted
to th e su b je c t.
C h ap te r 4 co n ta in s an o v e rv iew o f th e an a ly s is m od e s o f S P IC E and a d e ta ile d
d e sc r ip tio n o f D C an a ly s is . In th e D C m od e S P IC E can p e rfo rm an op e ra tin g p o in t
an a ly s is , c om pu te D C tran s fe r cu rv e s , e s tim a te th e v a lu e o f th e tran s fe r fu n c tio n , an d
p e rfo rm sen s itiv ity c a lcu la tio n s .
C h ap te r 5 d e sc r ib e s th e S P IC E fu n c tio n a lity in th e sm a ll-s ig n a l freq u en cy d om a in .
T h e A C m od e an a ly s is ty p e s , su ch a s th e freq u en cy sw eep , n o ise , a n d d is to r tio n an a l-
y se s , a re in tro d u ced b y m ean s o f b o th lin e a r an d n o n lin e a r c ircu it e x am p le s .
C h ap te r 6 p re sen ts th e tim e -d om a in , o r tra n s ien t, s im u la tio n . In th e tim e -d om a in
an a ly s is m od e S P IC E com pu te s th e tran s ien t re sp o n se o f a c ircu it a n d th e h a rm on ic s
o f a s ig n a l. A t le a s t o n e w o rk ed -o u t c ircu it e x am p le is in c lu d ed fo r e a ch an a ly s is ty p e .
T h e re ad e r a cq u ire s th e b a s ic k n ow led g e o f u s in g S P IC E by th e en d o f th is ch ap te r .
C h ap te r 7 in tro d u ce s th e co n cep t o f fu n c tio n a l s im u la tio n . H ig h e r- le v e l ab s tra c -
tio n s an d h ie ra rch y can b e m od e led in S P IC E u s in g co n tro lle d so u rc e s an d su b -
c ircu it b lo ck s . L o g ic g a te s an d o p e ra tio n a l am p lif ie rs c an b e d e sc r ib ed u s in g th e
m ac ro -m od e lin g ap p ro ach . E x am p le s d em on s tra te th e com pac tn e ss an d e ff ic ie n cy
o f m ac ro -m od e lin g fo r o p am p c ircu its .
T h e la s t th re e ch ap te rs o f th e b o o k , C h ap s . 8 to 1 0 , a re in ten d ed fo r th e m o re ad -
v an ced u se r . T h e m a te r ia l p re sen ted in th e f irs t p a r t sh o u ld b e su ff ic ie n t fo r so lv in g m o s t
c ircu it p ro b lem s en co u n te red in u n d e rg rad u a te an d g rad u a te co u rse s . T h e re a re th re e
m a in to p ic s in th e se co n d h a lf , w h ich can b e b e s tu d ied in d ep en d en tly o f e a ch o th e r .
C h ap te r 8 co v e rs in som e d e ta il d is to r tio n an a ly s is , C h ap . 9 co n ta in s an ex p lan a tio n o f
th e so lu tio n te ch n iq u e s b u ilt in to S P IC E and th e an a ly s is o p tio n s th a t m ay b e n ece ssa ry
fo r so lv in g com p lex c ircu its , a n d C h ap . 1 0 u se s th e in fo rm a tio n in th e p rev io u s ch ap te r
to s te e r th e u se r o n h ow to en su re th e co n v e rg en ce o f S P IC E .
C h ap te r 8 o ffe rs an in -d ep th lo o k a t d is to r tio n an a ly s is . T h e d e ta ils o f sm a ll-s ig n a l
an d la rg e -s ig n a l d is to r tio n an a ly s is a re d e sc r ib ed w ith th e h e lp o f sev e ra l ex am p le s .
A b rie f o v e rv iew o f th e a lg o rithm s an d n um e ric a l m e th o d s u sed in S P IC E is p re -
sen ted in C h ap . 9 . T h e p u rp o se o f th is ch ap te r is to o ffe r som e in s ig h t in to th e in te rn a l
w o rk in g s o f S P IC E fo r th e u se r in te re s ted in tak in g ad v an tag e o f a ll th e av a ila b le an a l-
y s is co n tro ls o r o p tio n s , w h ich a re a lso d e sc r ib ed in th is ch ap te r . T h e m a in to p ic s a re
so lu tio n o f sp a rse lin e a r eq u a tio n s , ite ra tiv e so lu tio n o f n o n lin e a r eq u a tio n s an d co n v e r-
g en ce , an d n um e ric a l in teg ra tio n .
C h ap te r 1 0 , w h ich co n c lu d e s th is b o o k , is a p rim e r o n co n v e rg en ce an d th e a c tio n s
a u se r c an tak e to o v e rcom e D C and tim e -d om a in co n v e rg en ce p ro b lem s . S o lu tio n s to
X PREFACE
convergence problems are offered using initialization, analysis options, and nonlinear
model parameters. The importance of understanding the operation of the circuit and the
limitations of the models used is emphasized for obtaining accurate results.
Five appendixes are included at the end of the book. The first contains the complete
equations for the semiconductor devices and the full list of model parameters. The sec-
ond appendix lists the most common error messages of SPICE2 and provides guidance
on corrective action. The error messages included are common to most SPICE versions,
although the exact wording may differ. Appendix C summarizes all the SPICE state-
ments introduced in this book. Appendix D contains the Gear integration formulas of
orders 2 to 6. The last Appendix contains a sample SPICE deck of a circuit that requests
most analyses supported by SPICE2.
This book is a result of my association with Professor D. O. Pederson, who has
guided me during my academic studies as well as during my professional activity. I
acknowledge Judy Lee for the graphic design and the presentation of the schematics
and the simulation results. I also acknowledge the review and comments contributed
by Dr. Constantin Bulucea in addition to the valuable comments made by the following
reviewers for John Wiley and Sons: Kenneth Martin, UCLA; Richard Dort, University
of California at Davis; Ron Rohrer, Carnegie Mellon University; Norb Malik, Univer-
sity of Iowa; Bruce Wooley, Stanford University; Darrell L. Vines, Texas Tech Uni-
versity; James R. Roland, University of Kansas; David Drury, University of Wiscon-
sin, Platteville; Robert Strattan, University of Oklahoma; John O'Malley, University
of Florida, Gainesville; Gordon L. Carpenter, California State University, Long Beach;
and Elliot Slutsky, Cal Poly, Pomona.
Together with colleagues and customers of Daisy Systems, Analog Design Tools,
Valid, and Cadence, as well as University of California-Berkeley students, they have
contributed to the material covered in this book.
October 1993 Andrei Vladimirescu
CONTENTS
Introduction
SPICE-THE THIRD DECADE 1
1.1 THE EARLY DAYS OF SPICE
1.2" SPICE IN THE 19705
i.3 SPICE IN THE 19805
1.4 SPICE IN THE 19905
1.5 CONCLUSION
REFERENCES
I.
~,', I
1
2
4
7
8
9
Chapter One
INTRODUCTION TO ELECTRICAL COMPUTER
SIMULATION
1.1 PURPOSE OF COMPUTER SIMULATION OF ELECTRICAL
CIRCUITS
1.2 WHAT IS SPICE?
1.3 USER INTERACTION WITH SPICE AND THE COMPUTER
1.3.1 Electric C ircuit Specification-The SPICE Input
1.3.2 SPICE Simulation, DC Analysis .
1.3.3 SPICE Results for AC and TRAN Analyses
1.4 SUMMARY
REFERENCES
12
12
14
17
18
22
28
36
37
XI
xii CONTENTS
Chapter Two
CIRCUIT ELEMENT AND NETWORK DESCRIPTION
2 .1 E L E M E N T S , M O D E L S , N O D E S , A N D C O N V E N T IO N S
2 .2 TW O -T E R M IN A L E L E M E N T S
2.2.1 Resistors
2.2.2 Semiconductor Resistors (SPICE3)
2.2.3 Capacitors
2.2.4 Semiconductor Capacitor (SPICE3)
2.2.5 Inductors
2.2.6 Independent Bias and Signal Sources
2.2.6.1 Pulse Function
2.2.6.2 Sinusoidal Function
2.2.6.3 Frequency-Modulated Sinusoidal Function
2.2.6.4 Exponential Function
2.2.6.5 Piecewise Linear Function
2 .3 M U L T IT E R M IN A L E L E M E N T S
2.3.1 Coupled (Mutual) Inductors
2.3.2 Dependent (Controlled) Sources
2.3.2.1 Voltage-Controlled Current Source (VCCS)
2.3.2.2 Voltage-Controlled Voltage Source (VCVS)
2.3.2.3 Current-Controlled Current Source (CCCS)
2.3.2.4 Current-Controlled Voltage Source (CCVS)
2.3.3 Switches
2.3.4 Transmission Lines
2 .4 S U M M A R Y
R E F E R E N C E S
Chapter Three
SEMICONDUCTOR-DEVICE ELEMENTS
38
38
39
40
4 1
42
44
45
46
48
50
5 1
5 3
5 4
56
56
58
6 1
62
63
64
65
68
7 1
72
7 3
3 .1 IN T R O D U C T IO N 7 3
3 .2 D IO D E S 7 5
3 .3 B IP O L A R J U N C T IO N T R A N S IS T O R S 7 8
3.3.1 DC Model 7 9
3.3.2 Dynamic and Small-Signal Models 83
3.3.3 Model Parameters 86
3 .4 J U N C T IO N F IE L D E F F E C TT R A N S IS T O R S (J F E T s ) 9 6
3 .5 M E T A L -O X ID E -S E M IC O N D U C T O R F IE L D E F F E C TT R A N S IS T O R S (M O S F E T s ) 1 0 1
3.5.1 DC Model 1 0 2
3.5.2 Dynamic and Small-Signal Models 1 0 3
3.5.3 Model Parameters 1 0 8
CONTENTS xiii
3 .6 METAL -SEM ICONDUCTOR F IE LD EFFECTTRANS ISTORS (M ESFETs) 109
3 .7 SUMMARY 112
REFERENCES 113
Chapter Four
DC ANALYSIS 114
4 .1 ANALYS IS O VERV IEW 114
4 .1 .1 S im u la tion M odes and Ana lys is T ypes 114
4 .1 .2 R esu lt P rocess ing and O u tpu t V a riab les 115
4 .1 .3 Ana lys is P a ram e te rs : T em pe ra tu re 116
4 .2 O PERAT ING (B IAS ) PO IN T 117
4 .3 DC TRANSFER CURVES 125
4 .4 SM ALL -S IG NAL TRANSFER FUNCT ION 129
4 .5 SENS IT IV ITY ANALYS IS 133
4 .6 NODE VO LTAGE IN IT IA L IZAT IO N 136
4 .7 SUMMARY 139
REFERENCES 140
Chapter Five
AC ANALYSIS 141
5 .1 IN TRODUCT ION 141
5 .2 AC FREQUENCY SW EEP - 142
5 .3 NO ISE ANALYS IS 149
5 .4 D ISTORT ION ANALYS IS 157
5 .5 PO LE -ZERO ANALYS IS 164
5 .6 SUMMARY 165
REFERENCES 167
Chapter Six
TIME-DOMAIN ANALYSIS168
6 .1 ANALYS IS DESCR IPT IO N 168
6 .2 TRANS IENT ANALYS IS - 169
xiv CONTENTS
6.3 INITIAL CONDITIONS
6.4 FOURIER ANALYSIS
6.5 SUMMARY
REFERENCES
Chapter Seven
FUNCTIONAL AND HIERARCHICAL SIMULATION
7.1 HIGH-LEVEl CIRCUIT DESCRIPTION
7.2 SPICESUBCIRCUIT AND CIRCUIT HIERARCHY
7.2.1 . SUBCKT Definition
7.2.2 Subcircuit Instance
7.2.3 C ircuit H ierarchy
7.3 IDEAL MODElS
7.3.1 Operational Ampl ifiers
7.3.2 Logic Gates and D igita l C ircuits
7.4 FUNCTIONAL MODElS
704.1 Nonlinear (Arbitrary-Function) Controlled Sources in SPICE3
704.2 Analog Function Blocks
704.3 Digita l Function Blocks
70404 Equation Solution
7.5 MACRO-MODElS
7.5.1 The Opamp Macro-Model
7.6 SUMMARY
REFERENCES
Chapter fight
DISTORTION ANALYSIS
8.1 DISTORTION IN SEMICONDUCTOR CIRCUITS
8.2 SMAll-SIGNAL DISTORTION ANALYSIS
8.2.1 H igh-Frequency D istortion
8.2.2 D istortion in a One-Transistor Amplifier
8.3 LARGE-SIGNAL DISTORTION ANALYSIS
8.3.1 One-Transistor Amplifier D istortion
8.3.2 S ingle-Device M ixer Analysis
8.4 SUMMARY
REFERENCES
180
184
191
192
193
193
194
194
195
195
204
205
209
213
213
215
223
224
227
228
239
240
241
241
241
242
244
263
263
265
276
277
Top Related