First generation circuit simulation - SPICE and derivatives

Summary: Accurate circuit simulation technology is the very foundation of EDA and IC design. The modeling and simulation of circuits enables function and other operational characteristics to be obtained before committing the part to manufacture, let along before providing the part to the end orinted circuit board manufacturer. Circuit simulation software such as SPICE and its derivatives, though one of the longest-serving technologies, is as essential today as it was 30 years ago at its introduction - the number of simulations required before sign-off, can be in the few thousands, especially if employing monte carlo simulation techniques. Such computer simulation software isn't without limitations, however, and knowing where and how best to apply it requires experience, thought, and some expectations of exactly what your simulations will reveal. This first circuit simulation article introduces the first generation of circuit simulators; later articles will describe the evolution of Fast-SPICE, hierarchical SPICE, and other approaches that aim to increase performance, precision and capacity, bringing the full benefits of computer simulation to the neophyte and experienced user alike.

Introduction
Accurate circuit simulation technology is the very foundation of EDA and IC design. The modeling and simulation of circuits enables function and other operational characteristics to be obtained before committing the part to manufacture, let along before providing the part to the end orinted circuit board manufacturer. Circuit simulation software such as SPICE and its derivatives, though one of the longest-serving technologies, is as essential today as it was 30 years ago at its introduction - the number of simulations required before sign-off, can be in the few thousands, especially if employing monte carlo simulation techniques.

Such computer simulation software isn’t without limitations, however, and knowing where and how best to apply it requires experience, thought, and some expectations of exactly what your simulations will reveal. This first circuit simulation article introduces the first generation of circuit simulators; later articles will describe the evolution of Fast-SPICE, hierarchical SPICE, and other approaches that aim to increase performance, precision and capacity, bringing the full benefits of computer simulation to the neophyte and experienced user alike.

Typical Applications
SPICE is used to determine the function and operating characteristics of ICs or components before committing to manufacture the part. Precision analog components, such as high-performance (high gain or wide bandwitch) op-amps or fast data converters, simply couldn’t be efficiently realized without using accurate circuit simulation and analysis. Though not large in transistor count their analog nature and need for precise simulation make SPICE necessary.

Larger in transistor count, mixed-signal ICs and components require SPICE - perhaps in a mixed-mode A/M-S simulator - in order to correctly analyze the behavior of the analog devices. During design, a Fast-SPICE simulator may be used to quickly determine approximate or relative characteristics, but for final verification and release to manufacturing there is no substitute for the absolute accuracy SPICE offers.

Many digital designs are based on components verified using SPICE. Cell libraries, I/O cells, embedded memories, and IP blocks are all characterized with SPICE. Finally, during the final verification of even large designs containing many millions of transistors and hundreds of millions of parasitic passive components, SPICE is used to determine performance of extracted sub-sections of the design, typically along critical paths or in interfaces between analog and digital sections.

Strengths
The main benefit SPICE simulators offer over other analog circuit simulators is precision. Like any software tool manipulating abstracted models, SPICE introduces numerical errors of its own (see below) in addition to the errors injected during the model characterization process. These errors, though, tend to be smaller than those found when using other approaches, and any stability problems tend to expose themselves as easily-discovered gross errors.

Limitations
While SPICE offers superior precision, it can only do so for circuits of limited size. Circuits greater than 100k MOS devices already experience some degradation in performance, though of course there’s no hard and fast rule since it depends on performance of the CPU, memory, I/O and disk sub-systems as well as circuit characteristics.

Simulation performance depends on many factors, and attempting to explain them all in detail is futile. We can, however, give some relative performance indicators.

  1. The larger the circuit (measured in element count), the longer it will take to simulate. Run times for the same circuit pre-layout and post-layout (signal nets extracted only) can differ from 3X to 10X or more.
  2. The more time-points to be calculated, the longer the circuit will take to simulate. Increasing the duration or complexity of applied stimulus increases the number of time-points. Changing the integration method will change the number of time-points. Reducing the tolerance (increasing the accuracy) will increase the number of time-points. High dV/dt or dI/dt will increase the number of time points.
  3. Some circuit characteristics are naturally more computationally challenging to simulate. A tightly-coupled circuit (perhaps containing a clock or power grid) requires an enormous effort to compute every simulation time-point.

In general, at least to a first-level, circuit simulation performance is proportional to the number of circuit elements raised to the power of alpha, where:

  • For loosely-coupled pre-layout circuits (no meshes or grids), alpha is approximately 1.4 to 1.5
  • For loosely-coupled post-layout circuits (few coupling/floating capacitors only and no power grids), alpha is in the range of 1.5 to 1.7
  • For tightly-coupled post-layout circuits (many coupling capacitors and power distribution grids), alpha is in the range of 2.0

Another drawback of SPICE is that the same time step must be applied to the entire circuit, even though some - or a great deal - of it may remain inactive during much of the simulation interval.

Finally, convergence can be an issue for some classes of circuits, particularly sensitive or high-gain ones. This is purely an issue with numerical integration, worse for some integration methods than others (notably, Newton-Raphson). As circuits get larger and include more non-linear behavior, convergence has become more difficult.

Basic operation
SPICE and its derivatives take as input an ASCII netlist containing a list of circuit elements and their interconnections, and construct from this a series of nonlinear differential algebraic equations (in matrix form, a variant of [G][v]=[i]). Solutions employ implicit integration methods, Newton’s method (Isaac, not Richard - a little SPICE humour there), and various manipulations of the sparse circuit matrix.

Before transient or other analysis is performed, a stable DC operating point must be set - this can either be calculated by SPICE or given by the user. For a circuit containing no non-linear or charge-storage devices, is simply a matter of inverting the [G] matrix and solving [v]=[G]-1[i] in order to derive all circuit node voltages. Should the circuit contain non-linear devices, an initial estimate of the operating point is made and the node voltages computed with linear approximations for the non-linear models inserted. This technique is repeated until the solution converges - that is, node voltages and branch currents differ less than some defined (small) value on successive iterations.

Once a stable DC operating point has been found, SPICE can proceed to transient or other time-domain or frequency-domain analysis. We’ll consider only time-domain transient analysis here, since for most IC designers this is the most common usage mode. During transient analysis, SPICE attempts to compute an accurate approximation to the analytical solution for the given circuit at discrete time points using an implicit numerical integration method. Transient analysis pseudocode is given here, with additional information is contained in the notes below.

for each time-point between time=0 and time=TSTOP {
    using numerical integration, transform non-linear differential equations into algebraic equations
    guess initial node voltages
    converged = false
    while not converged {
        linearize non-linear diffeqs using Newton-Raphson
        solve equations
        if this solution differs from last solution by less than given tolerance {
            converged = true
        }
    }
}

Example SPICE and SPICE-like circuit simulators (not an exhaustive list)

In addition to other SPICE simulators available from academic and commercial sources, about a dozen semiconductor companies develop and maintain their own SPICE-derived or SPICE-like circuit simulators.

Notes
1. Circuit Elements include:

  • Passive components, e.g. resistors, capacitors, inductors (of fixed or controlled values)
  • Active components, e.g. MOS or bipolar transistors
  • Fixed or controlled voltage or current sources
  • Time-varying sources for circuit stimulus, e.g. sinusoids, or piecewise linear, generators

2. Matrix solution methods include:

  • Cramer’s rule - rarely used as it is terribly inefficient for matrices of even small to moderate size
  • Gaussian elimination or LU decomposition, with pivoting (to reduce instability)
  • Cholesky decomposition, for symmetric positive definite matrices
  • Stationary iterative methods, such as Jacobi and Gauss-Seidel
  • Other iterative methods - for example Krylov subspace methods, such as the conjugate gradient method

3. DC operating point convergence is determined when both of the following occur:

  1. Successive node voltage values differ by less than
    • The expected node voltage * RELTOL (default: 0.1%), plus
    • VNTOL (default: 1uV)
  2. Successive branch current values differ by less than
    • The expected branch current * RELTOL, plus
    • ABSTOL (default: 1pA)

    The number of iterations can be modified by the user, and once exceeded the simulator can apply Gmin or source stepping techniques to attempt to converge on a solution.

4. Integration methods used by circuit simulations can be chosen by the user to obtain the “best” results, as measured by the smallest error introduced (local truncation error or numerical noise), and the greatest stability (cancellation or reduction of error over time). Implicit integration methods are used because many circuit simulation problems are stiff in nature - the circuit contains vastly different time constants, and the time-step required to give accurate results under explicit integration methods would be impractical, resulting in very long run times. Possible implicit integration methods include:

  • Backward Euler - offers a good compromise of accuracy and stability
  • Trapezoidal - offers superior accuracy but can be too sensitive for some circuits and may induce oscillations in the solution
  • Gear (Gear-2 or Gear-3) - offers superior stability while trading off some accuracy (in Gear-2) or performance (in Gear-3)

Recommended and reference reading

The SPICE Book, by Andrei Vladimirescu

Inside Spice: Overcoming the Obstacles of Circuit Simulation, by Ron Kielkowski

Electronic Circuit & System Simulation Methods, by Larry Pillagi

Circuit Simulation Methods and Algorithms, by Jan Ogrodzki

Computer Methods for Circuit Analysis and Design, by JirĂ­ Vlach

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

If you want to leave a feedback to this post or to some other user´s comment, simply fill out the form below.

(required)

(required)