Write the bench that extracts a threshold two ways and signs off a device type on both. It must pass three correct devices and fail four faulty ones.
Circuit context: One NMOS type with W/L = 5 whose threshold sets the currents of a bias block, tested at a drain voltage of 50 mV. Write the sign-off bench for a device type whose threshold is quoted two ways.
A bias block uses one NMOS type with W/L = 5. Its threshold must sit in a window, or the block's currents move too far. The foundry quotes the threshold two ways, so the sign-off checks both.
The first is the constant-current threshold: the V_GS at which I_D reaches 100 nA × W/L. The second is the extrapolated threshold. Draw the tangent to I_D where g_m is largest, find where it reaches zero current, and subtract V_DS/2. Both use V_DS = 50 mV.
Write the bench. Extract both thresholds of the device in the subcircuit dev, compare each with its window, and print the verdict as pass.
The grader swaps each device it tests into your dev block. Your device and two hidden correct devices must get pass = 1. The correct devices have other lengths but the same W/L. Four hidden faulty devices must not pass. Two of them fail only one of the two methods.
What the Grader Measures
Your bench, with each of these designs swapped into dev; it must print pass = 1 on the good ones and not on the faulty ones.
| Requirement your bench checks | Limit |
|---|---|
| V_th by constant current (I_D = 100 nA × W/L, W/L = 5) at V_DS = 50 mV | 0.560 V to 0.600 V |
| V_th by extrapolation (tangent at maximum g_m, minus V_DS/2) at V_DS = 50 mV | 0.608 V to 0.648 V |
| Design | Your verdict must be |
|---|---|
| The W = 3 µm, L = 0.6 µm device in your netlist | PASS |
| A correct device at W = 2.5 µm, L = 0.5 µm | PASS |
| A correct device at W = 3.5 µm, L = 0.7 µm | PASS |
| 4 hidden faulty designs | FAIL |
Full specification
| Requirement | Window | Conditions (tt, 27 °C) |
|---|---|---|
| V_th by constant current | 0.560 V to 0.600 V | V_DS = 50 mV; the V_GS where I_D = 100 nA × W/L, with W/L = 5 |
| V_th by extrapolation | 0.608 V to 0.648 V | V_DS = 50 mV; the tangent at maximum g_m, extended to I_D = 0, minus V_DS/2 |
let pass = ... * 1 if both thresholds sit in their windows, 0 if not
print pass
Every hidden device sits at least 5 mV from each limit it must meet or miss. A bench that extracts each threshold to within 5 mV decides every device correctly. A design for which your bench prints no verdict counts as FAIL, and so does a run that stops with an error. The grader writes .lib sky130 tt itself.
Examples
Example 1
The Reference Device in the Reference Bench- Setup
dc VGS 0 1.8 0.002 at V_DS = 50 mV; I_D = 500 nA crossing; tangent at maximum g_m
- Measured
vt_cc = 0.5795 V vt_ext = 0.6273 V pass = 1
Both thresholds sit near the middle of their windows. The two methods differ by 48 mV on this device.
Example 2
The Same Device Read at a Flat 100 nA- Setup
meas dc vt_cc WHEN id=100n
- Measured
vt_cc = 0.5076 V pass = 0
The criterion is 100 nA × W/L = 500 nA. At 100 nA the reading is 72 mV low, and the bench fails a good device.
Example 3
The Same Device Without the V_DS/2 Term- Setup
let vt_ext = vg_max - id_max/gm_max
- Measured
vt_ext = 0.6523 V pass = 0
The tangent reaches zero at V_th + V_DS/2. Leaving the 25 mV in puts a good device above its window.
Constraints and Contract
- Keep exactly one .subckt dev d g ... .ends block. The grader replaces it with each device it tests, so changes inside it are not graded.
- The bench sees the device only through its two ports. The source and body are ground inside. Use no @device parameters, no nodes inside x instances, no show or altermod.
- Print the verdict as pass (or measure it with .meas ... pass ...); any value of at least 0.5 counts as PASS.
Hints
Hint 1
The criterion current scales with the device: 100 nA × 5. Find its crossing with meas dc ... WHEN on the swept current.
Hint 2
deriv(id) gives g_m along the sweep. The tangent at the peak reaches zero at V_Gpeak − I_Dpeak/g_mpeak.
Hint 3
g_m touches its peak value at one sample and never crosses it. A WHEN search for that value can find nothing on some devices. meas dc ... MAX_AT returns the gate voltage of the peak directly.
Hint 4
Check each threshold against its own window. A fault can move one threshold and leave the other in place.
What the grader checks: The grader runs your bench on the reference device, two hidden correct devices and four hidden faulty ones. It compares your printed verdict with the right one for each. It grades the decisions, not the numbers you print. Engine: ngspice 42 (libngspice0 42+ds-3build1) with the pinned SKY130 models, measured 2026-11-12 with tools/spice-judge.mjs, tt, 27 °C. Other corners, temperatures and drain voltages are outside this spec.
Run simulates your netlist as written, with your own analyses and measurements. Submit sends it to the grader, which keeps only your bench and makes 7 ngspice runs, one per design. 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