E5.1.1 Steer the current

EasyImplementngspice 42 + SKY130 · serverReview the topic

Give a differential pair its tail and size its input devices so that on 20 µA it keeps a gain of at least 5.2 and stays linear over a 160 mV differential input.

Circuit context: A differential pair with 50 kΩ loads at a common mode of 1.2 V, its tail copied from a 20 µA reference. Bias and size the input pair of a sensor interface that must stay linear over ±150 mV.

A sensor interface feeds a differential signal of up to ±150 mV into a differential pair with 50 kΩ loads. The pair must stay linear over that range and still give gain, on a 20 µA budget. The subcircuit pair below holds the input devices of lesson E5.1's pair A (10/1) and an empty tail.

Complete it: add the tail device, biased from the line nb (a 20 µA reference into an 8/1 NMOS diode, in the grader's bench), and size M1 and M2. With 1.8 V, a common mode of 1.2 V and 50 kΩ from each drain to the supply, at tt, the grader needs a tail current of 19 to 21 µA, a differential gain of at least 5.2 at zero input, and a differential input of at least 160 mV before M1 carries 90 % of the tail.

Pair A gives a gain of 8.24 but reaches 90 % at 120 mV. A narrower pair widens the range and costs gain: find the width where both hold.

What the grader measures

Your subcircuit pair (ports inp, inn, d1, d2, nb) under the grader's own bench, one run per corner (tt):

CheckCornerRule
Tail currenttt19 µA to 21 µA
Differential gaintt≥ 5.2
Input for 90 % steeringtt≥ 160 mV
Full specification
The subcircuit the grader tests (keep the name and the ports)
.subckt pair inp inn d1 d2 nb
* the tail device and the input pair M1 (d1, inp) and M2 (d2, inn)
.ends
CheckRuleHow the grader measures it
Tail current19 µA to 21 µAdc sweep of the differential input: i(VA1) + i(VA2) at 0 V
Differential gain≥ 5.2the slope of v(d2) − v(d1) against the differential input at 0 V
Linear range≥ 160 mVthe differential input at which i(VA1) is 90 % of the total

The bench is lesson E5.1's: VCM = 1.2 V, the differential input split half and half by two E sources, 0 V ammeters VA1 and VA2 above the 50 kΩ loads, swept from −0.5 V to 0.5 V in 2 mV steps. One run at tt, 27 °C.

Examples

Example 1

Pair A with the tail copied (10/1 over 8/1)
Design
.subckt pair inp inn d1 d2 nb
XM5 tail nb 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
XM1 d1 inp tail 0 sky130_fd_pr__nfet_01v8 W=10 L=1
XM2 d2 inn tail 0 sky130_fd_pr__nfet_01v8 W=10 L=1
.ends
Measured by the grader
Tail current: 19.56 µA (needs 19 µA to 21 µA)
Differential gain: 8.237 (needs ≥ 5.2)
Input for 90 % steering: 120.2 mV (needs ≥ 160 mV)

The current and the gain are fine, but at 20 µA a 10/1 pair has a g_m/I_D of 17.6 /V and has steered 90 % of the tail by 120 mV.

Example 2

A 2/1 pair
Design
.subckt pair inp inn d1 d2 nb
XM5 tail nb 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
XM1 d1 inp tail 0 sky130_fd_pr__nfet_01v8 W=2 L=1
XM2 d2 inn tail 0 sky130_fd_pr__nfet_01v8 W=2 L=1
.ends
Measured by the grader
Tail current: 19.31 µA (needs 19 µA to 21 µA)
Differential gain: 4.504 (needs ≥ 5.2)
Input for 90 % steering: 201.8 mV (needs ≥ 160 mV)

Now the range is 202 mV, but g_m has fallen with g_m/I_D and the gain is 4.5.

Example 3

A 3/1 pair on a 16/1 tail: twice the current
Design
.subckt pair inp inn d1 d2 nb
XM5 tail nb 0 0 sky130_fd_pr__nfet_01v8 W=16 L=1
XM1 d1 inp tail 0 sky130_fd_pr__nfet_01v8 W=3 L=1
XM2 d2 inn tail 0 sky130_fd_pr__nfet_01v8 W=3 L=1
.ends
Measured by the grader
Tail current: 38.78 µA (needs 19 µA to 21 µA)
Differential gain: 7.115 (needs ≥ 5.2)

More current raises g_m and the overdrive together, but 39 µA through 50 kΩ drops 0.97 V: the drains sit near 0.83 V, below the 1.2 V gates, and as the input swings M1 enters triode before it carries 90 % (no crossing, so the range is not measured). It also breaks the 20 µA budget.

Constraints and contract

  • The netlist defines .subckt pair inp inn d1 d2 nb ... .ends exactly once, with these ports in this order.
  • Inside pair: resistors, capacitors and X instances of sky130_fd_pr__nfet_01v8 or sky130_fd_pr__pfet_01v8, with comments and .param lines. No sources: the tail takes its bias from nb.
  • The grader writes the .lib line itself; everything outside pair is replaced by its bench.

Hints

Hint 1

A device that copies the 8/1 diode at the same length sees the same V_GS, so its width sets the current. Check where the copy lands: the diode sits at a lower V_DS than the tail.

Hint 2

Lesson E5.1: at a fixed tail current the input at which 90 % of the current has steered grows as g_m/I_D falls, so a narrower pair stays linear further. The gain is g_m R_D, and it falls too.

Hint 3

Pair A (10/1) gives 8.24 and 120 mV; pair B (1/1) reaches 90 % only at 284 mV, with far less gain. Sweep W between them at L = 1 and read both numbers.

What the grader checks: The grader places pair under lesson E5.1's bench (1.8 V, VCM 1.2 V, 50 kΩ loads, nb from 20 µA into an 8/1 diode) and measures the tail current, the slope at zero input and the 90 % steering point from one dc sweep at tt, 27 °C, on ngspice 42 (libngspice0 42+ds-3build1) with the pinned SKY130 models, measured 2026-11-03 with tools/spice-judge.mjs. It does not check other common-mode levels, corners or mismatch.

Run simulates your netlist as written, with your own analyses and measurements. Submit sends it to the grader, which keeps only the subcircuit pair and makes 1 ngspice run. The numbers come from ngspice and the SKY130 models the site pins; they prove the measured cases, not every condition a chip meets.

See all 1 steps and the final capstone
Your netlist SPICESaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs
Not run yet
Run your netlist to see its measurements and the ngspice log here.
ngspice 42 + SKY130 · server