C1124 of 30
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C11 · Lesson 24 · Circuit simulation with SPICE

What a simulator computes, and when to trust it

Every circuit in this course's sims is solved the way SPICE solves circuits: nodal equations, Newton's method for the nonlinear parts, and adaptive time steps for the transient. A simulator checks a design before anything is built, but it answers exactly the question it's asked, with exactly the models it's given. An AC sweep is a linearization that will happily show a 100 V output from a 5 V amplifier; a transient run with too coarse a time step misses a glitch; a model with the wrong saturation current puts a transistor in the wrong region. Knowing what each analysis computes is how you tell a real result from an artifact.

  • An RC low-pass, analyzed two ways at once: the scope runs a transient analysis of a 1 kHz sine, and the Bode plot runs an AC analysis from 10 Hz to 1 MHz.
  • Move R or C: the AC sweep's corner moves, and the transient output's size and lag change to match the AC answer at 1 kHz.
  • The AC analysis is small-signal: it would give the same shape for a 1 mV or a 1000 V input. Only the transient analysis respects nonlinearity and limits.

Predict

An AC analysis is run on an amplifier powered from ±5 V with a gain of 100 and a 1 V input. What output does it report?

Name it

Kinds of analysis

AnalysisComputesUse for
operating point (.op)DC node voltages and currents, nonlinear devices solvedbias checks; always run first
DC sweep (.dc)the operating point as a source or parameter variestransfer curves
AC (.ac)small-signal gain and phase, linearized at the operating pointfrequency response, stability
transient (.tran)the full nonlinear response over timewaveforms, clipping, switching, startup
noise, Monte Carlo, worst casenoise spectra; spread over part tolerancesperformance and yield

How it solves

Nonlinear circuits are solved by Newton's method: linearize every device at a guess, solve, repeat. Near the answer the error roughly squares each iteration, so convergence is fast once close. When it fails ("no convergence"), simulators fall back on gmin stepping (adding small conductances) and source stepping (ramping the supplies). Transient analysis advances in steps sized by an error estimate; to resolve a signal at f with N points per cycle, steps must be about 1/(Nf) or smaller.

Trusting results

  • Check the operating point before anything else: a transistor in the wrong region invalidates every other analysis.
  • A model is only as good as its parameters: manufacturer models, measured if possible.
  • Results that look too good (perfect matching, infinite bandwidth) usually mean a part was left ideal.
  • Monte Carlo runs the circuit many times with parts drawn from their tolerance distributions; the fraction that meets the spec estimates the yield. With Gaussian spreads, a spec at ±kσ passes a fraction erf(k/2): 95.4% at 2σ, 99.73% at 3σ.

Worked example

Newton's method starts with an error of 0.1 V, and the error squares each iteration. How many iterations to reach 10⁻⁸ V?

Show the solution
  1. Square the error each iteration. 0.1→0.01→10−4→10−8 That's three iterations.
  2. Compare with halving. That's quadratic convergence; a method that only halved the error would need 24.

Answer three iterations.

Worked example

A Monte Carlo run shows an output with a Gaussian spread; the spec is the mean ± 3σ. What yield should production expect?

Show the solution
  1. Yield within ±3σ. erf(3/2)=99.73% or 2.7 failures per thousand.
  2. A tighter spec. Tightening the spec to ±2σ would fail 4.6%.

Answer a yield of 99.73%, or 2.7 failures per thousand.

Worked example

A circuit's output varies with a Gaussian spread. What yield should production expect if the specification is the mean ± 2σ, and ± 3σ?

Show the solution
  1. Fraction within ±kσ. erf⁡(k/2)
  2. At 2σ and 3σ. erf⁡(2/2)=95.45%erf⁡(3/2)=99.73%
  3. In parts per million. Out of specification that's 45,500 and 2,700.
  4. Why aim higher. A 3σ design still fails a few thousand units per million, which is why high-volume products aim for 4σ to 6σ.

Answer 95.45% for ±2σ and 99.73% for ±3σ.

Check

A transient run must show a 50 kHz signal with 20 points per cycle. What is the largest time step?

Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.

Check

Monte Carlo shows a Gaussian output. What percentage of units fall within ±1.5σ of the mean?

Check

Newton's method starts with error 0.1, and the error squares each iteration. How many iterations until it is at or below 1 × 10⁻¹²?

Check

An AC analysis of an RC low-pass (R = 4.7 kΩ, C = 10 nF) reports what gain at 1000 Hz, in dB?

Check

An AC sweep uses 20 points per decade over 3 decades, including both ends. How many frequencies does it compute?

Check

A simulated amplifier shows a perfectly flat gain to 10 GHz. What's the most likely explanation?

Check

Newton's method starts with error 0.1 V, and each iteration squares the error (in volts).

(a)

How many iterations bring the error below 1 × 10⁻⁶ V?

(b)

What is the error after one iteration?

Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.

Check

A design's output is Gaussian, and the specification is the mean ± 2σ.

(a)

What yield should production expect?

(b)

How many parts per million fail?

Explain why

Why should a simulation's DC operating point be checked before trusting its AC analysis?

Practice

Keep practicing

10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.