Transcript Lecture 1

CSE245: Computer-Aided Circuit
Simulation and Verification
Lecture 1: Introduction and Formulation
Winter 2015
Chung-Kuan Cheng
Administration
• CK Cheng, CSE 2130, tel. 858 534-6184, [email protected]
• Lectures: 5:00 ~ 6:20pm TTH CSE2217,
• Grading
– Homework: 60%
– Project Presentation: 20%
– Final Report: 20%
References
• 1. Electronic Circuit and System Simulation Methods, T.L. Pillage,
R.A. Rohrer, C. Visweswariah, McGraw-Hill, 1998
• 2. Interconnect Analysis and Synthesis, CK Cheng, J. Lillis, S.Lin
and N. Chang, John Wiley, 2000
• 3. Computer-Aided Analysis of Electronic Circuits, L.O. Chua and
P.M. Lin, Prentice Hall, 1975
• 4. A Friendly Introduction to Numerical Analysis, B. Bradie,
Pearson/Prentice Hall, 2005,
http://www.pcs.cnu.edu/~bbradie/textbookanswers.html
• 5. Numerical Recipes: The Art of Scientific Computing, Third
Edition, W.H. Press, S.A. Teukolsky, W.T. Vetterling, and B.P.
Flannery, Cambridge University Press, 2007.
• 6. Numerical Algorithms, Justin Solomon.
CSE245: Course Outline
1. Introduction
2. Problem Formulations: basic elements, circuit topology,
network regularization
3. Linear Circuits: matrix solvers, explicit and implicit
integrations, matrix exponential methods, convergence
4. Nonlinear Systems: Newton-Raphson method, Nesterov
methods, homotopy methods
5. Sensitivity Analysis: direct method, adjoint network
approach
6. Various Simulation Approaches: FDM, FEM, BEM,
FFT, multipole methods, Monte Carlo, random walks
7. Multiple Dimensional Analysis: Tensor decomposition
8. Applications: power distribution networks, IO circuits,
full wave analysis
Motivation: Analysis
• Energy: Fission, Fusion, Fossil Energy,
Efficiency Optimization
• Astrophysics: Dark energy, Nucleosynthesis
• Climate: Pollution, Weather Prediction
• Biology: Microbial life
• Socioeconomic Modeling: Global scale
modeling
Nonlinear Systems, ODE, PDE, Heterogeneous
Systems, Multiscale Analysis.
Motivation: Analysis
Exascale Calculation: 1018, Parallel Processing
at 20MW
• 10 Petaflops 2012
• 100 PF 2017
• 1000 PF 2022
Motivation: Analysis
• Modeling: Inputs, outputs, system models.
• Simulation: Time domain, frequency domain,
wavelet simulation.
• Sensitivity Calculation: Optimization
• Uncertainty Quantification: Derivation with
partial information or variations
• User Interface: Data mining, visualization.
Motivation: Circuit Analysis
• Why
– Whole Circuit Analysis, Interconnect Dominance
• What
– Power, Clock, Interconnect Coupling
• Where
–
–
–
–
Matrix Solvers, Integration Methods
RLC Reduction, Transmission Lines, S Parameters
Parallel Processing
Thermal, Mechanical, Biological Analysis
Circuit Simulation: Overview
stimulant generation
netlist extraction, modeling
Circuit
Input and setup
Simulator:
Solve
Complexity
Accuracy
Debug
numerically
Output
frequency & time
domain simulation
user interface: worst
cases, eye diagrams,
noises
Circuit Simulation
Circuit
Input and setup
Simulator:
Solve
f (X )  C
dX (t )
dt
Output
numerically
dX (t )
f (X )  C
 GX (t )  BU (t )
dt
Y  DX (t )  FU (t )
Types of analysis:
– DC Analysis
– DC Transfer curves
– Transient Analysis
– AC Analysis, Noise, Distortions, Sensitivity
Program Structure (a closer look)
Models
Input and setup
Numerical Techniques:
– Formulation of circuit equations
– Solution of ordinary differential equations
– Solution of nonlinear equations
– Solution of linear equations
Output
Lecture 1: Formulation
•
•
•
•
Basic Elements
KCL/KVL and Topology
Sparse Tableau Analysis (IBM)
Nodal Analysis, Modified Nodal Analysis
(SPICE)
*some slides borrowed from Berkeley EE219 Course
Basic Elements
• Two terminal elements
• Multiple port elements
Resistors: i=i(v) or v=v(i), e.g. i=v/R
Capacitors: q=q(v)
Inductors: 𝝓= 𝝓(i)
Sources:
Basic Elements: capacitors
•
Basic Elements: capacitors
Basic Elements: capacitors
Basic Elements: inductors
Basic Elements: inductors
Basic Elements: inductors
Basic Elements: inductors
Basic Elements: Summary
For the simulation of two terminal elements, we
can convert capacitors and inductors to resistors
via Euler or trapezoidal integration. The
conversion leaves two variables and one
constraint.
When the element is nonlinear, we need to
watch out the slope of the device and the
conservation of the charge or flux.
Use examples of nonlinear and time varying
capacitors to illustrate the formula of charge
conservation.
Branch Constitutive Equations
(BCE)
Ideal elements
Element
Branch Eqn
Variable parameter
Resistor
v = R·i
v, i
Capacitor
i = C·dv/dt
dv/dt, i
Inductor
v = L·di/dt
v, di/dt
Voltage Source
v = vs
i=?
Current Source
i = is
v=?
VCVS
vs = AV · vc
i=?
VCCS
is = GT · vc
v=?
CCVS
vs = RT · ic
i=?
CCCS
is = AI · ic
v=?
Conservation Laws
• Determined by the topology of the circuit
• Kirchhoff’s Current Law (KCL): The algebraic
sum of all the currents flowing out of (or into) any circuit
node is zero.
– No Current Source Cut
• Kirchhoff’s Voltage Law (KVL): Every circuit
node has a unique voltage with respect to the reference node.
The voltage across a branch vb is equal to the difference
between the positive and negative referenced voltages of the
nodes on which it is incident
– No voltage source loop
Conservation Laws: Topology
A circuit (V, E) can be decomposed into a spanning tree
and links. The tree has n-1 (n=|V|) trunks, and m-n+1
(m=|E|) links.
• A spanning tree that spans the nodes of the circuit.
– Trunk of the tree: voltages of the trunks are
independent. Check the case that the spanning tree
does not exist!
• Link that forms a loop with tree trunks
– Link: currents of the links are independent. Check
the case that the link does not exist!
Thus, a circuit can be represented by n-1 trunk voltage
and m-n+1 link currents.
Formulation of Circuit Equations
• Unknowns
– B branch currents (i)
– N node voltages
(e)
– B branch voltages (v)
• Equations
– N+B Conservation Laws
– B Constitutive Equations
• 2B+N equations, 2B+N unknowns => unique solution
Equation Formulation - KCL
R3
1
R1
2
R4
G2v3
0
Law:
State Equation:
Ai=0
N equations
Node 1:
Node 2:
 i1 
i 
2
1 1 1 0 0    0
0 0  1 1  1 i3   0

   
i4 
Branches
i5 
Kirchhoff’s Current Law (KCL)
Is5
Equation Formulation - KVL
R3
1
R1
2
Is5
R4
G2v3
0
Law:
v
- AT
State Equation:
e=0
B equations
 v1  1 0 
0 
v  1 0 
0 
2
  
e   
v3   1  1  1   0
  
 e2   
v4  0 1 
0 
v5  0  1
0
vi = voltage across branch i
ei = voltage at node i
Kirchhoff’s Voltage Law (KVL)
Equation Formulation - BCE
R3
1
R1
Law:
K v v + K ii = i s
B equations
2
R4
G2v3
State Equation:
 1
 R
 1
 0
 0


 0

 0
0
0
0
0
0
0
0
0
0  G2
1
0 
R3
0
0

Is5
1
R4
0

0
v
i
0
  1   1   
0 v
i2   0 
2


0 v3   i3    0 
 v4  i4   0 
0 v  i  i 
  5   5   s5 
0
Equation Formulation
Node-Branch Incidence Matrix A
branches
1 2 3
n
o 1
d 2
e
s i
j
(+1, -1, 0)
N
{
Aij =
+1 if node i is + terminal of branch j
-1 if node i is - terminal of branch j
0 if node i is not connected to branch j
B
Equation Assembly (Stamping
Procedures)
• Different ways of combining Conservation
Laws and Branch Constitutive Equations
– Sparse Table Analysis (STA)
– Nodal Analysis (NA)
– Modified Nodal Analysis (MNA)
Sparse Tableau Analysis (STA)
1. Write KCL:
2. Write KVL:
3. Write BCE:
Ai=0
v - ATe=0
Kii + Kvv=S
0 i  0
A 0
 0 I  AT  v    0 

   
 K i K v
0  e S 
Sparse Tableau
(N eqns)
(B eqns)
(B eqns)
N+2B eqns
N+2B unknowns
N = # nodes
B = # branches
Sparse Tableau Analysis (STA)
Advantages
• It can be applied to any circuit
• Eqns can be assembled directly from input data
• Coefficient Matrix is very sparse
Disadvantages
• Sophisticated programming techniques and data
structures are required for time and memory
efficiency
Nodal Analysis (NA)
Use vector e as the only variables. Assume no voltage source
1. Write KCL
Ai=0
(N equations, B unknowns)
2. Use BCE to relate branch currents to branch
voltages
i=f(v)
(B equations  B unknowns)
3. Use KVL to relate branch voltages to node voltages
v=h(e)
(B equations  N unknowns)
Yne=ins
Nodal Matrix
N eqns
N unknowns
N = # nodes
Nodal Analysis - Example
R3
1
R1
1. KCL:
2. BCE:
3. KVL:
Yne = ins
Yn = AKvAT
Ins = Ais
2
Is5
R4
G2v3
0
Ai=0
Kvv + i = is  i = is - Kvv  A Kvv = A is
v = ATe  A KvATe = A is
1
1

G

2
R
R3
 1
1



R3
1
R3   e1   0 
    
1
1  e2  is 5 

R3 R4 
 G2 
Nodal Analysis
• Example shows how NA may be derived from
STA
• Better Method: Yn may be obtained by direct
inspection (stamping procedure)
– Each element has an associated stamp
– Yn is the composition of all the elements’ stamps
Nodal Analysis – Resistor
“Stamp”
Spice input format:
N+
Rk
N-
Rk
N+
i
1
N+ 
 R
 k
 1
N-  R
 k
N+ NN-
1
 
Rk

1 
Rk 
Rkvalue
What if a resistor is
connected to ground?
….
Only contributes to the
diagonal
1
 iothers  R eN   eN     is
k
KCL at node N+
1
 iothers  R eN   eN     is
k
KCL at node N-
Nodal Analysis – VCCS “Stamp”
Spice input format:
NC+
i
i
others
others
N+ N- NC+ NC-
Gkvalue
N+
+
vc
NC-
Gk
NC+
N+  G
k
 G
k
N- 
Gkvc
 Gk eNC   eNC     is
 Gk eNC   eNC     is
NKCL at node N+
KCL at node N-
NC-
 Gk 
Gk 
Nodal Analysis – Current source
“Stamp”
Spice input format:
Ik
N+ N- Ikvalue
N+
N+ N-
N+ 
Ik
N-

N- 
  I k 
 I 
  k 
Nodal Analysis (NA)
Advantages
• Yn is often diagonally dominant and symmetric
• Eqns can be assembled directly from input data
• Yn has non-zero diagonal entries
• Yn is sparse (not as sparse as STA) and smaller than
STA: NxN compared to (N+2B)x(N+2B)
Limitations
• Conserved quantity must be a function of node
variable
– Cannot handle floating voltage sources, VCVS, CCCS,
CCVS. How do we handle the current variable?
– Hint: No cut of currents
Modified Nodal Analysis (MNA)
How do we deal with independent voltage sources?
+
Ekl
-
l
k
ikl

k 

l 



1
1
   
1  ek   
   
    
 1  el   
   
   
0  ikl   Ekl 
• ikl cannot be explicitly expressed in terms of node
voltages  it has to be added as unknown (new column)
• ek and el are not independent variables anymore  a
constraint has to be added (new row)
MNA – Voltage Source “Stamp”
Spice input format: Vk
+
Ek
N+
-
Nik
N+ N-
Ekvalue
N+ N- ik
N+ 0
0 1
N- 0 0 -1
Branch k 1 -1 0
RHS
0
0
 
 Ek 
Modified Nodal Analysis (MNA)
How do we deal with independent voltage sources?
Augmented nodal matrix
Yn
C

B  e 
 MS



0 i 
Some branch currents
In general B= -CT
Why?
Yn
C

B  e 
 MS



D  i 
MNA – General rules
• A branch current is always introduced as an
additional variable for a voltage source or an
inductor
• For current sources, resistors, conductors and
capacitors, the branch current is introduced
only if:
– Any circuit element depends on that branch current
– That branch current is requested as output
MNA – CCCS and CCVS
“Stamp”
MNA – An example
1
R1
+ v3 R3
2
-
R8
-
+
0
4
E7v3
Step 1: Write KCL
i1  i2  i3  0
 i3  i4  i5  i6  0
i6  i8  0
i7  i8  8
3
+
Is5
R4
G2v3
ES6
(1)
(2)
(3)
(4)
MNA – An example
Step 2: Use branch equations to eliminate as many branch currents
as possible
1
1
v1  G2v3  v3  0
R1
R3
(1)
1
1
v3  v4  i6  is 5
R3
R4
(2)

i6 
1
v8  0
R8
(3)
i7 
1
v8  0
R8
(4)
Step 3: Write down unused branch equations
v6  ES6
v7  E7 v3  0
(b6)
(b7)
MNA – An example
Step 4: Use KVL to eliminate branch voltages from previous
equations
1
1
e1  G2 (e1  e2 ) 
(e1  e2 )  0
R1
R3

1
1
(e1  e2 ) 
e 2  i6  i s 5
R3
R4
(1)
(2)
i6 
1
( e3  e 4 )  0
R8
(3)
i7 
1
( e3  e 4 )  0
R8
(4)
(e3  e2 )  ES 6
e4  E 7 (e1  e2 )  0
(b6)
(b7)
MNA – An example
Yn
C

B  e 
 MS



0 i 
1
1
  G2 
R3
 R1
1



R3


0



0


0

E7


1 

  G2  
R3 

1
1

R3 R4
0
0
0
0
1
1
R8
1

R8
1
 E7
0
0
0
1
R8
1
R8
0

1

0 0
e   0 
 1  

 1 0 e
i
 2   s5 
 e   0 
3
1 0    

 e4   0 
  

0 1  i6   ES 6
  i7   0 
0 0

0 0
MNA – An example
+ v3 R3
1
R1
2
Is5
R4
G2v3
ES6
-
3
+
+
R8
0
1
1

G


2
R
R3
 1
1



R3


0



0


0

E7


1 
  G2  
R3 

1
1

R3 R4
4
Ev
0
0
0
0
1
1
R8
1

R8
1
 E7
0
0
0
1
R8
1
R8
0

1
7 3

0 0
e   0 
 1  

 1 0 e
i
2
s
5
  

 e   0 
3
1 0    

 e4   0 
  

0 1  i6   ES 6
  i7   0 
0 0

0 0
Modified Nodal Analysis (MNA)
Advantages
• MNA can be applied to any circuit
• Eqns can be assembled directly from input data
• MNA matrix is close to Yn
Limitations
• Sometimes we have zeros on the main diagonal
Formulation: Summary
Ingredients
• Basic Elements
• Topology: Tree trunks and links
Formats
• STA, NA, MNA
Are there other formats?
• Use an example of link analysis.