CSE 245: Computer Aided Circuit Simulation and Verification Winter 2003 Lecture 1: Formulation Instructor: Prof. Chung-Kuan Cheng Agenda RCL Network Sparse Tableau Analysis Modified Nodal Analysis Jan. 24, 2003 2 Cheng & Zhu, UCSD @ 2003 History of SPICE SPICE -- Simulation Program with Integrated Circuit Emphasis 1969, CANCER developed by Laurence Nagel on Prof. Ron Roher’s class 1970~1972, CANCER program May 1972, SPICE-I release July ’75, SPICE 2A, …, 2G Aug 1982, SPICE 3 (in C language) No new progress on software package since then Jan. 24, 2003 3 Cheng & Zhu, UCSD @ 2003 RCL circuit R L C Vs 1 v2 0 c 0 v2 0 0 l i 1 r i v 1 1 s 1 0 v v2 0 2 c vs i 1 r i1 1 l l l Jan. 24, 2003 4 Cheng & Zhu, UCSD @ 2003 RCL circuit (II) General Circuit Equation Y AY BU Consider homogeneous form first Y AY Y e Y0 At 2 2 and k k At A t At e I ... ... 1! 2! k! At Q: How to Compute Ak ? Jan. 24, 2003 5 Cheng & Zhu, UCSD @ 2003 Solving RCL Equation Assume A has non-degenerate eigenvalues 1 , 2 ,..., k and corresponding linearly independent eigenvectors 1 , 2 ,..., k , then A can be decomposed as 1 A 1 0 0 where 2 0 Jan. 24, 2003 0 and , ,..., 1 2 k k 6 Cheng & Zhu, UCSD @ 2003 Solving RCL Equation (II) What’s the implication then? 1 A 1 t e e At 1 2 1 A A 2 2 where e t To compute the eigenvalues: e 1 0 0 2 k e 0 e 2 0 det( I A) n cn 1n 1 ... c0 ( p0 )(2 p1 p2 )...(...) 0 real eigenvalue Jan. 24, 2003 Conjugative Complex eigenvalue 7 Cheng & Zhu, UCSD @ 2003 Solving RCL Equation (III) 0 In the previous example v2 e At X e 1/ l 0 i 1 1/ c t r / l v2 (0) i (0) 1 0 1 1 1 Let c=r=l=1, we have A 1 1 0 1 3 j 1 3 j 1 j 2 2 where 3 1 3 j 1 3 j 1 2 2 e 0 At 1 e hence 0 e Jan. 24, 2003 8 1 1 3 j 2 1 0 1 1 3 j 2 Cheng & Zhu, UCSD @ 2003 Solving RCL Equation (IV) What if matrix A has degenerated eigenvalues? Jordan decomposition ! 1 A J J is in the Jordan Canonical form And still Jan. 24, 2003 e At 1e Jt 9 Cheng & Zhu, UCSD @ 2003 Jordan Decomposition 1 J 0 t 1 0 1 e e Jt t 0 1 0 0 tet t e similarly 1 0 J 0 1 0 0 Jan. 24, 2003 t e 1 0 0 1 0 e Jt 0 1 0 0 1 t 0 0 0 0 1 0 0 10 te t e t 0 t 2 t e 2! tet e t Cheng & Zhu, UCSD @ 2003 Agenda RCL Network Sparse Tableau Analysis Modified Nodal Analysis Jan. 24, 2003 11 Cheng & Zhu, UCSD @ 2003 Equation Formulation KCL Converge of node current KVL Closure of loop voltage Brach equations I, R relations Jan. 24, 2003 12 Cheng & Zhu, UCSD @ 2003 Types of elements Resistor Capacitor dQ Q(v) dv dv i c (v ) dt v dt dt Inductor d (i ) di v dt i dt l (i ) di dt L is even dependent on frequency due to skin effect, etc… Controlled Sources VCVS, VCCS, CCVS, CCCS Jan. 24, 2003 13 Cheng & Zhu, UCSD @ 2003 Cut-set analysis 1 3 5 1. Construct a spanning tree 2. Take as much capacitor branches as tree branches as possible 2 4 6 3. Derive the fundamental cut-set, in which each cut truncates exactly one tree branch 4. Write KCL equations for each cut 5. Write KVL equations for each tree link 6. Write the constitution equation for each branch Jan. 24, 2003 14 Cheng & Zhu, UCSD @ 2003 KCL Formulation Ai 0 c12 c24 c34 c45 c46 i12 i13 i24 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 Jan. 24, 2003 i34 0 0 1 0 0 i35 i45 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 1 3 5 2 4 6 i12 i46 i56 i13 0 0 i24 0 0 i34 0 0 i35 0 1 i45 0 1 i 46 i56 15 #nodes-1 lines #braches columns Cheng & Zhu, UCSD @ 2003 KCL Formulation (II) Permute the columns to achieve a systematic form 1 ~ I|Ai 0 i12 i24 i34 i45 i46 i13 i23 c12 c24 c34 c45 c46 1 0 0 0 0 Jan. 24, 2003 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 0 1 1 0 i12 2 i56 i24 0 0 i34 0 0 i45 0 0 i46 0 1 i13 0 1 i23 i56 16 3 5 4 6 Cheng & Zhu, UCSD @ 2003 KVL Formulation AT e V 1 1 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 0 1 0 v12 v 0 13 v12 0 v24 v24 0 v34 v34 0 v35 v45 v 0 v46 45 v 1 46 1 v56 Remove the equations for tree braches and systemize 1 3 5 2 4 6 v12 v 24 v34 l13 1 1 1 0 0 1 0 0 v l35 0 0 1 1 0 0 1 0 45 0 v46 l56 0 0 0 1 1 0 0 1 v13 v 35 v56 BV 0 ~ B B Jan. 24, 2003 17 I Cheng & Zhu, UCSD @ 2003 Cut & Loop relation A e V BV 0 T In the previous example 1 1 ~ A 1 0 0 BA T 0 ~T ~ [ B I ][ IA] 0 ~T B A 0 ~T ~ B A Jan. 24, 2003 0 0 0 0 1 0 1 1 0 1 1 1 1 0 0 ~ B 0 0 1 1 0 0 0 0 1 1 18 Cheng & Zhu, UCSD @ 2003 Sparse Tableau Analysis (STA) n=#nodes, b=#branches b (n-1) KCL b KVL b branch relations A 0 K i b 0 I Kv n-1 0 i T A v 0 e 0 b 0 n-1 S b Due to independent sources Totally 2b+n-1 variables, 2b+n-1 equations Jan. 24, 2003 19 Cheng & Zhu, UCSD @ 2003 STA (II) Advantages Covers any circuit Easy to assemble Very sparse Ki, Kv, I each has exactly b non-zeros. A and AT each has at most 2b non-zeros. Disadvantages Sophisticated data structures & programming techniques Jan. 24, 2003 20 Cheng & Zhu, UCSD @ 2003 Agenda RCL Network Sparse Tableau Analysis Modified Nodal Analysis Jan. 24, 2003 21 Cheng & Zhu, UCSD @ 2003 Nodal Analysis Derivation From STA: (3) x Ki-1 (4) x A Using (a) e Ai 0 (1) v AT e (2) Kii Kvv S (3) 1 1 i K i K v v K i S (4) 1 1 Ai AK i K v v AK i S 1 T 1 AK i K v A e AK i S (5) (6) Tree trunk voltages Substitute with node voltages (to a given reference), we get the nodal analysis equations. Jan. 24, 2003 22 Cheng & Zhu, UCSD @ 2003 Nodal Analysis (II) 1 AK K v A e AKi S 1 i T 1 1 0 1 A 0 1 0 0 0 0 y12 K i1 y13 y24 y34 y35 y 45 Kv I y 46 y56 y12 y13 y 13 1 T AKi K v A e y13 Jan. 24, 2003 y13 y13 y24 y13 23 y13 y13 y13 y34 y35 y35 0 1 0 0 0 1 3 5 2 4 6 0 0 1 0 0 0 0 1 1 0 y35 y35 y45 y56 y56 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 v12 v 24 v34 y56 v45 y46 y56 v46 Cheng & Zhu, UCSD @ 2003 Modified Nodal Analysis General Form Independent current source Node Conductance matrix KCL Yn Y AT 2 2 A2 Vn J 2 Z 2 I 2 W2 Due to non-conductive elements Independent voltage source Yn can be easily derived Add extra rows/columns for each non-conductive elements using templates Jan. 24, 2003 24 Cheng & Zhu, UCSD @ 2003 1 3 2 4 5 MNA (II) Fill Yn matrix according to incidence matrix n1 A n2 n3 n4 n5 n6 i12 i13 i24 i34 i35 i45 i46 i56 1 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 6 Yn AYe A T Choose n6 as reference node y12 y13 y 12 Yn y13 0 0 Jan. 24, 2003 y12 y12 y 24 0 y 24 0 y13 0 y13 y34 y35 y34 y35 25 0 y 24 y34 y 24 y34 y 45 y 46 y 45 0 0 y35 y 45 y35 y 45 y56 Cheng & Zhu, UCSD @ 2003 MNA Templates Add to the right-hand side of the equation j Independent current source j i j j' ij ij j' j Independent voltage source vj ij vg j j' m 1 1 v j' ij 1 1 1 v g j' Jan. 24, 2003 26 Cheng & Zhu, UCSD @ 2003 MNA Templates (II) vj CCVS j ij CCCS k' j k j' Jan. 24, 2003 vk vk ' ij ik 1 j' 1 k 1 k' m 1 1 1 m 2 1 1 r ri j j' ij j k ik v j' 1 N N N c N c i j N N N c i j N c m 1 k' 27 1 1 1 1 Cheng & Zhu, UCSD @ 2003 MNA Templates (III) VCVS j v j v j ' vk vk ' ik 1 j j' 1 k k' m 1 1 1 k + vj ik v j - VCCS j' k j k vj + vj k k' g mv j - j' Jan. 24, 2003 gm g m v j' gm g m k' 28 Cheng & Zhu, UCSD @ 2003 MNA Templates (IV) Mutual inductance j i1 M v j v j ' vk vk ' i2 j 1 1 j ' k ' k m 1 1 1 jL1 m 2 1 1 jM k + + vj vk - L1 L2 j' k - ' Operational Amplifier j j' Jan. 24, 2003 i i1 vj v j' m 1 1 1 j j' k k' k k' 29 vk vk ' i2 1 1 jM jL2 i 1 1 Cheng & Zhu, UCSD @ 2003 MNA Example 4 C4 G2 n1 G3 n3 n2 C5 vg n4 + n1 v7 = v6 v6 n2 2 1 _ n3 3 5 ig n0 6 n4 7 i vcvs n0 Circuit Topology MNA Equations Jan. 24, 2003 G2 G 2 0 0 1 0 G2 0 0 G2 G3 jC4 G3 jC 4 G3 G3 jC5 0 jC4 0 jC 4 0 0 0 0 1 30 1 0 vn1 0 0 0 vn 2 0 0 0 v n 3 0 0 1 vn 4 0 0 0 i g v g 0 0 ivcvs 0 Cheng & Zhu, UCSD @ 2003 MNA Summary Advantages Covers any circuits Can be assembled directly from input data. Matrix form is close to Yn Disadvantages We may have zeros on the main diagonal. Principle minors could be singular Jan. 24, 2003 31 Cheng & Zhu, UCSD @ 2003