The simple mirror and its errors
Copy a reference current with two transistors, measure how far the copy drifts as the output voltage moves, and find how low the output can go before the copy fails.
- Lesson
- E4.1
- Time
- 25 min
- Runs on
- ngspice
- Check
- 5 questions
A 20 µA bias current was copied to another block with two minimum-length transistors, W/L = 2/0.15 µm. That block held the output node at 1.8 V and received 34.4 µA, 72 % more than the reference. At 0.5 V the same copy would have delivered only 16.1 µA.
- Output voltage VO 500 mVi_015 = 16.11 µA
At 0.5 V on the output the copy is 16.1 µA, 19 % low.
- Output voltage VO 1.8 Vi_015 = 34.41 µA
At 1.8 V it is 34.4 µA, 72 % high. Nothing in the reference changed; only the output voltage did.
Read the plot as a table
| Output voltage VO | i_015 |
|---|---|
| 0 V | 0.0000009927 fA |
| 200 mV | 11.54 µA |
| 400 mV | 14.64 µA |
| 500 mV | 16.11 µA |
| 600 mV | 17.55 µA |
| 800 mV | 20.41 µA |
| 1 V | 23.24 µA |
| 1.2 V | 26.05 µA |
| 1.4 V | 28.85 µA |
| 1.6 V | 31.63 µA |
| 1.8 V | 34.41 µA |
Measured on ngspice 42, SKY130 tt (361 points): the 2/0.15 µm mirror of the lab below.
A mirror copies a current exactly only when both of its transistors see the same voltages.
Copying a current with two transistors
- The reference sets VGS
IREF pushes 20 µA into M1. M1's gate is tied to its drain, so it settles at the gate voltage that carries 20 µA: VGS = 0.714 V for W/L = 8/1 µm.
IREF = 20 µA
- M2 gets the same VGS
M2's gate is on the same node and both sources are at ground. A saturated transistor's current is set mainly by VGS, so M2 carries about the same 20 µA.
- The output current
VO holds M2's drain at 0.9 V while M1's drain sits at 0.714 V. M2 carries 20.27 µA, 1.3 % more than the reference. The current leaves VO's + terminal, so SPICE prints i(VO) as a negative number.
20.27 µA
Read the circuit as text
- IREF current source (20 µA): + →
VDD, − →g - M1 NMOS transistor (W/L = 8/1): gate →
g, drain →g, source →0 - M2 NMOS transistor (W/L = 8/1): gate →
g, drain →o, source →0 - VO voltage source (0.9 V): + →
o, − →0
g= 0.714 Vo= 0.900 V
Both bodies are the p-substrate at ground. In the lab a 0 V source between node o and each output device measures that device's current.
Push a reference current IREF into a transistor whose gate is tied to its drain. This diode-connected transistor cannot leave saturation: its VDS equals its VGS, which is always more than VGS − Vth. It settles at the one VGS that carries IREF.
Give a second transistor the same VGS. In saturation its current depends mainly on VGS, so it carries about the same current. That pair is a current mirror: M1 turns a current into a voltage, and M2 turns the voltage back into a current. Neither gate draws current, so one reference can feed many outputs.
The copy flows from whatever drives the output node. The reference only sets the gate voltage. Making M2 m units of M1 scales the copy by m: the lab's 2:1 output (m=2) carries 40.53 µA at 0.9 V, exactly twice the 1:1 copy of 20.27 µA.
The lab measures each output with a 0 V source between node o and the device. SPICE counts a source's current as positive when it flows into the + terminal. Current flows from o into each output device, so these ammeters read positive.
Where the copy is exact, and why it drifts
Step through the measured copy of the two extreme lengths. The upper panel is the current; the lower one is the output resistance rout = 1/(∂Iout/∂Vout), on a log axis.
- i_015
- i_1
- r_015
- r_1
- Output voltage VO 200 mVi_015 = 11.54 µA · i_1 = 18.64 µA · r_015 = 58.63 kΩ · r_1 = 112.4 kΩ
At 0.2 V the 8/1 copy is 18.64 µA and its rout is only 112 kΩ: M2 is close to triode. The short device gives 11.54 µA.
- Output voltage VO 713.5 mVi_015 = 19.18 µA · i_1 = 20 µA · r_015 = 70.07 kΩ · r_1 = 662 kΩ
At Vout = 0.714 V, M2's drain sits at the same voltage as M1's. Every voltage on M2 equals M1's, so the 8/1 copy is 20.00 µA: exact.
- Output voltage VO 900 mVi_015 = 21.83 µA · i_1 = 20.27 µA · r_015 = 70.67 kΩ · r_1 = 731 kΩ
At 0.9 V the 8/1 copy is 20.27 µA (+1.3 %), the 2/0.15 copy 21.83 µA (+9.1 %). rout is 731 kΩ against 70.7 kΩ.
- Output voltage VO 1.8 Vi_015 = 34.41 µA · i_1 = 21.38 µA · r_015 = 72 kΩ · r_1 = 844.6 kΩ
At 1.8 V: 21.38 µA against 34.41 µA. The short device's current keeps climbing because its rout stays near 70 kΩ.
Read the plot as a table
| Output voltage VO | i_015 | i_1 | r_015 | r_1 |
|---|---|---|---|---|
| 0 V | 0.0000009927 fA | 0 A | 5.337 kΩ | 4.03 kΩ |
| 200 mV | 11.54 µA | 18.64 µA | 58.63 kΩ | 112.4 kΩ |
| 400 mV | 14.64 µA | 19.44 µA | 67.62 kΩ | 434.3 kΩ |
| 600 mV | 17.55 µA | 19.82 µA | 69.54 kΩ | 602.3 kΩ |
| 713.5 mV | 19.18 µA | 20 µA | 70.07 kΩ | 662 kΩ |
| 800 mV | 20.41 µA | 20.13 µA | 70.38 kΩ | 697.5 kΩ |
| 900 mV | 21.83 µA | 20.27 µA | 70.67 kΩ | 731 kΩ |
| 1 V | 23.24 µA | 20.4 µA | 70.92 kΩ | 758.5 kΩ |
| 1.2 V | 26.05 µA | 20.66 µA | 71.36 kΩ | 800.6 kΩ |
| 1.4 V | 28.85 µA | 20.9 µA | 71.73 kΩ | 830.1 kΩ |
| 1.6 V | 31.63 µA | 21.14 µA | 71.98 kΩ | 847 kΩ |
| 1.8 V | 34.41 µA | 21.38 µA | 72 kΩ | 844.6 kΩ |
Measured on ngspice 42, SKY130 tt (361 points). i_015 and r_015 are the 2/0.15 µm mirror; i_1 and r_1 the 8/1 µm mirror.
The copy is exact at one output voltage only: Vout = VGS, where M2 sees exactly what M1 sees. Anywhere else M2's VDS differs from M1's, and a saturated transistor's current still rises with VDS. That rise is channel-length modulation, plus drain-induced barrier lowering (DIBL) in short devices, from the E2 lesson "Channel-length modulation and output resistance".
With the first-order model ID ∝ (1 + λVDS), the copy ratio is Iout/IREF ≈ (1 + λVDS2)/(1 + λVDS1). Seen from the output, the mirror is a current source in parallel with M2's own ro, so rout = ro2.
Check the model on the 8/1 mirror. Start at the exact point, 20 µA at 0.714 V, and climb with slope 1/rout = 1/731 kΩ. At 0.9 V that predicts 20 + 0.186 V/731 kΩ = 20.26 µA; the run gives 20.27 µA. For 2/0.15 µm the same line predicts 21.83 µA from VGS = 0.771 V and 70.7 kΩ; the run gives 21.83 µA.
| W/L (µm) | VGS | Iout at 0.2 V | at 0.9 V | at 1.8 V | rout at 0.9 V |
|---|---|---|---|---|---|
| 2/0.15 | 0.771 V | 11.54 µA | 21.83 µA | 34.41 µA | 70.7 kΩ |
| 4/0.5 | 0.753 V | 17.93 µA | 20.31 µA | 21.90 µA | 499 kΩ |
| 8/1 | 0.714 V | 18.64 µA | 20.27 µA | 21.38 µA | 731 kΩ |
| 16/2 | 0.687 V | 18.82 µA | 20.30 µA | 21.44 µA | 735 kΩ |
The lab's i02_*, i09_*, i18_* and ro_* lines; VGS is the voltage of each reference node. Every mirror copies 20 µA at the same W/L.
Longer devices copy better, twice over. Their rout is higher: ten times higher at 1 µm than at 0.15 µm. They also need less VGS for the same W/L (0.771 V down to 0.687 V), which leaves more room below the output. Short devices need extra gate voltage because of velocity saturation (E2 lesson "The square law and where SKY130 departs from it"). SKY130's threshold is also highest at L = 0.15 µm ("Threshold and the regions").
The gain flattens out. From 1 to 2 µm, rout moves only from 731 to 735 kΩ at this bias, while the gate area W·L grows from 8 to 32 µm2. A bigger gate also adds capacitance, so the gate line settles more slowly. L = 1 µm is the usual choice in this module.
How low the output can go
Below some output voltage M2 moves toward triode and the copy falls away. This module defines the minimum output voltage once and uses it for every mirror: the output voltage at which the current is 1 % below its value at Vout = 0.9 V. The lab finds it with meas ... WHEN n_1=0.99, where n_1 is the current divided by its value at 0.9 V.
For the simple mirror the result is set by the slope as much as by the knee. The 8/1 copy falls 1 % at 0.757 V, but most of that drop is the steady slope of rout, not M2 leaving saturation: at 0.2 V it still carries 18.64 µA. For 2/0.15 µm the slope alone loses 1 % within 15 mV, at 0.885 V.
The knee shows in the lower panel. The 8/1 device's rout is 731 kΩ at 0.9 V, 295 kΩ at 0.3 V and 112 kΩ at 0.2 V. A real circuit loses accuracy before it loses current. E4.3's cascode mirrors have almost no slope, and there the same 1 % test reads the knee itself.
Minimum length
XR1 g1 g1 0 0 sky130_fd_pr__nfet_01v8 W=2 L=0.15
XO1 o1 g1 0 0 sky130_fd_pr__nfet_01v8 W=2 L=0.15
i18_015 = 3.440796e-05: 34.4 µA at 1.8 V; vmin_015 = 8.845776e-01.
L = 1 µm, same W/L
XR3 g3 g3 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
XO3 o3 g3 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
i18_1 = 2.137654e-05: 21.4 µA at 1.8 V; vmin_1 = 7.567494e-01.
Both from the lab, each copying 20 µA.
Two more errors exist that this lab cannot show. Two transistors drawn alike are never quite alike: their thresholds and current factors differ at random (mismatch). And a wafer is not uniform, so a device far from its partner sees a slightly different process (gradients). Module E7 measures both.
Asked in interviews
How does a current mirror work?
A reference current flows into a diode-connected transistor, which settles at the VGS that carries it. A second transistor with the same VGS carries the same current in saturation, scaled by its size ratio. The output current comes from the output node, not from the reference.
What are a simple mirror's errors, and what is its output resistance?
Systematic: the output device's VDS differs from the reference device's, and channel-length modulation turns that into a copy error. Random: mismatch and gradients. rout = ro2: on SKY130 at 20 µA, 70.7 kΩ at 2/0.15 µm and 731 kΩ at 8/1 µm.
How do you make a mirror copy more accurately?
Use longer devices for a higher ro, hold the output near VGS so both devices see the same VDS, or cascode the output to raise rout by about gmro. Draw both devices as matched units side by side.
Try it
Run the bench and open Plots: every output current against VO, the five ammeters on one node. Read the 8/1 mirror's lines (_1) first, then compare the other lengths.
Then try four edits. Find the exact copy: iexact_1 reads the 8/1 current at Vout = VGS. Make M2 a 2:1 copy with m=2 and check that the ratio holds at every VO. Change one length and keep W/L fixed. Finally move I3 to 10 µA and watch VGS, the copy error and rout change together.
Run the netlist to draw its plots here.
i02_015 = 1.154243e-05 i09_015 = 2.182895e-05 i18_015 = 3.440796e-05 at= 1.800000e+00 ro_015 = 7.067227e+04 vmin_015 = 8.845776e-01 i02_05 = 1.793132e-05 i09_05 = 2.030769e-05 i18_05 = 2.189829e-05 at= 1.800000e+00 ro_05 = 4.992986e+05 vmin_05 = 8.012841e-01 i02_1 = 1.863838e-05 i09_1 = 2.026702e-05 i18_1 = 2.137654e-05 at= 1.800000e+00 ro_1 = 7.310250e+05 vmin_1 = 7.567494e-01 i02_2 = 1.882428e-05 i09_2 = 2.030098e-05 i18_2 = 2.144203e-05 at= 1.800000e+00 ro_2 = 7.351944e+05 vmin_2 = 7.544011e-01 i09_x2 = 4.053403e-05 vgs_1 = 7.135415e-01 iexact_1 = 2.000000e-05Check yourself
Remember
- A diode-connected device turns IREF into a gate voltage; a device sharing that gate turns it back into a current, scaled by the size ratio.
- The copy is exact only at Vout = VGS; elsewhere channel-length modulation gives an error that grows with |Vout − VGS|.
- A simple mirror's output resistance is ro2: 70.7 kΩ at 2/0.15 µm and 731 kΩ at 8/1 µm for 20 µA on SKY130.
- The minimum output voltage is where the current is 1 % below its value at 0.9 V; for a simple mirror the slope sets most of it.