A sensor signal sits 0.2 V above ground and the telescopic input stage is dead there. Build a folded cascode stage that gives 72 dB at that level, inside 60 µA.
Circuit context: A folded cascode input stage of a sensor interface: a PMOS pair on a mirrored tail, an NMOS sink and cascode, with two 5 µA references and an ideal 15 µA load. Build the input stage of a sensor amplifier whose signal rests near ground.
A sensor interface receives a signal that rests 0.2 V above ground. The team's input stage is a telescopic cascode on an NMOS pair. At 0.2 V its pair is off: the output sticks at the supply and the stage has no gain.
Replace the stage inside the subcircuit fold. The bench around it gives you two 5 µA reference currents and a 1.2 V bias for a cascode gate. It also puts a 15 µA load on the output, and your stage must sink that current.
The bench drives gate inp and holds gate inn at the same level. A slow servo then moves inn until the output rests at 0.9 V. The gate difference it needs is your offset.
Meet the gain at 0.2 V at three corners. At tt, also meet the gain at 0.4 V, the speed, the offset and the supply current.
What the Grader Measures
Your subcircuit fold (ports inp, inn, out, bp, bn, vb, vdd) under the grader's own bench, one run per corner (tt, ss, ff):
| Check | Corner | Rule |
|---|---|---|
| Gain at an input level of 0.2 V | tt | ≥ 72 dB |
| Gain at an input level of 0.4 V | tt | ≥ 72 dB |
| Unity-gain frequency | tt | ≥ 14 MHz |
| Offset | tt | -5 mV to 5 mV |
| Supply current | tt | ≤ 60 µA |
| Gain at an input level of 0.2 V | ss | ≥ 72 dB |
| Gain at an input level of 0.2 V | ff | ≥ 72 dB |
Full specification
.subckt fold inp inn out bp bn vb vdd
* SKY130 1.8 V FETs (sky130_fd_pr__nfet_01v8, sky130_fd_pr__pfet_01v8), resistors and capacitors
.ends
| Pin | What the bench connects |
|---|---|
| inp, inn | The two input gates. Both rest at the input level; inp carries the AC signal. |
| out | A 15 µA current source from the supply, and 1 pF to ground. |
| bp | A reference that pulls 5 µA out of the pin, for a PMOS diode to the supply. |
| bn | A reference that pushes 5 µA into the pin, for an NMOS diode to ground. |
| vb | 1.2 V, for a cascode gate. |
| vdd | The 1.8 V supply. |
| Check | Corner | Rule | How the grader measures it |
|---|---|---|---|
| Gain, input level 0.2 V | tt, ss, ff | ≥ 72 dB | ac: v(out) in dB at 1 kHz, AC 1 on inp |
| Gain, input level 0.4 V | tt | ≥ 72 dB | the same, after the level moves to 0.4 V |
| Unity-gain frequency | tt | ≥ 14 MHz | ac: where the gain falls to 0 dB, at 0.2 V |
| Offset | tt | −5 mV to 5 mV | op: v(inn) − v(inp) with the output at 0.9 V |
| Supply current | tt | ≤ 60 µA | op: all current out of the 1.8 V source |
The supply current counts everything: your stage, the 15 µA load and both 5 µA references. That leaves at most 35 µA for your tail.
The grader runs its bench once per corner, at 27 °C. A check whose measurement fails counts as not met.
Examples
Example 1
The Starter: A Telescopic Stage- Design
.subckt fold inp inn out bp bn vb vdd * the telescopic stage: it needs its gates near 1 V XMNR bn bn 0 0 sky130_fd_pr__nfet_01v8 W=2 L=1 XMT s bn 0 0 sky130_fd_pr__nfet_01v8 W=2 L=1 m=6 XM1 x inp s 0 sky130_fd_pr__nfet_01v8 W=4 L=0.5 XM1B vdd inn s 0 sky130_fd_pr__nfet_01v8 W=4 L=0.5 XM2 out vb x 0 sky130_fd_pr__nfet_01v8 W=4 L=0.5 .ends
- Measured by the grader
Gain at an input level of 0.2 V: -105.1 dB (needs ≥ 72 dB) Gain at an input level of 0.4 V: -59.71 dB (needs ≥ 72 dB) Supply current: 5 µA (needs ≤ 60 µA) Offset: -300 mV (needs -5 mV to 5 mV)
At 0.2 V the NMOS pair is off. Nothing sinks the load, so the output sits at the supply and the servo stops at its −0.3 V limit. The gain never reaches 0 dB, so the unity-gain frequency has no value.
Example 2
A Folded Stage with Every Device 0.5 µm Long- Design
.subckt fold inp inn out bp bn vb vdd XMPR bp bp vdd vdd sky130_fd_pr__pfet_01v8 W=4 L=0.5 XMT s bp vdd vdd sky130_fd_pr__pfet_01v8 W=4 L=0.5 m=6 XM1 x inp s vdd sky130_fd_pr__pfet_01v8 W=16 L=0.5 XM1B 0 inn s vdd sky130_fd_pr__pfet_01v8 W=16 L=0.5 XMNR bn bn 0 0 sky130_fd_pr__nfet_01v8 W=2 L=0.5 XM3 x bn 0 0 sky130_fd_pr__nfet_01v8 W=2 L=0.5 m=6 XM2 out vb x 0 sky130_fd_pr__nfet_01v8 W=4 L=0.5 .ends
- Measured by the grader
Gain at an input level of 0.2 V: 64.76 dB (needs ≥ 72 dB) Gain at an input level of 0.2 V at ss: 65.02 dB (needs ≥ 72 dB) Gain at an input level of 0.2 V at ff: 64.44 dB (needs ≥ 72 dB) Gain at an input level of 0.4 V: 64.66 dB (needs ≥ 72 dB) Unity-gain frequency: 15.12 MHz (needs ≥ 14 MHz) Supply current: 52.91 µA (needs ≤ 60 µA) Offset: -1.283 mV (needs -5 mV to 5 mV)
Folding fixes the input level: the stage is alive, balanced and fast enough. Its gain is 7 dB short, because short devices have a low r_{o}.
Example 3
A Folded Stage with a Starved Sink- Design
.subckt fold inp inn out bp bn vb vdd XMPR bp bp vdd vdd sky130_fd_pr__pfet_01v8 W=4 L=1 XMT s bp vdd vdd sky130_fd_pr__pfet_01v8 W=4 L=1 m=6 XM1 x inp s vdd sky130_fd_pr__pfet_01v8 W=24 L=0.5 XM1B 0 inn s vdd sky130_fd_pr__pfet_01v8 W=24 L=0.5 XMNR bn bn 0 0 sky130_fd_pr__nfet_01v8 W=4 L=2 XM3 x bn 0 0 sky130_fd_pr__nfet_01v8 W=4 L=2 m=4 XM2 out vb x 0 sky130_fd_pr__nfet_01v8 W=16 L=1 .ends
- Measured by the grader
Gain at an input level of 0.2 V: 73.18 dB (needs ≥ 72 dB) Gain at an input level of 0.2 V at ss: 73.3 dB (needs ≥ 72 dB) Gain at an input level of 0.2 V at ff: 73.03 dB (needs ≥ 72 dB) Gain at an input level of 0.4 V: 73.21 dB (needs ≥ 72 dB) Unity-gain frequency: 10.12 MHz (needs ≥ 14 MHz) Supply current: 54.33 µA (needs ≤ 60 µA) Offset: -104.3 mV (needs -5 mV to 5 mV)
The sink carries 19.6 µA and the load alone needs 15 µA. Only 4.6 µA is left for M1, so the servo tilts the pair by 104 mV. M1 loses g_{m}, and the unity-gain frequency falls to 10.1 MHz.
Constraints and Contract
- The netlist defines .subckt fold inp inn out bp bn vb vdd ... .ends exactly once, with these ports in this order.
- Inside fold: X instances of sky130_fd_pr__nfet_01v8 or sky130_fd_pr__pfet_01v8, resistors, capacitors, comments and .param lines. No sources: every current must come from bp, bn or the supply.
- The grader writes the .lib line for each corner itself. Everything outside fold is replaced by its bench.
Hints
Hint 1
An NMOS pair needs its gates about one VGS plus a tail voltage above ground. A PMOS pair hangs from the supply, so its gates can sit near ground. Mirror its tail from bp.
Hint 2
The sink must carry the 15 µA of the load plus the current of one input device. If it carries less, the servo must tilt the pair, and that tilt is offset. A multiplier such as m=3 places three equal devices in parallel.
Hint 3
The gain is the input device's gm times Rout. Rout grows with the resistance under the cascode and with the cascode's own gmro. Length raises both. The unity-gain frequency needs gm, so keep enough current and width in the input pair.
What the grader checks: The grader places fold under its own bench, on a 1.8 V supply. The bench has two 5 µA references, a 1.2 V cascode bias, an ideal 15 µA load and 1 pF. It reads the gain, unity-gain frequency, offset and supply current with hidden measurements at tt, ss and ff, 27 °C. Engine: ngspice 42 (libngspice0 42+ds-3build1) with the pinned SKY130 models, measured 2026-11-12 with tools/spice-judge.mjs. The load is ideal, so the gain is the stage's own. The grader does not check output swing, noise, mismatch, temperature or the input range above 0.4 V. It checks numbers, not the topology: any stage that meets them passes, folded or not.
Run simulates your netlist as written, with your own analyses and measurements. Submit sends it to the grader, which keeps only the subcircuit fold 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