Monte Carlo on an amplifier's offset

Run a reproducible Monte Carlo of an amplifier's offset, read its mean and spread, split the spread into the devices that cause it, and grow the one that matters.

Lesson
E7.5
Time
30 min
Runs on
ngspice
Check
6 questions

A team needed the random offset of an OTA-A follower below σ = 0.5 mV, and a Monte Carlo run of 30 dies gave σ = 1.83 mV. They drew the input pair 16 times larger in area (40/4 instead of 10/1), and the next run gave 1.47 mV.

DC sweepThe same 30 dies with a 16× larger input pairEach die's offset minus the mean of all 30, and its two parts. The load part is almost the whole offset.
  • offset − mean
  • pair part
  • load part
-4 mV-3 mV-2 mV-1 mV01 mV2 mV3 mV4 mV5 mVRandom offset51015202530Die-4 mV-2 mV02 mV4 mV6 mVRandom offset102030Die
  1. Die 12offset − mean = -2.566 mV · pair part = 406.2 µV · load part = -2.968 mV

    Die 12: 2.57 mV below the mean, with +0.41 mV from the pair and −2.97 mV from the load.

  2. Die 17offset − mean = 4.136 mV · pair part = 480.4 µV · load part = 3.631 mV

    Die 17: 4.14 mV above the mean, 0.48 mV from the pair and 3.63 mV from the load.

Read the plot as a table
Dieoffset − meanpair partload part
5-672.4 µV-266.5 µV-422.7 µV
101.249 mV34.04 µV1.196 mV
12-2.566 mV406.2 µV-2.968 mV
15-513.1 µV-207 µV-311.1 µV
174.136 mV480.4 µV3.631 mV
20821.7 µV181.5 µV664.8 µV
25-1.438 mV334.7 µV-1.763 mV
30-214.2 µV-130.2 µV-92.06 µV

30 OTA-A followers, pair of 40/4 and the load mirror at 8/1, seed 5, on ngspice 42. Lines only join neighbouring dies.

Growing one device only shrinks its own share of the offset.

Thirty dies in one netlist

Two transistors drawn alike differ by a small random threshold shift, the mismatch of E7.4. On a real wafer every die draws its own shifts, so every die has its own offset. A Monte Carlo run imitates that. It builds many copies of the circuit, gives each transistor its own random draw from the model's statistics, and measures every copy.

The lab defines OTA-A as a follower in a subcircuit, with its own 20 µA bias, and calls it 30 times: one call per die. The library keeps its mismatch switch MC_MM_SWITCH at 0; .param MC_MM_SWITCH={mm} inside the subcircuit turns it on for that copy. .options seed=5 fixes the random draws, so every run gives the same 30 dies.

One die: OTA-A as a followerThe output drives M2's gate, so the output follows the input. Every transistor draws its own threshold shift.
One die: OTA-A as a followerVDD1.8 VM3load 8/1M4load 8/1M1pair 10/1M2pair 10/1IB20 µAMB8/1M58/1outin
  1. The input pair

    A threshold shift of M2 against M1 appears at the input one to one.

  2. The load mirror

    A shift of M4 against M3 changes M4's current by gm3ΔV. M2 must absorb it, so the input sees ΔV·gm3/gm1, 0.57 times the shift.

  3. The bias

    MB and M5 change the tail current, which both halves share: what is left after the pair and load parts spreads by 24 µV.

Read the circuit as text
  • M3 PMOS transistor (load 8/1): gate → n1, source → VDD, drain → n1
  • M4 PMOS transistor (load 8/1): gate → n1, source → VDD, drain → n2
  • M1 NMOS transistor (pair 10/1): gate → n3, drain → n1, source → n4
  • M2 NMOS transistor (pair 10/1): gate → n2, drain → n2, source → n4
  • IB current source (20 µA): + → VDD, − → n5
  • MB NMOS transistor (8/1): gate → n5, drain → n5, source → 0
  • M5 NMOS transistor (8/1): gate → n5, drain → n4, source → 0
  • out port: terminal → n2
  • in port: terminal → n3

OTA-A of E5.3 (W/L in µm). In SKY130 the mismatch model shifts the threshold of each transistor only.

Here are the 30 offsets as a histogram: how many dies fall in each 1 mV slice.

HistogramOffset of 30 OTA-A followers, pair 10/1, load 8/1Offset = output − input, at 0.9 V in.
012345678Dies-8 mV-6 mV-4 mV-2 mV02 mV4 mVOffsetmean − 3σmean −2.62 mVmean + 3σ02468Dies-5 mV0Offsetmean − 3σmean −2.62 mVmean + 3σ
Read the histogram as a table
Offset fromtoDies
-9 mV-8 mV0
-8 mV-7 mV0
-7 mV-6 mV0
-6 mV-5 mV3
-5 mV-4 mV5
-4 mV-3 mV5
-3 mV-2 mV6
-2 mV-1 mV7
-1 mV0 V2
0 V1 mV1
1 mV2 mV0
2 mV3 mV0
3 mV4 mV1

30 values in 13 bins.

The lab netlist on ngspice 42, seed 5: mean −2.62 mV, standard deviation 1.83 mV, from −5.19 mV (die 8) to +3.18 mV (die 17).

Two numbers describe the spread. The mean is the average offset, −2.62 mV. The standard deviation σ measures how far dies scatter around it: 1.83 mV. The copy with its switch off (mm=0) has no mismatch at all. Its offset, −2.17 mV, is the systematic offset of E5.4, built into the design. The mean of the dies estimates it.

The estimate has an error of its own. The mean of N dies scatters by σ/√N, here 0.33 mV, and this sample's mean lies 0.45 mV below the systematic value. σ from 30 dies is known to about ±13 % (σ/√(2N)). Sign-off uses hundreds of dies; the lab keeps 30 to run in a second.

A designer reports both numbers and signs off at the mean ± 3σ. For a normal spread, 99.73 % of dies land inside that window. Here it runs from −8.11 mV to +2.88 mV: a ±6 mV spec fails, even though every one of the 30 dies passes it.

Where the spread comes from

Each die's offset is a sum of parts, one per mismatched pair of devices. The run reads every transistor's threshold shift from the model (delvto) and builds two of them. The pair part is M2's shift minus M1's. The load part is M4's shift minus M3's, times that die's gm3/gm1.

DC sweepPair part and load part of each die, pair 10/1The lab's 30 dies. Neither part dominates.
  • offset − mean
  • pair part
  • load part
-4 mV-2 mV02 mV4 mV6 mV8 mVRandom offset51015202530Die-4 mV-2 mV02 mV4 mV6 mV8 mVRandom offset102030Die
  1. Die 8offset − mean = -2.568 mV · pair part = -3.491 mV · load part = 869.4 µV

    Die 8: the pair part is −3.49 mV and the load part +0.87 mV, together −2.62 mV. The die sits 2.57 mV below the mean: the two parts leave 0.05 mV over.

  2. Die 17offset − mean = 5.798 mV · pair part = 2.062 mV · load part = 3.728 mV

    Die 17: +2.06 mV from the pair and +3.73 mV from the load, so the die sits 5.80 mV above the mean.

Read the plot as a table
Dieoffset − meanpair partload part
5-1.543 mV-1.144 mV-434.1 µV
8-2.568 mV-3.491 mV869.4 µV
101.395 mV146.1 µV1.228 mV
15-1.191 mV-888.5 µV-319.6 µV
175.798 mV2.062 mV3.728 mV
201.413 mV778.9 µV682.6 µV
25-392.1 µV1.437 mV-1.81 mV
30-636.4 µV-559 µV-94.61 µV

30 OTA-A followers, pair of 10/1 and the load mirror at 8/1, seed 5, on ngspice 42. Lines only join neighbouring dies.

The two parts add up to the whole: what is left over spreads by 24 µV. Their own spreads are 1.39 mV for the pair and 1.55 mV for the load. The two halves of OTA-A matter about equally.

Pelgrom's law (E7.4) predicts each part by hand. For a pair of devices, σ(ΔVth) = AVT/√(WL). The SKY130 file gives 3.356 mV·µm per NMOS and 5.856 mV·µm per PMOS, and a pair's difference is √2 times that: AVT = 4.75 mV·µm for the NMOS pair and 8.28 mV·µm for the PMOS pair. The NMOS model also multiplies small devices by a size factor, 1.05 at 10/1.

  1. Pair

    4.75 mV·µm × 1.05 / √(10 × 1) = 1.58 mV.

  2. Load, at its own gates

    8.28 mV·µm / √(8 × 1) = 2.93 mV.

  3. Load, referred to the input

    × gm3/gm1 = 0.567 from the operating point: 1.66 mV.

  4. Total

    Independent parts add as powers: σ = √(1.582 + 1.662) = 2.29 mV.

The hand budget says 2.29 mV; the 30 dies say 1.83 mV. This sample is low: its pair part spreads 1.39 mV (law: 1.58) and its load part 1.55 (law: 1.66). The parts are independent in the model, yet in 30 dies they lean against each other, so the total is below √(1.392 + 1.552) = 2.08 mV.

Grow the device that dominates

The team's 40/4 pair cut the pair part by more than four, as Pelgrom promised. The load part did not move, and it was already the larger half. Here are all four sizings on the same 30 dies.

Pair, load (W/L in µm)Gate area of M1-M4Hand: pair, load, totalMonte Carlo: pair, load, totalSystematic
10/1, 8/136 µm21.58, 1.66, 2.29 mV1.39, 1.55, 1.83 mV−2.17 mV
40/4, 8/1336 µm20.37, 1.62, 1.66 mV0.32, 1.50, 1.47 mV−1.50 mV
20/2, 16/2144 µm20.75, 0.80, 1.10 mV0.66, 0.75, 0.88 mV−2.03 mV
40/4, 32/4576 µm20.37, 0.40, 0.54 mV0.32, 0.37, 0.44 mV−1.32 mV

Every Monte Carlo number from 30 dies, seed 5, the same random draws for every sizing; σ in mV. The systematic offset is the copy with mm=0.

Growing both halves four times in area (20/2 and 16/2) halves σ, 1.83 → 0.88 mV, with less than half the area of the 40/4 pair alone. Growing the load to 32/4 next to the 40/4 pair brings σ to 0.44 mV, under the team's 0.5 mV.

DC sweepPair 40/4 and load 32/4: both parts smallThe same 30 dies once more: both parts are small.
  • offset − mean
  • pair part
  • load part
-1.0 mV-0.5 mV00.5 mV1.0 mV1.5 mVRandom offset51015202530Die-1.0 mV-0.5 mV00.5 mV1.0 mV1.5 mVRandom offset102030Die
  1. Die 17offset − mean = 1.395 mV · pair part = 480.4 µV · load part = 898.8 µV

    Die 17, the worst die of every sizing, now sits 1.40 mV above the mean: 0.48 mV from the pair, 0.90 mV from the load.

Read the plot as a table
Dieoffset − meanpair partload part
5-367.2 µV-266.5 µV-104.5 µV
10349.6 µV34.04 µV297.1 µV
15-277.9 µV-207 µV-76.76 µV
171.395 mV480.4 µV898.8 µV
20329.8 µV181.5 µV165.5 µV
25-113.3 µV334.7 µV-437.8 µV
30-148.8 µV-130.2 µV-22.34 µV

30 OTA-A followers, pair of 40/4 and the load mirror at 32/4, seed 5, on ngspice 42. Lines only join neighbouring dies.

Area is the expensive lever: halving σ costs four times the area and the gate capacitance. A smaller gm3/gm1 (a load at lower gm/ID) shrinks the load's share instead. And offset can be removed after the fact: trimming adjusts each part once at test, chopping and auto-zeroing cancel it continuously.

Open the die plot of the 20/2 and 16/2 sizing
DC sweepPair 20/2 and load 16/2: both parts halvedFour times the area in every device of the pair and the mirror.
  • offset − mean
  • pair part
  • load part
-2 mV-1 mV01 mV2 mV3 mVRandom offset51015202530Die-2 mV-1 mV01 mV2 mV3 mVRandom offset102030Die
Read the plot as a table
Dieoffset − meanpair partload part
5-741.3 µV-545.5 µV-209 µV
10686.5 µV69.66 µV593.3 µV
15-567.6 µV-423.7 µV-153.7 µV
20670.8 µV371.4 µV330.1 µV
25-202.6 µV685 µV-874.1 µV
30-303.5 µV-266.6 µV-44.99 µV

30 OTA-A followers, pair of 20/2 and the load mirror at 16/2, seed 5, on ngspice 42. Lines only join neighbouring dies.

Asked in interviews
  1. How do you run a Monte Carlo analysis, and how many runs do you need?

    Switch on the mismatch statistics, draw many copies (with a fixed seed so the run repeats) and measure each. σ from N runs is known to about 1/√(2N): ±13 % from 30, ±4 % from 300. Sign-off uses hundreds.

  2. What do the mean and σ of a Monte Carlo offset tell you?

    The mean is the systematic offset, the same on every die, plus a sampling error of σ/√N. σ is the random part. A spec is checked at the mean ± 3σ, 99.73 % of a normal population.

  3. You grew the input pair and the offset barely improved. Why, and what else reduces offset?

    The load mirror's mismatch, referred to the input by gm3/gm1, now dominates: grow the load or lower that ratio. Beyond area: trimming at test, chopping or auto-zeroing in operation.

Try it

Run it and read the five meas lines: the mean, σ and the systematic offset, then the lowest and highest die with its number after at=. Open Plots to see off, the offset of each die against its number.

Now change .param wp=10 lp=1 to wp=40 lp=4 and predict σ before you run, using the budget above. Then grow the load too (wl=32 ll=4). Last, change the seed: the sample changes, and σ moves by roughly the ±13 % that 30 dies allow.

SPICEngspice 42 · simulator service
Edit the netlist, then run it
Expected measurements: mean = -2.618929e-03 sigma = 1.831760e-03 systematic = -2.165886e-03

Check yourself

Predict the outputThis netlist is five dies of the lab with one change: mm=0 on the .subckt line, the seed still 5. It prints the standard deviation of the five offsets in microvolts, rounded to a whole number. Type the line meas prints (format: sigma_uv = 1.379000e+03).
* five OTA-A followers with mm=0 on the .subckt line: the spread in microvolts, rounded
.lib sky130 tt
.options seed=5
.subckt ota inp out vdd mm=0
.param MC_MM_SWITCH={mm}
IB vdd nb 20u
XMB nb nb 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
XM5 tail nb 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
XM1 x inp tail 0 sky130_fd_pr__nfet_01v8 W=10 L=1
XM2 out out tail 0 sky130_fd_pr__nfet_01v8 W=10 L=1
XM3 x x vdd vdd sky130_fd_pr__pfet_01v8 W=8 L=1
XM4 out x vdd vdd sky130_fd_pr__pfet_01v8 W=8 L=1
.ends
VDD vdd 0 1.8
VIN in 0 0.9
X1 in o1 vdd ota
X2 in o2 vdd ota
X3 in o3 vdd ota
X4 in o4 vdd ota
X5 in o5 vdd ota
VK k 0 0
.control
op
compose os values v(o1)-v(in) v(o2)-v(in) v(o3)-v(in) v(o4)-v(in) v(o5)-v(in)
dc VK 1 2 1
let uv = floor(1e6*stddev(op1.os)+0.5)+0*v(k)
meas dc sigma_uv FIND uv AT=1
.endc
.end
ConceptRead the hook's die plot (pair 40/4, load 8/1). Die 12 sits 2.57 mV below the mean. Where does that come from?
ConceptPair 40/4, load 8/1: σ = 1.47 mV. Which single change lowers σ the most?
ConceptThe 30 dies of the lab have a mean offset of −2.62 mV. What is that number?
ConceptBoth halves of OTA-A grow four times in area: pair 10/1 → 20/2, load 8/1 → 16/2. What happens to σ?
ConceptA spec says |offset| ≤ 6 mV. All 30 dies of the lab's Monte Carlo pass it. What can you conclude?

Remember

  • A Monte Carlo run gives every transistor of every copy its own random draw; unrolled copies with a fixed seed repeat exactly.
  • Report the mean (systematic offset plus a σ/√N sampling error) and σ (the random part); sign off at the mean ± 3σ, not at the worst sampled die.
  • Each device pair adds its own part: the input pair one to one, the load mirror times gm3/gm1; independent parts add as powers.
  • Grow the device whose part dominates: four times the area of every device halves σ, sixteen times the area of one device leaves the other's part untouched.