You are on page 1of 18

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.

Canavero, 2015

01OUXOQ, 01OUXOT, 01OUXOV, 01OUXPE

Advanced Design for Signal Integrity and


Compliance

3. SPICE Primer

Flavio Canavero
Politecnico di Torino, Italy
flavio.canavero@polito.it

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

The origins …
• 1960 ECAP (Electric Circuit Analysis
Program), by IBM
• 1971 CANCER, developed by Berkeley
University, California
• 1973 SPICE (Simulation Program with
Integrated Circuit Emphasis), new
development by Berkeley University,
California
• 1975 SPICE2 evolution of SPICE
• 1985 SPICE3 new version for CAD tools
developped by Berkeley University
2

1
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Modified Nodal Analysis

vn1 vn2

 
 G1  G 2   C dt
d d
 G2  C 1   v  G e  a  

dt
 n1 1 1 2 0 
0   v n 2     a 2  a 3     in ( v n 2 ) 
d d
  G2  C G2  C
 dt dt      
 d  iL   0   0 
1 0 L 
 dt 

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Modified Nodal Analysis

vn1 vn2
 d 
 G 1  G 0 w  J  F (w )
 dt 

Differential-algebraic nonlinear equations

2
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Element Stamps

 
 G1  G 2   C dt
d d
vn2  G2  C 1
  v  G e  a  
vn1 
dt
 n1 1 1 2 0 
0   v n 2     a 2  a 3     in ( v n 2 ) 
d d
  G2  C G2  C
     
 dt dt 
 d   iL   0   0 
1 0 L
 dt 

 d d   
 G2  G2 0   v n1  C 0
 C dt

dt
  n1 
v 0 0 1  v n1 
 G G2 0   v n 2   C
d d
0   v n 2 
 0 0 0 vn 2 
 d  
2 C
 dt dt  
 0 0 0   i L   0 0 0   i L  1 0  L   i L 
   dt 

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Parser Operation

R1 1 0 value ..
vn1 vn2 I1 0 1 value
L1 1 0 value
R2 1 2 value
C 1 2 value
..
 
 G1  G 2   C dt
d d
 G2  C 1   v  G e  a  

dt
  n1   1 1 2 0 
 
0  v n 2   a 2  a 3   in ( v n 2 ) 
d d
  G2  C G2  C
 dt dt      
 d  iL   0   0 
1 0 L 
 dt 

3
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Numerical solution: DC

 d 
 G 1  G 0 w  J  F (w )
 dt 
d
0
dt
DC analysis
G 0 w  J  F (w )

• Yields circuit operating point

• Solution via iterative methods for nl equations

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Numerical solution: AC
 d 
 G 1  G 0 w  J  F (w )
 dt 

Sinusoidal steady state analysis of linearised circuit


d
sinusoidal steady state,  j
dt
G 1 j W  G 0 W  J  F0  j F1 W

• Yields voltage and current phasors

• Solution via methods for linear algebraic problems

4
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Numerical solution: TRANSIENT

 d 
 G 1  G 0 w  J  F (w )
 dt 

• Numerical integration of nonlinear DAE

• Yields voltage and current transient waveforms

• Most important for signal integrity analysis

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Numerical integration
 d 
 G 1  G 0 w  J  F (w )
 dt 

time discretization (integration method)


 dx (t ) x (t )  x (t   T )
 dt  T

 x (t )  x ( k T )  x( k )

 x (t   T )  x (( k  1)  T )  x ( k 1)

G1
1
w ( k )  w ( k 1)   G 0 w ( k )  J  F ( w ( k ) )
T

10

5
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Numerical solution: TRANSIENT


iterative solution

G1
1
w ( k )  w ( k 1)   G 0 w ( k )  J  F ( w ( k ) )
T

 1  1
G 1  T  G 0  w ( k )  J  G 1  T w ( k 1)  F ( w ( k ) )
 

issues
• integration method properties
• time step (variable)
• convergence of nonlinear solution

11

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Basic SPICE Syntax


Title line

Setup, inclusions and libraries


(.OPTIONS .PARAMETER .INCLUDE .LIB )
Network description

Analysis and output commands


(.DC, .TRAN, .PRINT,...)

.END

• comment character: *

• continuation character: +

• variable definitions: associate reference directions, 1st terminal +

12

6
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Example
2 10 mH
1 1000  3

VS t  10 pF

VS t 
1V

0 .1 s time

13

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Test Program
Title line HAVING FUN
Setup, inclusions and
libraries

Network description VS 1 0 PWL(0 0 0.1U 1 10U 1)


RS 1 2 1000
LS 2 3 10M
CL 3 0 10P
Analysis and output .TRAN 0.1U 10U 0 0.1U
commands
.PROBE
.END .END
14

7
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

• Multiplier SPICE Symbol


9
10 giga  G
10 6 mega  MEG
10 3 kilo  K
10  3 milli  M
10  6 micro  U
10  9 nano  N
10 12 pico  P

15

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Circuit Description
• PSPICE writes the Node-Voltage equations of a
circuit:

V(N1,N2)
N1 N2
Element

V(N1) V(N2)

16

8
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Circuit Elements

17

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Circuit Elements

m o

L1 L2

n p

L1 m n value
L2 o p value
KXXX L1 L2 coupling coefficien t

M
coupling coefficien t 
L1 L2
18

9
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


Voltage

Vxxx n+ n- <DC=> dcval


Vxxx n+ n- <AC=mag, <phase>>
Vxxx n+ n- <tranfun>

19

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


Current

Iyyy n+ n- <DC=> dcval


Iyyy n+ n- <AC=mag, <phase>> <M=val>
Iyyy n+ n- <tranfun>

20

10
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


Vxxx n+ n- <tranfun>
Iyyy n+ n- <tranfun>

tranfun = Transient Source Function

–Square wave (PULSE)


–Dumped sinusoid (SIN)
–Piecewise Linear (PWL)
–Exponential (EXP)

21

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


Examples

* 5V DC voltage source
Va 1 0 5

* vcc DC voltage source


Vb 2 0 dc=vcc

* DC and AC voltage source


* 2V in DC operation
* 1V amplitude and 90° phase in AC
Vc 3 4 dc=2 ac=1,90

* PWL current source


Id 5 6 PWL(1mA 0s 5mA 25ms)

22

11
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


PULSE function
V1 1 0 pulse( V1 V2 TD TR TF PW PER)

V1=1v V2=2v TD=5ns TR=5ns TF=5ns


PW=20ns PER=60n

23

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


SIN function
V1 1 0 SIN (V0 VA FREQ DELAY THETA PHASE)

V0  V A e  ( t TD ) sin( 2 [ f ( t  TD )  ]) u ( t  TD )
360

V0=0 VA=1 FREQ=100MEG DELAY=2N THETA=5E7 PHASE=0

24

12
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: independent sources


PWL function

PWL <(>t1 v1 <t2 v2 t3 v3…>


+ <R <=repeat>> <TD=delay> <)>

Further examples

V1 1 0 PWL 60N 0V, 120N 0V, 130N 5V


+ 170N 5V, 180N 0V, R 0N

V2 2 0 PL 0V 60N, 0V 120N, 5V 130N


+ 5V 170N, 0V 180N, R 60N

25

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: controlled sources


i=G(v1)
generatore di corrente controllato in tensione
Gxxx n+ n- nc+ nc- value
i=F(i1)
generatore di tensione controllato in tensione
Exxx n+ n- nc+ nc- value

v=E(v1)
generatore di corrente controllato in corrente
Fxxx n+ n- vname value

v=H(i1) generatore di tensione controllato in corrente


Hxxx n+ n- vname value

26

13
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: SPICE3 controlled sources

All types !
BXXXXXXX N+ N- V=EXPR
BXXXXXXX N+ N- I=EXPR
Examples:
B1 0 1 I=cos(v(1))+sin(v(2))
B1 0 1 V=ln(cos(log(v(1,2)^2)))-
v(3)^4+v(2)^v(1)
B1 3 4 I=17
B1 3 4 V=exp(pi^i(vdd))

27

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements defined by Models


Diodo a giunzione
Dxxx n+ n- modelname
Transistor bipolare
Qxxx nc nb ne modelname
MOSFET
Mxxx nd ng ns modelname
MESFET, GASFET
Jxxx nd ng ns modelname

.MODEL modname modtype <keyword=value>

M1 nd ng ns MOSn L=1U W=20U


.MODEL MOSn NMOS LEVEL=1

28

14
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Elements: Subcircuit
instance
Xyyy n1 <n2 n3 ...> subname

definition
.SUBCKT subname n1 <n2 n3 …>
descrizione del sottocircuito
.ENDS <subname>

Example: (nearly) ideal operational amplifier


X1 1 2 3 OPAMPid
...
.SUBCKT OPAMPid n+ n- Nout
.PARAM GAIN=1e8
E1 Nout 0 n+ n- GAIN
.ENDS OPAMPid

29

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Transmission Line

N1 M1

Z C , TD

N2 M2

TXXX N1 N2 M1 M2 Z0  Z C TD  TD

30

15
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Analyses: DC
For operating points and (nonlinear) static characteristics

.DC srcname start stop incr


srcname = stepped DC source
start = start value of voltage swing
stop = final value of voltage swing
incr = amplitude of voltage steps

.D C V FR E D 1 10 2 .D C V FR E D 5 5 1

Examples: 1,3,5 , 7 ,9 V 5 V

31

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Analyses: AC

For
single fequency sinusoidal steady state analysis over a
specified frequency range (linear or linearised circuit only)

.AC type np fstart fstop

type
• DEC (decadi, np=numero di punti per decade)
• LIN (variazione lineare, np=numero di punti)
• ...
fstart fstop fequency range

Example: .AC DEC 50 1E6 100E6


32

16
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Analyses: TRAN
For
transient analysis on linear and nonlinear circuits

.TRAN TSTEP TSTOP <TSTART <TMAX>><UIC>

tstep = computed waveforms are saved as samples


with tstep pitch
tstart = computed waveforms are stored since tstart
tstop = integration is carried out from t=0 and tstoptst
tmax = step ceiling !

Example: .TRAN 0.1N 20N 0 0.1N

33

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Output (what do you want?) Statements

• Printout
 .PRINT DC V(Ni) I(RFRED)

 .PRINT AC VM(Ni) VP(Ni) IM(RFRED) IP(RFRED)

 .PRINT TRAN V(Ni) I(RFRED)

• Plotting Graphs
 .PROBE

34

17
01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

Looking for SPICE?


• Go to the List of free electronics circuit
simulators
http://en.wikipedia.org/wiki/List_of_free_electroni
cs_circuit_simulators
• The semiconductor manufacturer Linear
Technology (LTC) distributes for free LTspice
http://www.linear.com/designtools/software/#LTs
pice
• Cadence Design Systems, Inc. distributes a Lite /
student version of OrCAD technologies that
provides the Capture and PSpice tools
http://www.orcad.com/resources/orcad-
downloads#pspice
35

01OUX… - Advanced Design for Signal Integrity and Compliance.  F.Canavero, 2015

References
• C.R. Paul, Fundamentals of Electric Circuit
Analysis, John Wiley, NY, 2001.
• C.R. Paul, Introduction to Electromagnetic
Compatibility, 2nd ed., John Wiley Interscience,
Hoboken, NJ, 2006.
• P.W. Tuinenga, SPICE: A Guide to Simulation and
Analysis Using PSPICE, 3rd ed.,Prentice-Hall,
Englewood Cliffs, NJ, 1995.
• A. Vladimirescu, The SPICE Book, John Wiley,
NY, 1994.

36

18

You might also like