FOSSlab

Chapter 10 of 14 · about 30 min

Monte Carlo analysis

Two transistors drawn identically are never identical: random variations of doping, oxide and edges make each device slightly different. This mismatch gives the op-amp an input offset that changes from chip to chip. Monte Carlo simulation draws hundreds of random circuits from IHP’s statistical models to estimate the distribution.

1. Set it up

In the Simulation Environment of tb_opamp_ac, tab Monte Carlo:

Monte Carlo tab
Monte Carlo setup.
FieldMeaning
Number of runsHow many random circuits. 200 gives a σ good to about 10 %.
Analysis variationmismatch: device-to-device variation on one chip (IHP’s mos_tt_mismatch, cap_typ_mismatch sections): offset, matching. process: chip-to-chip variation of the whole process (mos_tt_stat, cap_typ_stat): every transistor’s Vth, mobility, oxide… shift together.
Starting run # (seed)Run n uses the random seed start + n. The same start gives the same samples; change it for a new set.
Parallel jobsHow many simulations at a time.

The outputs and their specifications are those of the Outputs tab. Press Run Monte Carlo: 200 runs take a few seconds.

How it works: in IHP’s mismatch models each transistor’s threshold voltage, mobility, width and length get a random deviation (agauss) that depends on its area (Pelgrom: σ ∝ 1/√(W·L)), drawn when ngspice reads the netlist. FOSSLab runs the testbench N times, each time with .option seed=n and the model section changed to …_mismatch, and collects the outputs.

2. Results

Monte Carlo results
Monte Carlo results: statistics of every output, the fraction of runs that meet each specification, and the overall yield. Click an output for its histogram.
Output (200 runs, mismatch)MeanσMin … Max
Output offset1.72 mV2.14 mV−3.40 … 7.77 mV
DC gain57.61 dB0.031 dB57.52 … 57.69 dB
Unity-gain frequency16.17 MHz0.228 MHz15.49 … 16.81 MHz
Phase margin60.38°0.30°59.47 … 61.11°
Power90.8 µW1.2 µW
Offset histogram
Output offset: mean 1.72 mV (the systematic offset), σ 2.14 mV (mismatch). The dashed lines are the ±5 mV specification.

Mismatch hardly changes gain, bandwidth or phase margin: they depend on the sum of many devices, and the variations average out. It dominates the offset: σ = 2.14 mV, and 5.5 % of the circuits are outside ±5 mV: yield 94.5 %. The input pair contributes σΔVth ≈ √2 · 3.9 mV·µm / √(8 µm · 1 µm) ≈ 1.95 mV; the current mirror M3/M4 the rest. To halve the offset, make the input pair and the mirror four times bigger in area (at the cost of capacitance, hence bandwidth).

Monte Carlo family of curves
The family of open-loop gain curves of the 200 runs (Waveforms: all runs).

Now try Analysis variation = process (200 runs): every transistor of a chip shifts together, the way the corners assume, but drawn statistically:

Output (200 runs)σ, mismatchσ, process
DC gain0.031 dB0.24 dB
Unity-gain frequency0.23 MHz0.52 MHz
Phase margin0.30°0.76°
Output offset2.14 mV (mean 1.72)1.90 mV (mean 2.26, up to 15 mV)

Gain, bandwidth and phase margin now spread 2 to 8 times more. The offset changes as well, for another reason: not random differences between twin transistors, but the systematic offset, which depends on how fast the NMOS are compared with the PMOS (as in the ff corner). Yield: 91 %.

From the command line: fosslab mc opamp_tut tb_opamp_ac -n 200 --variation mismatch --seed 1. Every run’s netlist and log stay in ~/fosslab/sim/opamp_tut/tb_opamp_ac/montecarlo/, with results.csv (one row per run) and the histograms.