# Computer-Aided Circuit Simulation and Verification - Computer .ppt by handongqp

VIEWS: 43 PAGES: 37

• pg 1
```									CSE245: Computer-Aided Circuit
Simulation and Verification

Spring 2006
Chung-Kuan Cheng
•   CK Cheng, CSE 2130, tel. 534-6184, ckcheng@ucsd.edu
•   Lectures: 9:30am ~ 10:50am TTH U413A 2
•   Office Hours: 11:00am ~ 11:50am TTH CSE2130
•   Textbooks
Electronic Circuit and System Simulation Methods
T.L. Pillage, R.A. Rohrer, C. Visweswariah, McGraw-Hill
Interconnect Analysis and Synthesis
CK Cheng, J. Lillis, S. Lin, N. Chang, John Wiley & Sons
• TA: Vincent Peng (hepeng@cs.ucsd.edu), Rui Shi
(rshi@cs.ucsd.edu)
Outlines
1. Formulation (2-3 lectures)
2. Linear System (3-4 lectures)
3. Matrix Solver (3-4 lectures)
4. Integration (3-4 lectures)
5. Non-linear System (2-3 lectures)
6. Transmission Lines, S Parameters (2-3 lectures)
7. Sensitivity
8. Mechanical, Thermal, Bio Analysis
• Homeworks and Projects: 60
• Project Presentation: 20%
• Final Report: 20%
Motivation
• 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
Input and setup            Circuit

Simulator:
Solve CdX/dt=f(X) numerically

Output           CdX(t)/dt=GX(t)+BU(t)
Types of analysis:               Y=DX(t)+FU(t)
–   DC Analysis
–   DC Transfer curves
–   Transient Analysis
–   AC Analysis, Noise, Distortions, Sensitivity
Program Structure (a closer look)
Input and setup                      Models

Numerical Techniques:
–Formulation of circuit equations
–Solution of ordinary differential equations
–Solution of nonlinear equations
–Solution of linear equations

Output
CSE245: Course Outline
• Formulation
–   RLC Linear, Nonlinear Components,Transistors, Diodes
–   Incident Matrix
–   Nodal Analysis, Modified Nodal Analysis
–   K Matrix
• Linear System
–   S domain analysis, Impulse Response
–   Taylor’s expansion
–   Moments, Passivity, Stability, Realizability
–   Symbolic analysis, Y-Delta, BDD analysis
• Matrix Solver
– LU, KLU, reordering
– Mutigrid, PCG, GMRES
CSE245: Course Outline (Cont’)
• Integration
–   Forward Euler, Backward Euler, Trapezoidal Rule
–   Explicit and Implicit Method, Prediction and Correction
–   Equivalent Circuit
–   Errors: Local error, Local Truncation Error, Global Error
–   A-Stable
–   Alternating Direction Implicit Method
• Nonlinear System
– Newton Raphson, Line Search
• Transmission Line, S-Parameter
– FDTD: equivalent circuit, convolution
– Frequency dependent components
• Sensitivity
• Mechanical, Thermal, Bio Analysis
Lecture 1: Formulation
• KCL/KVL
• Sparse Tableau Analysis
• Nodal Analysis, Modified Nodal Analysis

*some slides borrowed from Berkeley EE219 Course
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
Branch Constitutive Equations
(BCE)
Ideal elements
Element          Branch Eqn
Resistor         v = R·i
Capacitor        i = C·dv/dt
Inductor         v = L·di/dt
Voltage Source   v = vs, i = ?
Current Source   i = i s, 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 Voltage Law (KVL): Every circuit
node has a unique voltage with respect to the reference node.
The voltage across a branch eb is equal to the difference
between the positive and negative referenced voltages of the
nodes on which it is incident
– No voltage source loop

• 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
Equation Formulation - KCL
R3
1                  2

R1                                      R4         Is5
G2v3

0

 i1 
i 
1 1 1 0 0    0
2

0 0  1 1  1 i3   0        Ai=0      N equations
              i   
 4
i5 
 

Kirchhoff’s Current Law (KCL)
Equation Formulation - KVL
R3
1                    2

R1                                               R4           Is5
G2v3

0

 v1  1 0            0 
v  1 0              0 
 2         e   
v3   1  1  1   0         v - AT e = 0   B equations
            e        
 v4  0 1   2  0 
v5  0  1
                    0 
 

Kirchhoff’s Voltage Law (KVL)
Equation Formulation - BCE
R3
1                                2

R1                                                     R4             Is5
G2v3

0
 1                        
 R   0   0        0     0
 1   1   
v       i        0
 1
 0    0  G2       0     0 v  i   0 
 0                           2  2                  Kvv + i = is B equations
0 v3   i3    0 
1
      0           0           
R3
                           v4  i4   0 
 0                  1
0   0             0 v  i  i 
                   R4       5   5   s5 
 0
      0   0        0     0

Equation Formulation
Node-Branch Incidence Matrix
branches
n      1 2 3           j                   B
o 1
d 2
e
s i                 (+1, -1, 0)

N

{
+1 if node i is terminal + of branch j
Aij =   -1 if node i is terminal - of branch j
0 if node i is not connected to branch j
Equation Assembly (Stamping
Procedures)
• Different ways of combining Conservation
Laws and Constitutive Equations
– Sparse Table Analysis (STA)
– Modified Nodal Analysis (MNA)
Sparse Tableau Analysis (STA)
1. Write KCL:              Ai=0              (N eqns)
2. Write KVL:              v -ATe=0          (B eqns)
3. Write BCE:              Kii + Kvv=S       (B eqns)

A      0        0 i  0
0      I       AT  v    0 
N+2B eqns
                               N+2B unknowns
Ki
      Kv        0  e   S 
   
N = # nodes
B = # branches
Sparse Tableau
Sparse Tableau Analysis (STA)
• It can be applied to any circuit
• Eqns can be assembled directly from input data
• Coefficient Matrix is very sparse

Problem
Sophisticated programming techniques and data
structures are required for time and memory
efficiency
Nodal Analysis (NA)
1. Write KCL
A·i=0         (N eqns, B unknowns)
2. Use BCE to relate branch currents to branch
voltages
i=f(v)        (B unknowns  B unknowns)
3. Use KVL to relate branch voltages to node voltages
4. v=h(e)        (B unknowns  N unknowns)

N eqns
Yne=ins                   N unknowns

Nodal Matrix                      N = # nodes
Nodal Analysis - Example
R3
1                        2

R1                                           R4    Is5
G2v3

0
1. KCL:         Ai=0
2. BCE:         Kvv + i = is  i = is - Kvv  A Kvv = A is
3. KVL:         v = ATe  A KvATe = A is

1         1           1                          Yne = ins
 R  G2  R     G2  
R3  e1   0 
 1         3
    
      1         1    1  e2  is 5 
              

      R3        R3 R4 
Nodal Analysis
• Example shows NA may be derived from STA

• Better: 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:           Rk     N+ N-     Rkvalue

N+                          N+      N-
What if a resistor is
N+ 
1          1
Rk          i          R                 connected to ground?
Rk                ….
 k                 Only contributes to the
 1        1 
N-  R         Rk             diagonal
N-                      k             

 iothers  R eN   eN     is
1
KCL at node N+
k

 iothers  R eN   eN     is
1
KCL at node N-
k
Nodal Analysis – VCCS “Stamp”
Spice input format:             Gk       N+ N- NC+ NC-           Gkvalue

NC+                 +
N+
NC+    NC-
vc
N+  G
k       Gk 
Gkvc                     G       Gk 
N-    k          
NC-                 -                       N-

i
others    Gk eNC   eNC     is    KCL at node N+
i
others    Gk eNC   eNC     is    KCL at node N-
Nodal Analysis – Current source
“Stamp”
Spice input format:    Ik     N+ N- Ikvalue

N+
N+ N-
N+            I k 
Ik                           I 
N-            k 
N-
Nodal Analysis (NA)
• 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
Modified Nodal Analysis (MNA)
How do we deal with independent voltage sources?

Ekl                                 
+         -        k             1  ek   
   
k             l                             
                    
ikl            l               1  el   
                   
                   

   1   1    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   N+ N-    Ekvalue

Ek                     N+ N- ik    RHS
+        -
N+        N-             N+ 0 0 1      0
0
N- 0 0 -1
ik                                 
Branch k 1 -1 0      Ek 
 
Modified Nodal Analysis (MNA)
How do we deal with independent voltage sources?
Augmented nodal matrix

Yn     B e
C          i   MS
       0  

Some branch currents          In general:

Yn     B  e
C          i   MS
       D  
MNA – General rules
• A branch current is always introduced as and
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
+ v3 -
ES6
1            R3   2              -         +        3

R1                                   R4   Is5                 R8
G2v3                         -         +
0                                 4
E7v3

Step 1: Write KCL
i1 + i2 + i3 = 0                                                  (1)
-i3 + i4 - i5 - i6 = 0                                            (2)
i6 + i8 = 0                                                       (3)
i7 – i8 = 0                                                       (4)
MNA – An example
Step 2: Use branch equations to eliminate as many branch currents
as possible
1/R1·v1 + G2 ·v3 + 1/R3·v3 = 0                            (1)
- 1/R3·v3 + 1/R4·v4 - i6 = is5
(2)
i6 + 1/R8·v8 = 0                                          (3)
i7 – 1/R8·v8 = 0                                          (4)

Step 3: Write down unused branch equations
v6 = ES6                                                  (b6)
v7 – E7·v3 = 0
(b7)
MNA – An example
Step 4: Use KVL to eliminate branch voltages from previous
equations
1/R1·e1 + G2·(e1-e2) + 1/R3·(e1-e2) = 0                  (1)
- 1/R3·(e1-e2) + 1/R4·e2 - i6 = is5                      (2)
i6 + 1/R8·(e3-e4) = 0                                    (3)
i7 – 1/R8·(e3-e4) = 0                                    (4)
(e3-e2) = ES6                                            (b6)
e4 – E7·(e1-e2) = 0                                      (b7)
MNA – An example
1          1            1                        
     G2         G2  
             0         0   0 0
 R1        R3          R3 
                       e   0 
        1           1   1                           1  
     
R3

R3 R4
0         0    1 0 e
  2   is 5 

                                                    e   0 
                                 1     1
       1 0    
3
0             0                                             
                                R8     R8           e4   0 
                                  1   1                        
       0             0                       0 1  i6   ES 6
                                 R8   R8             i7   0 
           
       0            1           1    0       0 0
                                                   
      E7            E7          0    1      0 0

Yn     B e
C          i   MS
       0  
Modified Nodal Analysis (MNA)