E4.6.1 Flat Within Two Millivolts

HardImplementngspice 42 + SKY130 · serverReview the topic

Add a weighted PTAT voltage to a CTAT voltage. The sum must move at most 2 mV from −40 to 125 °C, at tt, ss and ff.

Circuit context: Two diode-connected SKY130 NMOS on ideal current sources, whose gate voltage and weighted gate-voltage difference add up to a reference voltage. Build the temperature-flat sum that a voltage reference is made from.

Lesson E4.6 added a gate voltage to 3.258 times a gate-voltage difference. That sum moved 6.5 mV from −40 to 125 °C.

A sensor needs a reference voltage that moves at most 2 mV over the same range, in three process corners.

Build the subcircuit tref with two outputs. The node ctat carries a gate voltage that falls with temperature.

The node ptat carries your weighted PTAT voltage. The grader adds the two outputs and reads how far the sum moves.

You choose the devices, their currents and the weight. A better weight alone does not rescue the lesson's devices.

What the Grader Measures

Your subcircuit tref (ports ctat, ptat) under the grader's own bench, one run per corner (tt, ss, ff):

CheckCornerRule
Movement of the sum, −40 to 125 °Ctt≤ 2 mV
Movement of the sum, −40 to 125 °Css≤ 2 mV
Movement of the sum, −40 to 125 °Cff≤ 2 mV
Rise of the PTAT parttt≥ 100 mV
Sum at 27 °Ctt≥ 700 mV
Full specification
The subcircuit the grader tests (keep the name and the ports)
.subckt tref ctat ptat
* sky130_fd_pr__nfet_01v8 devices, constant I sources and linear E sources only
.ends
CheckCornerRuleHow the grader measures it
Movement of the sumtt, ss, ff≤ 2 mVdc TEMP -40 125 1: the largest minus the smallest v(ctat) + v(ptat)
Rise of the PTAT parttt≥ 100 mVv(ptat) at 125 °C minus v(ptat) at −40 °C
Level of the sumtt≥ 0.7 Vv(ctat) + v(ptat) at 27 °C

The last two rules stop a sum that is flat only because it is small.

The current sources and the E source are ideal. A real circuit builds them from mirrors and resistor ratios.

Examples

Example 1

The Starter: The Lesson's Lab, 8/1 at 1 µA and 8 µA with w = 3.258
Design
.subckt tref ctat ptat
I1 0 ctat 1u
XM1 ctat ctat 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
I2 0 n2 8u
XM2 n2 n2 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
E1 ptat 0 n2 ctat 3.258
.ends
Measured by the grader
Movement of the sum, −40 to 125 °C: 6.507 mV (needs ≤ 2 mV)
Movement of the sum, −40 to 125 °C at ss: 6.89 mV (needs ≤ 2 mV)
Movement of the sum, −40 to 125 °C at ff: 6.132 mV (needs ≤ 2 mV)
Rise of the PTAT part: 126 mV (needs ≥ 100 mV)
Sum at 27 °C: 884.1 mV (needs ≥ 700 mV)

The slope is zero at 27 °C, but both ends rise. The sum moves 6.5 mV at tt.

Example 2

The Same Devices with the Weight Balanced over the Range
Design
.subckt tref ctat ptat
I1 0 ctat 1u
XM1 ctat ctat 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
I2 0 n2 8u
XM2 n2 n2 0 0 sky130_fd_pr__nfet_01v8 W=8 L=1
E1 ptat 0 n2 ctat 3.215
.ends
Measured by the grader
Movement of the sum, −40 to 125 °C: 5.492 mV (needs ≤ 2 mV)
Movement of the sum, −40 to 125 °C at ss: 5.852 mV (needs ≤ 2 mV)
Movement of the sum, −40 to 125 °C at ff: 5.815 mV (needs ≤ 2 mV)
Rise of the PTAT part: 124.3 mV (needs ≥ 100 mV)
Sum at 27 °C: 879.7 mV (needs ≥ 700 mV)

Both ends now agree and the sum still moves 5.5 mV. The curve itself is bent, and no weight straightens it.

Example 3

Both Devices Deep in Weak Inversion, w = 7.288
Design
.subckt tref ctat ptat
I1 0 ctat 0.1u
XM1 ctat ctat 0 0 sky130_fd_pr__nfet_01v8 W=200 L=1
I2 0 n2 0.5u
XM2 n2 n2 0 0 sky130_fd_pr__nfet_01v8 W=200 L=1
E1 ptat 0 n2 ctat 7.288
.ends
Measured by the grader
Movement of the sum, −40 to 125 °C: 619.9 µV (needs ≤ 2 mV)
Movement of the sum, −40 to 125 °C at ss: 892.2 µV (needs ≤ 2 mV)
Movement of the sum, −40 to 125 °C at ff: 1.073 mV (needs ≤ 2 mV)
Rise of the PTAT part: 232.9 mV (needs ≥ 100 mV)
Sum at 27 °C: 771.7 mV (needs ≥ 700 mV)

The sum moves 0.62 mV at tt and at most 1.07 mV in the corners, around 0.772 V.

Constraints and Contract

  • The netlist defines .subckt tref ctat ptat ... .ends exactly once, with these ports in this order.
  • Inside tref: X instances of sky130_fd_pr__nfet_01v8, I sources with one constant value, and linear E sources.
  • An E source has a number for its gain: E1 ptat 0 n2 ctat 7.5. POLY, vol=, value= and expressions are refused.
  • No resistors, voltage sources or B sources. The grader writes the .lib line for each corner itself.

Hints

Hint 1

The lesson explains why its 102 mV missed the formula. One of its two devices is not in weak inversion.

Hint 2

A device moves toward weak inversion with less current or more width. Check gm/ID of both devices.

Hint 3

Zero slope at 27 °C leaves the two ends unequal. Choose the weight that makes the cold end and the hot end agree.

Hint 4

The weight needs three or four digits. A 1 % error tilts the sum by more than 1 mV.

What the grader checks: The grader sweeps the temperature from −40 to 125 °C at tt, ss and ff and adds your two outputs. All numbers come from ngspice 42 with the pinned SKY130 models, measured 2026-11-12. The sources and the adder are ideal, and the library has no bipolar transistor. A real bandgap also needs resistor ratios, an amplifier, a start-up and mismatch analysis.

Run simulates your netlist as written, with your own analyses and measurements. Submit sends it to the grader, which keeps only the subcircuit tref and makes 3 ngspice runs. 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

Report a problem with this page

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