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.
- offset − mean
- pair part
- load part
- 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.
- 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
| Die | offset − mean | pair part | load part |
|---|---|---|---|
| 5 | -672.4 µV | -266.5 µV | -422.7 µV |
| 10 | 1.249 mV | 34.04 µV | 1.196 mV |
| 12 | -2.566 mV | 406.2 µV | -2.968 mV |
| 15 | -513.1 µV | -207 µV | -311.1 µV |
| 17 | 4.136 mV | 480.4 µV | 3.631 mV |
| 20 | 821.7 µV | 181.5 µV | 664.8 µV |
| 25 | -1.438 mV | 334.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.
- The input pair
A threshold shift of M2 against M1 appears at the input one to one.
- 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.
- 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.
Read the histogram as a table
| Offset from | to | Dies |
|---|---|---|
| -9 mV | -8 mV | 0 |
| -8 mV | -7 mV | 0 |
| -7 mV | -6 mV | 0 |
| -6 mV | -5 mV | 3 |
| -5 mV | -4 mV | 5 |
| -4 mV | -3 mV | 5 |
| -3 mV | -2 mV | 6 |
| -2 mV | -1 mV | 7 |
| -1 mV | 0 V | 2 |
| 0 V | 1 mV | 1 |
| 1 mV | 2 mV | 0 |
| 2 mV | 3 mV | 0 |
| 3 mV | 4 mV | 1 |
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.
- offset − mean
- pair part
- load part
- 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.
- 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
| Die | offset − mean | pair part | load part |
|---|---|---|---|
| 5 | -1.543 mV | -1.144 mV | -434.1 µV |
| 8 | -2.568 mV | -3.491 mV | 869.4 µV |
| 10 | 1.395 mV | 146.1 µV | 1.228 mV |
| 15 | -1.191 mV | -888.5 µV | -319.6 µV |
| 17 | 5.798 mV | 2.062 mV | 3.728 mV |
| 20 | 1.413 mV | 778.9 µV | 682.6 µV |
| 25 | -392.1 µV | 1.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.
Pair
4.75 mV·µm × 1.05 / √(10 × 1) = 1.58 mV.
Load, at its own gates
8.28 mV·µm / √(8 × 1) = 2.93 mV.
Load, referred to the input
× gm3/gm1 = 0.567 from the operating point: 1.66 mV.
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-M4 | Hand: pair, load, total | Monte Carlo: pair, load, total | Systematic |
|---|---|---|---|---|
| 10/1, 8/1 | 36 µm2 | 1.58, 1.66, 2.29 mV | 1.39, 1.55, 1.83 mV | −2.17 mV |
| 40/4, 8/1 | 336 µm2 | 0.37, 1.62, 1.66 mV | 0.32, 1.50, 1.47 mV | −1.50 mV |
| 20/2, 16/2 | 144 µm2 | 0.75, 0.80, 1.10 mV | 0.66, 0.75, 0.88 mV | −2.03 mV |
| 40/4, 32/4 | 576 µm2 | 0.37, 0.40, 0.54 mV | 0.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.
- offset − mean
- pair part
- load part
- 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
| Die | offset − mean | pair part | load part |
|---|---|---|---|
| 5 | -367.2 µV | -266.5 µV | -104.5 µV |
| 10 | 349.6 µV | 34.04 µV | 297.1 µV |
| 15 | -277.9 µV | -207 µV | -76.76 µV |
| 17 | 1.395 mV | 480.4 µV | 898.8 µV |
| 20 | 329.8 µV | 181.5 µV | 165.5 µV |
| 25 | -113.3 µV | 334.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
- offset − mean
- pair part
- load part
Read the plot as a table
| Die | offset − mean | pair part | load part |
|---|---|---|---|
| 5 | -741.3 µV | -545.5 µV | -209 µV |
| 10 | 686.5 µV | 69.66 µV | 593.3 µV |
| 15 | -567.6 µV | -423.7 µV | -153.7 µV |
| 20 | 670.8 µV | 371.4 µV | 330.1 µV |
| 25 | -202.6 µV | 685 µ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
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.
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.
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.
Run the netlist to draw its plots here.
mean = -2.618929e-03 sigma = 1.831760e-03 systematic = -2.165886e-03Check yourself
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.