Achieving Accurate Results With a Circuit Simulator. Ken Kundert and Ian Clifford Cadence Design Systems Analog Division San Jose, Calif 95134

Similar documents
Accurate Fourier Analysis for Circuit Simulators

Electronic Circuits Summary

ECE 546 Lecture 16 MNA and SPICE

ENGR 2405 Chapter 8. Second Order Circuits

ECE 497 JS Lecture - 11 Modeling Devices for SI

PURPOSE: See suggested breadboard configuration on following page!

Chapter 3. Steady-State Equivalent Circuit Modeling, Losses, and Efficiency

E40M Review - Part 1

DEPARTMENT OF COMPUTER ENGINEERING UNIVERSITY OF LAHORE

Switched-Capacitor Circuits David Johns and Ken Martin University of Toronto

CGDg% C,g% C GS=- AaQG

20.2 Design Example: Countdown Timer

Basics of Network Theory (Part-I)

Quiescent Steady State (DC) Analysis The Newton-Raphson Method

Numerical Algorithms for ODEs/DAEs (Transient Analysis)

To find the step response of an RC circuit

Introduction to AC Circuits (Capacitors and Inductors)

Reliable CAD Analyses of CMOS Radio Frequency and Microwave Circuits Using Smoothed Gate Capacitance Models

MOSFET Capacitance Model

Design of Analog Integrated Circuits

Homework Assignment 09

Basic. Theory. ircuit. Charles A. Desoer. Ernest S. Kuh. and. McGraw-Hill Book Company

Chapter 10 Sinusoidal Steady State Analysis Chapter Objectives:

Determining the Existence of DC Operating Points in Circuits

Energy Storage Elements: Capacitors and Inductors

Lab #4 Capacitors and Inductors. Capacitor Transient and Steady State Response

Topic 4. The CMOS Inverter

Electric Circuits. Overview. Hani Mehrpouyan,

Chapter 28. Direct Current Circuits

Lecture 12: MOSFET Devices

Operational amplifiers (Op amps)

0 t < 0 1 t 1. u(t) =

Lecture 320 Improved Open-Loop Comparators and Latches (3/28/10) Page 320-1

APPLICATION TO TRANSIENT ANALYSIS OF ELECTRICAL CIRCUITS

ELEC 250: LINEAR CIRCUITS I COURSE OVERHEADS. These overheads are adapted from the Elec 250 Course Pack developed by Dr. Fayez Guibaly.

A capacitor is a device that stores electric charge (memory devices). A capacitor is a device that stores energy E = Q2 2C = CV 2

The equivalent model of a certain op amp is shown in the figure given below, where R 1 = 2.8 MΩ, R 2 = 39 Ω, and A =

Chapter 10 Feedback. PART C: Stability and Compensation

EE 321 Analog Electronics, Fall 2013 Homework #3 solution

ECE2262 Electric Circuits. Chapter 4: Operational Amplifier (OP-AMP) Circuits

EIT Review. Electrical Circuits DC Circuits. Lecturer: Russ Tatro. Presented by Tau Beta Pi The Engineering Honor Society 10/3/2006 1

QUESTION BANK SUBJECT: NETWORK ANALYSIS (10ES34)

(3), where V is the peak value of the tank voltage in the LC circuit. 2 The inductor energy is: E.l= LI 2

R. W. Erickson. Department of Electrical, Computer, and Energy Engineering University of Colorado, Boulder

Lecture 17 Date:

RC Studies Relaxation Oscillator

Response of Second-Order Systems

Introduction to CMOS RF Integrated Circuits Design

U1 is zero based because its noninverting terminal is connected to circuit common. Therefore, the circuit reference voltage is 0 V.

Solutions to these tests are available online in some places (but not all explanations are good)...

Homework Assignment 08

Texas A & M University Department of Mechanical Engineering MEEN 364 Dynamic Systems and Controls Dr. Alexander G. Parlos

Index. Index. More information. in this web service Cambridge University Press

analyse and design a range of sine-wave oscillators understand the design of multivibrators.

Feedback Basics. David M. Auslander Mechanical Engineering University of California at Berkeley. copyright 1998, D.M. Auslander

E40M Capacitors. M. Horowitz, J. Plummer, R. Howe

Section 4. Nonlinear Circuits

MOS Transistors. Prof. Krishna Saraswat. Department of Electrical Engineering Stanford University Stanford, CA

Whereas the diode was a 1-junction device, the transistor contains two junctions. This leads to two possibilities:

CS 436 HCI Technology Basic Electricity/Electronics Review

2.004 Dynamics and Control II Spring 2008

Circuits with Capacitor and Inductor

Mod. Sim. Dyn. Sys. Amplifiers page 1

Frequency Response Prof. Ali M. Niknejad Prof. Rikky Muller

Lab 1 Getting Started with EDA Tools

ECE 205: Intro Elec & Electr Circuits

Knowledge Integration Module 1 Fall 2016

Operational amplifiers (Op amps)

Chapter 7 Direct-Current Circuits

Lecture 4: CMOS Transistor Theory

Mod. Sim. Dyn. Sys. Amplifiers page 1

EE115C Digital Electronic Circuits Homework #4

OPERATIONAL AMPLIFIER APPLICATIONS

ELECTRONICS. EE 42/100 Lecture 2: Charge, Current, Voltage, and Circuits. Revised 1/18/2012 (9:04PM) Prof. Ali M. Niknejad

RC Circuits. Equipment: Capstone with 850 interface, RLC circuit board, 2 voltage sensors (no alligator clips), 3 leads V C = 1

Robert W. Brodersen EECS140 Analog Circuit Design

ECE2262 Electric Circuits. Chapter 6: Capacitance and Inductance

CIRCUITS AND ELECTRONICS. Dependent Sources and Amplifiers

Capacitors. Chapter How capacitors work Inside a capacitor

Resonant Tunnel Diode (RTD) Stability

Module 24: Outline. Expt. 8: Part 2:Undriven RLC Circuits

Direct-Current Circuits. Physics 231 Lecture 6-1

Physics 116A Notes Fall 2004

EE105 Fall 2014 Microelectronic Devices and Circuits

EE100Su08 Lecture #9 (July 16 th 2008)

Electric Currents. Resistors (Chapters 27-28)

Chapter 13 Small-Signal Modeling and Linear Amplification

Notes for course EE1.1 Circuit Analysis TOPIC 10 2-PORT CIRCUITS

UNIT 4 DC EQUIVALENT CIRCUIT AND NETWORK THEOREMS

Inductance, Inductors, RL Circuits & RC Circuits, LC, and RLC Circuits

Lecture 23: Negative Resistance Osc, Differential Osc, and VCOs

A CAPACITIVE ACCELEROMETER MODEL

Electric Circuit Theory

Chapter 11 AC and DC Equivalent Circuit Modeling of the Discontinuous Conduction Mode

Consider the following generalized simple circuit

Operational Amplifiers

ELEC 3908, Physical Electronics, Lecture 13. Diode Small Signal Modeling

KLU and PSS Analysis Implementations into NGSPICE

Stability and Frequency Compensation

6.012 Electronic Devices and Circuits

Transcription:

Achieving Accurate Results With a Circuit Simulator Ken Kundert and Ian Clifford Cadence Design Systems Analog Division San Jose, Calif 95134 1

Outline Solving Nonlinear Systems of Equations Convergence Issues Solving Ordinary Differential Equations Models Examples Circuit Issues 2

Newton s Method A iterative methods for solving nonlinear algebraic systems of equations. Newton s method is used in the DC analysis, and at each step of a transient analysis. 3

Nodal Analysis 1 R3 2 I1 D2 D4 R5 Write Kirchhoff s Current Law I 1 + I s (e V 1 V T 1) + V 1 V 2 R 3 = 0 V 2 V 1 R 3 Or f(v) =0. + I s (e V2 V T 1) + V 2 R 3 = 0 We need to find v =[V 1,V 2 ] such that f(v) =[f 1 (v),f 2 (v)] = 0 4

f(v) Newton s Method Cannot solve nonlinear equations directly. So guess a starting point, linearize, solve linear system, and iterate. Algorithm for finding ˆv such that f(ˆv) =0: Step 0: Initialize set k 0 choose v (0) f(v) v f(v (0)) v Step 1: Linearize about v (k) J f (v (k) )= f(v(k) ) v where J f is the Jacobian of f. Step 2: Solve the linearized system v (k+1) v (k) J 1 f (v (k) )f(v (k) ) v v (0) df(v ) dv v (1) (0) v Step 3: Iterate set k k +1 if not converged, go to step 1. f(v) f(v (0)) f(v (1)) v f(v (2)) v v v (2) (1) (0) v 5

Newton Convergence Criteria The Newton-Raphson algorithm is used to solve the large systems of nonlinear equations that result when performing DC and transient analyses. It is an iterative algorithm that terminates when the convergence criteria are satisfied. The accuracy of the final solution is determined by the convergence criteria. Newton s Method: Solve f(v) = 0 by iterating v (k) = v (k 1) df (v(k 1) ) f(v (k 1) ) dx until the following criteria are satisfied. SPICE v (k) n v (k 1) n < RELTOL max( v (k), v (k 1) ) + VNTOL n f nj (v (k) ) f nj (v (k 1) ) < RELTOL max( f nj (v (k) ), f nj (v (k 1) ) )+ ABSTOL n Spectre v (k) n v (k 1) n < RELTOL max( v (k), v (k 1) ) + VNTOL f n (v (k) ) < RELTOL max( f nj (v (k) ) )+ABSTOL j Since SPICE does not verify KCL, it is subject to false convergence. Unlike Spectre, SPICE never actually verifies that Kirchoff s current law (KCL) is satisfied. This can result in false convergence, which occurs when the iteration is terminated prematurely withkclfarfrombeing satisfied because progress on one iteration is slow. In the above, k is the iteration index, n is the node index, and j is the branch index for node n. n n 6

Selecting Newton Convergence Tolerances RELTOL relative Newton tolerance Primary means of controlling accuracy In general, if you need more accuracy, tighten RELTOL. Controls how well KCL is satisfied, and sets how well truncation error is controlled. ABSTOL absolute Newton tolerance for current ABSTOL is called iabstol in Spectre. Tighten if you are interested in very small currents Loosen if your circuit exhibits very large currents VNTOL absolute Newton tolerance for voltage VNTOL is called vabstol in Spectre. Tighten if you are interested in very small voltages Loosen if your circuit exhibits very large voltages 7

Remedies for DC Accuracy Problems Assume computed solution is correct Circuit may have unanticipated problems Debug circuit as if on lab bench Circuit may have multiple solutions Use NODESET to select solution Check topology Check models Check component values Check power supplies Tighten RELTOL Check GMIN 8

Outline Solving Nonlinear Systems of Equations Convergence Issues Requirements for Convergence Nodesets Continuation Methods Suggestions Solving Ordinary Differential Equations Models Examples Circuit Issues 9

Newton s Method will Always Converge if... f(v) and its derivatives are continuous. Solutions must be isolated (J f (ˆv) is nonsingular). Initial guess v (0) is sufficiently close to solution ˆv. The last condition is the hardest to satisfy. 10

Nodesets Allows user to provide a good initial guess. Nodesets can be used in both DC and transient analyses. Nodesets do not change the solutions of the circuit. However, if the circuit has multiple solutions, nodesets may change the solution that the simulator finds. How SPICE forces nodesets Step 1: Force all set nodes with voltage source in series with 1Ω resistor. Compute DC solution with set nodes forced. Step 2: Delete forcing circuits and compute DC solution using results from step 1 as starting point. 11

Continuation Methods Used to compute a good initial guess. Write the circuit equations in the form f(v(λ),λ)=0 and choose λ as a natural or contrived parameter of you circuit such that For λ = 0, the solution v(0) is known in advance or is easy to find. For λ =1,f(v(1), 1) = f(v). v(λ) is a continuous function of λ. f( ) Procedure: Slowly step λ from0to1computingv(λ) ateverystep.usev(λ k ) as the initial guess of the solution v(λ k+1 ). If λ k+1 λ k is small, and if v(λ) is continuous, then v(λ k ) will be in the region of convergence for v(λ k+1 ) and so convergence will be guaranteed. Examples: Source Stepping, GMIN Stepping, and Pseudo-Transient 12

Why Continuation Methods Fail Folds plague source stepping and GMIN stepping. f( ) Oscillations plague pseudo-transient. f( ) Bifurcations result from symmetry. f( ) Vcc Q Q 13

Reasons for DC Convergence Problems Fundamentally a hard problem. Degenerate circuit. Unreasonable parameter values. Excessively tight tolerances Errors in model equations. 14

Remedies for DC Convergence Problems Heed warnings Check topology Check component parameter values Avoid small floating resistors Use 0-volt voltage source as current probe Avoid small parasitic resistors Do not set R Bmin 0onBJT Use Nodesets to give estimate of solution Loosen Tolerances (particularly ABSTOL) Enable continuation methods Set ITL6 in SPICE Simplify models Try to eliminate second-order effects and parasitic resistors (especially nonlinear base resistors. Use the simplified circuit to generate a nodeset file for the original circuit. Disable oscillators and use transient analysis As a last resort, Spectre used a pseudo-transient analysis to compute the DC solution. This analysis will not find the DC solution if the circuit oscillates. 15

Reasons for Transient Convergence Problems Instantaneous jumps in signal value Jumps are generally caused by local positive feedback on nodes without capacitors. Circuits that can exhibit jumps include latches, Schmitt triggers, and relaxation oscillators. Errors in device charge models 16

Remedies for Transient Convergence Problems Avoid simplified models Use a complete capacitance model Specify nonzero output conductance Specify overlap capacitors Specify nonzero source and drain areas for all MOSFETs This results in the junction capacitors being modeled. Identify which node is having difficulties, and add a small capacitor from that node to ground. With Spectre, set CMIN nonzero. CMIN causes Spectre to add small capacitors from every node in the circuit to ground. 17

Outline Solving Nonlinear Systems of Equations Convergence Issues Solving Ordinary Differential Equations Integration Methods Truncation Error Initial Conditions Suggestions Models Examples Circuit Issues 18

Transient Analysis Formulate equations using Nodal Analysis i(v(t)) + d dt q(v(t)) = 0 v(0) = v 0 Where i is current exiting the nodes from resistors. q is current exiting the nodes from capacitors. Example: C v(t)+ v(t) R = 0 v(0) = v 0 R v C In general, it is not possible to solve explicitly a nonlinear ordinary differential equation. Approach: Replace d dt operator by discrete-time approximation. 19

Integration Methods Multistep Methods: Form discrete time approximation to d dt by assuming trajectory is a low order polynomial. Assume time is discretized uniformly and that h = t k+1 t k Backward Euler (Linear Polynomial One Step) v(t k+1 )= 1 h (v(t k+1) v(t k )) Trapezoidal Rule (Quadratic Polynomial One Step) v(t k+1 )= 2 h (v(t k+1) v(t k )) v(t k ) Second-order Gear (Quadratic Polynomial Two Step) v(t k+1 )= 1 3 h 2 v(t k+1) 2v(t k )+ 1 2 v(t k 1) Example: Applying backward Euler to circuit equations: q(v(t k+1 )) q(v(t k )) + hi(v(t k+1 )) = 0 v(t 0 ) = v 0 20

Trapezoidal-Rule Rings Trapezoidal Rule: 5.0 4.5 4.0 3.5 3.0 2.5 2.0 1.5 1.0 0.5 0.0 0us 50us 100us 150us Point-to-point ringing is an artifact of the trapezoidal rule, switch to Gear to avoid it. 21

Gear Damps Apply various integration methods to lossless linear LC oscillator. Trapezoidal Rule: 1.0V 0.5V 0.0V -0.5V -1.0V 0s 20s 40s 60s 80s 100s Gear s Second-Order Backward-Difference Formula: 1.0V 0.5V 0.0V -0.5V -1.0V 0s 20s 40s 60s 80s 100s Backward Euler: 1.0V 0.5V 0.0V -0.5V -1.0V 0s 20s 40s 60s 80s 100s Artificial numerical damping is an artifact of Gear and backward-euler, switch to trapezoidal to avoid it. 22

Truncation Error Definitions: Truncation Error: Error made by replacing time-differentiation operator with its discrete-time approximation. In general, the smaller the time step, the smaller the truncation error. Local Truncation Error (LTE): The truncation error made at a single step assuming all previous steps are accurate. Global Truncation Error: Maximum accumulated truncation error. Related to accumulated LTE and the tendency of the circuit to accumulate or dissipate errors. In general, it is difficult to estimate global truncation error, so LTE is used to control the time step. 23

Circuit Determines How Errors Accumulate Use superposition to consider effect of error separately. Assume i represents error current injected by not satisfying KCL exactly. Example 1 RC Circuit v I(t) v(t) I R C t n t t n t I(t) v(t) Example 2 C Circuit t n t t n t v I(t) v(t) I C t n t t n t I(t) v(t) t n t t n t 24

Local-Truncation Error Integration method is exact if trajectory is low-order polynomial. Thus, LTE is proportional to difference between actual trajectory and low-order polynomial. V(t ) k-3 V(t k-1 ) LTE V(t k-2 ) V(t k) Vpred The local truncation error (LTE) is the error made on each time-step that results from discretizing time. The local truncation error is the difference between the computed solution and the polynomial extrapolation from the previous few time-steps. Choose time step such that v(t k ) v pred (t k ) < LTE max ( t ) k 25

Charge-based Local-Truncation Error Criterion SPICE Controls Error in Charge q(v(t)) q(v pred (t)) < TRTOL[RELTOL q(v(t)) +CHGTOL] Use of CHGTOL results in SPICE ignoring large voltage errors on small capacitors. CHGTOL should be reduced as device capacitances decrease. 1.2 V 1.0 V 0.8 V 0.6 V 0.4 V 0.2 V 0.0 V 0 ns 100 ns 200 ns 300 ns 400 ns 500 ns 600 ns 605 mv 600 mv 595 mv 590 mv 585 mv 350 ns 400 ns 450 ns 500 ns 550 ns 600 ns 26

Voltage-based Local-Truncation Error Criterion Spectre Controls Error in Voltage v(t) v pred (t) < TRTOL[RELTOL v(t) + VNTOL] 1.2 V 1.0 V 0.8 V 0.6 V 0.4 V 0.2 V 0.0 V 0 ns 100 ns 200 ns 300 ns 400 ns 500 ns 600 ns 610 mv 605 mv 600 mv 595 mv 590 mv 350 ns 400 ns 450 ns 500 ns 550 ns 600 ns One can either control the local truncation error in charge or voltage. SPICE-based simulators control the error on the charge, hence the use of the cumbersome tolerance parameter CHGTOL. Controlling the charge error is not a good idea for two reasons. First, users are not interested in charge, and controlling charge error does not guarantee accurate voltages. Second, charge scales with the size of the nonlinear devices. Thus, CHGTOL should be reduced every time a new smaller semiconductor process is introduced. Instead, Spectre controls error on voltage, which gives more accurate answers and avoids the charge scaling problem. 27

Selecting Truncation Error Tolerances Truncation error tolerances only affect accuracy of transient analysis. All Newton convergence tolerances are also used as truncation error tolerances. In addition there are the following parameters. TRTOL relative truncation error tolerance TRTOL is equivalent to LTERATIO in Spectre. Sets acceptable truncation error relative to RELTOL Allows independent control of KCL and truncation errors. Do not set TRTOL < 2. In general, if you need more accuracy, tighten RELTOL. Tightening TRTOL is not a good idea because it causes the simulator to shrink the time step in order to accurately follow the errors that result from not completely converging the Newton iteration. Generally, TRTOL is used to allow the Newton criteria to be set much tighter than the truncation error criteria (this is useful when trying to reduce charge conservation error to negligible levels). Loosening TRTOL by the same factor that RELTOL is tightened results in the Newton convergence criteria being tightened while keeping the truncation error criteria the same. CHGTOL absolute charge tolerance Spectre has no equivalent to CHGTOL. Should be tightened as devices shrink. CHGTOL should be set such that roughly CHGTOL = VNTOL C min where C min is the smallest interesting capacitor in the circuit. If you are having problems with trapezoidal-rule ringing, tighten CHGTOL. TMAX maximum time step Use if simulator misses events or for onset of oscillation. Should not normally be used to control error because 1. Convergence criteria not affected. 2. Only shrinks large steps. In general, tightening RELTOL is a better way to control error than tightening TMAX. TMAX is a poor way to control error for several reasons. First, tightening TMAX does not tighten the Newton convergence criteria. Second, tightening TMAX only shrinks large time steps. Thus tightening TMAX only has an effect when signals are not moving much, and not when signals are moving rapidly. TMAX is the preferred way to control error if signals are very small compared to their DC levels. This happens during the build-up phase of an oscillation. In this situation, the signals are generally too small to produce enough truncation error to shrink the time-step. LVLTIM Time-step control method selection Can be used to disable truncation error time step control. 28

This is very dangerous and is not recommended! 29

Initial Conditions Used in a transient analysis to start the circuit from some point other than the DC solution. Initial conditions are used only in transient analysis. Initial conditions directly affect the computed results by changing the starting point. How SPICE forces initial conditions UIC: Set v(0) equal to initial condition and go. Any unspecified initial conditions are taken to be zero. No UIC: Force all nodes with initial conditions with voltage sources in series with 1Ω resistors. Compute DC solution with initial conditions forced. Set v(0) equal to result and go. 30

Remedies for Transient Accuracy Problems Check initial operating point. Check topology. Check models. Check component values. Check power supplies. Check stimulus waveforms. Tighten RELTOL. Check GMIN. If charge conservation problem, use charge-conserving models. If point-to-point ringing problem, use Gear s method. If excessive loss, use trapezoidal rule. If simulating an oscillator, set TMAX for 10-25 time steps per period. 31

Outline Solving Nonlinear Systems of Equations Convergence Issues Solving Ordinary Differential Equations Models MOS Models Charge Conservation in Models Examples Circuit Issues 32

Model Accuracy Spice Current Model Model Output Velocity Subthresh Impact Conductance Saturation Region Ionization MOS-1 poor none none no MOS-2 poor poor poor no MOS-3 poor poor poor no BSIM-1 poor okay okay no BSIM-2 good good good no Spectre Current Model Model Output Velocity Subthresh Impact Conductance Saturation Region Ionization MOS-1 poor none none yes MOS-2 poor poor poor yes MOS-3 poor poor poor yes BSIM-1 poor okay okay yes BSIM-2 good good good yes 33

Model Accuracy Spice Charge Models Charge Available Conserves Velocity Model In Model Charge Saturation Meyer MOS-1,2,3 no none Ward-Dutton MOS-2 yes good BSIM BSIM-1,2 yes good Spectre Charge Models Charge Available Conserves Velocity Model In Model Charge Saturation Modified-Meyer MOS-1,2,3, BSIM-1,2 yes none Yang-Chatterjee MOS-1,2,3, BSIM-1,2 yes good BSIM MOS-1,2,3, BSIM-1,2 yes good 34

Model Accuracy Model Minimum Feature Size Model Min Gate Min Gate Min Oxide Length Width Thickness MOS-1 10μm 10μm 60nm MOS-2 2μm 2μm 30nm MOS-3 0.8μm 2μm 20nm BSIM-1 0.8μm 1μm 20nm BSIM-2 0.2μm 1μm 5nm Spectre Model Evaluation Time Model MOS-1 MOS-2 MOS-3 BSIM-1 BSIM-2 Evaluation Time 0.44ms 1.4ms 0.58ms 0.59ms 0.93ms BSIM2 is the only commercially available MOS model suitable for very small feature size MOSFETs or MOSFETs used in analog circuits. 35

Charge Conservation Capacitance-Based Models Do not conserve charge because charge is computed from linearized model. q v(t2) C(v(t1)) q(t1) q(t2) v(t1) v C(v(t0)) Charge-Based Models q v(t2) q(t1) q(t2) v(t1) v 36

Outline Solving Nonlinear Systems of Equations Convergence Issues Solving Ordinary Differential Equations Models Examples Oscillator: Suffers from phase drift due to truncation error. AC-Coupled Comparator: Suffers from charge conservation problems. Sample and Hold: Suffers droop caused by GMIN. Circuit Issues 37

Lossless Linear LC Oscillator Example: Accuracy determined largely by circuit. Resonator stores energy without loss. Resonator also stores error without loss. Small amount of error accumulates at each step. Stimulus: 0.0 A -0.2 A -0.4 A -0.6 A -0.8 A -1.0 A 0.0 20.0 40.0 60.0 80.0 38

Correct Response: 30mV 20mV 10mV 0V -10mV -20mV -30mV 0s 20s 40s 60s 80s Simulated Response: 30mV 20mV 10mV 0V -10mV -20mV -30mV 0s 20s 40s 60s 80s 39

AC-Coupled Comparator with Non-Charge-Conserving Models zero zero zero out Stimulus: (Open switches at t=0) 3.0 V 2.0 V 1.0 V 0.0 V -1.0 V -2.0 V -3.0 V 0.0 ns 200.0 ns 400.0 ns 600.0 ns 800.0 ns Response Computed with Non-Charge Conserving Models: 3.0 V 2.0 V 1.0 V 0.0 V -1.0 V -2.0 V -3.0 V 0.0 ns 200.0 ns 400.0 ns 600.0 ns 800.0 ns 1. Non-charge conserving MOS switches inject a small amount of error charge at each time step. 2. Error charge is stored on interstage capacitors. 3. Amplifiers magnify error on capacitors. 40

AC-Coupled Comparator with Charge-Conserving Models Response Computed with Charge-Conserving Models: 3.0 V 2.0 V 1.0 V 0.0 V -1.0 V -2.0 V -3.0 V 0.0 ns 200.0 ns 400.0 ns 600.0 ns 800.0 ns Convergence Criteria: i(v n (j) ) i(v(j 1) n ) < RELTOL max( i(v n (j) ), i(v(j 1) n Response Computed with Charge-Conserving Models and Tight Tolerances: ) )+ABSTOL 3.0 V 2.0 V 1.0 V 0.0 V -1.0 V -2.0 V -3.0 V 0.0 ns 200.0 ns 400.0 ns 600.0 ns 800.0 ns 41

Sample and Hold Response Computed with GMIN = 10 12 and GMIN = 0: 2.5 V 2.4 V gmin=0 gmin=1e-12 2.3 V 2.2 V 2.1 V 2.0 V 1.9 V 1.8 V 1.7 V 1.6 V 1.5 V 0.0 us 10.0 us 20.0 us 30.0 us 40.0 us 50.0 us 60.0 us Zoom-in to compute drift: 150 uv gmin=0 gmin=1e-12 100 uv 50 uv 0 uv 45.0 us 50.0 us 55.0 us 60.0 us With GMIN, drift is 8.5 V/s, without GMIN, drift is 0. 42

How SPICE installs GMIN: 43

Outline Solving Nonlinear Systems of Equations Convergence Issues Solving Ordinary Differential Equations Models Examples Circuit Issues Oscillators Op-Amp Loop Gain Measurements 44

Oscillators Tighten RELTOL High-Q resonators store energy and error for long periods. Since oscillators accumulate phase error, is is a good idea to simulate oscillators with the RELTOL set tigher than you normally use on other circuits. Use initial conditions to start oscillation Oscillators do not start themselves. Initial conditions better than sources: Less error prone. Does not require modification of circuit. Use initial conditions to start an oscillator rather than an impulse stimulus. Initial conditions will more reliably start an oscillator without unexpected side effects. Set the maximum time step (TMAX) to accurately follow start-up. When simulating the start-up phase of the oscillation, the signals are so small that they are ignored by the time-step control algorithm and the time-step is not chosen small enough to accurately follow the signals. Generally TMAX should be set so that there are at least 10-25 time steps per period. 45

Op-Amp Loop Gain in a out where fb a = open loop gain f = feedback factor T = af = loop gain 1 A = = closed loop gain 1+T Conceptually, to measure loop gain, you break the loop at fb. Difficulties: 1. You must not change the operating point. 2. You must account for loading. f 46

Measuring Voltage Loop Gain V in v p v n fb + - a v o v f f Procedure: 1. Insert floating voltage source with 0 DC value and unity AC magnitude at point fb. 2. Set AC magnitude of input source to 0. 3. Measure voltage loop gain as: T v = v f v n Vin Z n v p v n + - a v o Vt Z f v f f T = T v if Z n Z f 47

Measuring Current Loop Gain I in fb + - a f Procedure: 1. Insert grounded current source with 0 DC value and unity AC magnitude at point fb. 2. Set AC magnitude of input source to 0. 3. Measure current loop gain as: T i = i f i n ip I in Z n It + - in a i f Z f f T = T i if Z n Z f 48

Computing Total Loop Gain If T T v because Z n Z f, and T T i because Z n Z f,use T = T vt i 1 2+T v + T i This equation becomes inaccurate if T 1. 49