From switch to device

Sweep a SKY130 CMOS inverter in SPICE, read its switching threshold and gain off the transfer curve, and see the current a logic gate draws when its input sits between the rails.

Lesson
E2.1
Time
25 min
Runs on
ngspice
Check
5 questions

A chip failed its quiescent-current test, which measures the supply current while nothing switches. One input pin had been left unconnected and floated near the middle of the 1.8 V supply, so the inverter it fed had both transistors partly on.

DC sweepSupply current of one inverter against its input voltageThe input is swept from 0 to 1.8 V. On the log axis each grid line is ten times the one below.
1 pA10 pA100 pA1 nA10 nA100 nA1 µA10 µA100 µASupply current00.2 V0.4 V0.6 V0.8 V1.0 V1.2 V1.4 V1.6 V1.8 VInput voltage v(in)input at 0 V: 2.0 pAfloating at 0.9 V: 19.2 µA1 pA100 pA10 nA1 µA100 µASupply current00.5 V1.0 V1.5 VInput voltage v(in)input at 0 V: 2.0 pAfloating at 0.9 V: 19.2 µA
  1. Input voltage v(in) 0 Vidd = 2.046 pA

    Input at 0 V: the inverter draws 2.0 pA, the digital picture of a gate at rest.

  2. Input voltage v(in) 900 mVidd = 19.17 µA

    Input floating at 0.9 V: 19.2 µA, about ten million times more. Both transistors conduct.

  3. Input voltage v(in) 1.8 Vidd = 319.9 pA

    Input at 1.8 V: back below a nanoamp, with the PMOS off.

Read the plot as a table
Input voltage v(in)idd
0 V2.046 pA
200 mV40 pA
400 mV5.999 nA
600 mV695.4 nA
800 mV15.14 µA
900 mV19.17 µA
1 V11.71 µA
1.2 V2.051 µA
1.4 V119.5 nA
1.6 V6.927 nA
1.8 V319.9 pA

Measured on ngspice 42, SKY130 tt (600 of 1801 points).

An inverter draws almost nothing only while its input sits at a rail; in between, each switch is a device that conducts a little, then a lot.

The inverter's transfer curve

The inverter on the benchA PMOS MP pulls the output up to VDD, an NMOS MN pulls it down to ground, and one source drives both gates.
The inverter on the bench+−VDD1.8 VMPW/L = 1/0.15MNW/L = 1/0.15VINswept 0 → 1.8 Voutin
  1. Input low

    At 0 V the NMOS is off and the PMOS is on. The output sits at VDD, with no path from VDD to ground.

  2. Input near the middle

    Near 0.84 V both transistors conduct, and current flows from VDD through both to ground.

    IDD

  3. Input high

    At 1.8 V the PMOS is off and the NMOS holds the output at ground.

Read the circuit as text
  • MP PMOS transistor (W/L = 1/0.15): gate → in, source → VDD, drain → n1
  • MN NMOS transistor (W/L = 1/0.15): gate → in, drain → n1, source → 0
  • VIN voltage source (swept 0 → 1.8 V): + → in, − → 0
  • out port: terminal → n1

Bodies are tied to the sources: NMOS to ground, PMOS to VDD.

Sweep the input slowly from 0 to 1.8 V and plot the output. That curve is the voltage transfer curve, drawn below with the supply current underneath. The current is idd = -i(VDD). SPICE counts current into a source's + terminal as positive, so a supply that delivers current reads below zero.

DC sweepTransfer curve and supply current, measuredVoltages above, supply current below. Drag across the plot to read all three.
  • v(out)
  • v(in)
  • idd
00.5 V1.0 V1.5 V2.0 VVoltage05 µA10 µA15 µA20 µA25 µASupply current00.2 V0.4 V0.6 V0.8 V1.0 V1.2 V1.4 V1.6 V1.8 VInput voltage v(in)VIL: slope −1VM: v(out) = v(in)VIH: slope −100.5 V1.0 V1.5 V2.0 VVoltage05 µA10 µA15 µA20 µA25 µASupply current00.5 V1.0 V1.5 VInput voltage v(in)VIL: slope −1VM: v(out) = v(in)VIH: slope −1
  1. Input voltage v(in) 300 mVv(out) = 1.8 V · v(in) = 300 mV · idd = 484.8 pA

    At 0.3 V the NMOS is off: its gate is far below the voltage at which it starts to conduct. The output is 1.8 V and the current is under a nanoamp.

  2. Input voltage v(in) 703.5 mVv(out) = 1.751 V · v(in) = 703.5 mV · idd = 4.877 µA

    At 0.703 V the slope of the curve reaches −1. This input is VIL, the highest input still read as a clean low. The NMOS now conducts 4.9 µA.

  3. Input voltage v(in) 837 mVv(out) = 837.1 mV · v(in) = 837 mV · idd = 17.58 µA

    At 0.837 V the output equals the input. This is the switching threshold VM. Around here a small input change moves the output up to 13 times as far.

  4. Input voltage v(in) 889 mVv(out) = 233.7 mV · v(in) = 889 mV · idd = 19.39 µA

    The current peaks at 19.4 µA when the input is 0.889 V. Both transistors are on, and the output has already fallen to 0.23 V.

  5. Input voltage v(in) 939.5 mVv(out) = 69.2 mV · v(in) = 939.5 mV · idd = 16.37 µA

    At 0.939 V the slope is −1 again. This is VIH, the lowest input read as a clean high. The output is down to 69 mV.

  6. Input voltage v(in) 1.5 Vv(out) = 28.28 µV · v(in) = 1.5 V · idd = 28.1 nA

    At 1.5 V the PMOS is almost off. The output is 28 µV above ground and the current has fallen to 28 nA.

Read the plot as a table
Input voltage v(in)v(out)v(in)idd
0 V1.8 V0 V2.046 pA
200 mV1.8 V200 mV40 pA
300 mV1.8 V300 mV484.8 pA
400 mV1.8 V400 mV5.999 nA
600 mV1.795 V600 mV695.4 nA
703.5 mV1.751 V703.5 mV4.877 µA
800 mV1.32 V800 mV15.14 µA
837 mV837.1 mV837 mV17.58 µA
889 mV233.7 mV889 mV19.39 µA
939.5 mV69.2 mV939.5 mV16.37 µA
1 V32.73 mV1 V11.71 µA
1.2 V3.086 mV1.2 V2.051 µA
1.4 V133.2 µV1.4 V119.5 nA
1.5 V28.28 µV1.5 V28.1 nA
1.6 V6.41 µV1.6 V6.927 nA
1.8 V260.6 nV1.8 V319.9 pA

Measured on ngspice 42, SKY130 tt (600 of 1801 points). The dashed v(in) crosses v(out) at VM.

The curve has three parts. With the input low, only the PMOS conducts and the output is a clean 1.8 V. With the input high, only the NMOS conducts and the output is a clean 0 V. In a narrow band around 0.84 V both conduct, and the output swings through most of the supply.

The steepest slope is the inverter's gain: −13.2 at an input of 0.813 V. A gain larger than one is what restores a logic level, since a slightly wrong input comes out closer to a rail. The two points where the slope is −1, VIL and VIH, bound that band. Inputs between them are neither a clean 0 nor a clean 1.

The SKY130 transistor in a netlist

Each transistor is one line. The first word starts with X, because the SKY130 models are subcircuits: small netlists wrapped around the model with their own parameters. The four nodes follow in a fixed order: drain, gate, source and body. Then come the model name and the width W and length L.

The inverter of the lab. _nfet_01v8 and _pfet_01v8 are the 1.8 V core devices.
*   name drain gate source body model                   W     L
XMN  out  in   0      0    sky130_fd_pr__nfet_01v8 W=1   L=0.15
XMP  out  in   vdd    vdd  sky130_fd_pr__pfet_01v8 W=1   L=0.15

W and L are in micrometres: the PDK's model files set the option scale=1u, which multiplies every MOSFET width and length by 10−6. The body is the fourth terminal, the silicon under the channel. An NMOS sits in p-type silicon, normally tied to ground. A PMOS sits in an n-type well, tied to VDD. Both ties keep the junctions around the source and drain reverse biased.

The models only cover certain sizes. SKY130 splits the size range into bins, each fitted to measured devices, and a size outside every bin stops the run with "could not find a valid modelname". In this release the model file covers L from 0.15 to 20.2 µm and W from 0.42 µm. A run at W = 0.41 µm or L = 0.14 µm fails; W = 0.42 µm runs.

Sizes written in metres

XMN out in 0 0 sky130_fd_pr__nfet_01v8 W=1u L=0.15u

The run stops: "could not find a valid modelname". With scale=1u, W=1u becomes 10−12 m, far below the smallest bin.

Sizes written in micrometres

XMN out in 0 0 sky130_fd_pr__nfet_01v8 W=1 L=0.15

Runs: a 1 µm wide, 0.15 µm long NMOS, inside the model's bins.

Both measured on ngspice 42 with the SKY130 tt library.

Why equal widths switch below mid-rail

At VM the two transistors carry the same current, since the output draws none. With equal sizes the NMOS has 0.837 V of gate drive and the PMOS has 1.8 − 0.837 = 0.963 V. The PMOS needs more drive for the same current, because holes move more slowly than electrons and its threshold is larger (E2.2). So the NMOS wins the tie at a lower input.

Widen the PMOS and it carries more current at the same drive, so the tie moves up. The lab runs three inverters that differ only in PMOS width, and a fourth with both widths doubled.

PMOS width WPVMPeak supply current
1 µmvm1 = 8.370250e-01ipeak1 = 1.938638e-05
2 µmvm2 = 8.721794e-01ipeak2 = 2.848677e-05
3 µmvm3 = 8.931425e-01ipeak3 = 3.477532e-05
2 µm, with NMOS 2 µmvm4 = 8.176825e-01ipeak4 = 4.078976e-05

NMOS W = 1 µm in the first three rows; L = 0.15 µm everywhere. Measured on the lab netlist.

Three times the PMOS width still leaves VM 7 mV below 0.9 V. A balanced SKY130 inverter needs a PMOS more than three times as wide as its NMOS. The wider PMOS also raises the peak current, because more current flows through both devices at the crossing.

The last row tests a textbook rule: VM depends only on the ratio of the two widths, so doubling both should change nothing but the current. The run disagrees. VM drops by 19 mV and the peak current grows 2.10 times. At widths near 1 µm, a SKY130 device's current is not proportional to its width. Near VM, going from 1 to 2 µm multiplies the NMOS current by 2.59 but the PMOS current by only 1.83, so the NMOS wins the tie at a lower input. Ratios from a formula are a starting point; the simulator has the last word.

Asked in interviews
  1. Draw an inverter's transfer curve and mark VM, VIL and VIH.

    Output against input: high, a steep fall, then low. VM is where vout = vin; VIL and VIH are the two points where the slope is −1. On SKY130 with 1/0.15 µm devices: 0.703, 0.837 and 0.939 V.

  2. Why does a floating CMOS input burn power?

    It drifts toward the middle of the supply, where both transistors conduct, so current flows from VDD to ground all the time. One SKY130 inverter draws 19.2 µA at 0.9 V against 2.0 pA at 0 V.

  3. Why is the PMOS made wider than the NMOS?

    At the same size and drive it carries less current: lower hole mobility and a larger threshold. Widening it moves VM toward mid-rail and evens the rise and fall. In SKY130 even three times the width leaves VM below 0.9 V.

Try it

Run it, then open Plots to see the three transfer curves side by side. WHEN v(out1)=v(in) finds where the two curves cross. deriv gives the slope, so WHEN slope1=-1 finds VIL and VIH, and MIN slope1 finds the peak gain.

Predict before you change anything. Set XN1 to W=2: which way does vm1 move? Then find, by a few runs, the PMOS width that puts VM at 0.900 V.

SPICEngspice 42 · simulator service
Edit the netlist, then run it
Expected measurements: vm1 = 8.370250e-01 vil1 = 7.034968e-01 vih1 = 9.394829e-01 gain1 = -1.317269e+01 at= 8.130000e-01 ipeak1 = 1.938638e-05 at= 8.890000e-01 i_float = 1.917971e-05 vm2 = 8.721794e-01 ipeak2 = 2.848677e-05 at= 9.300000e-01 vm3 = 8.931425e-01 ipeak3 = 3.477532e-05 at= 9.530000e-01 vm4 = 8.176825e-01 ipeak4 = 4.078976e-05 at= 8.690000e-01

Check yourself

Predict the outputThe lab's first inverter now has its input wired to its own output. Type the line meas prints, in the format ngspice uses (for example vself = 1.000000e+00).
* an inverter with its input tied to its own output
.lib sky130 tt
VDD vdd 0 1.8
XMP out out vdd vdd sky130_fd_pr__pfet_01v8 W=1 L=0.15
XMN out out 0 0 sky130_fd_pr__nfet_01v8 W=1 L=0.15
.control
dc VDD 1.8 1.81 0.01
meas dc vself FIND v(out) AT=1.8
.endc
.end
ConceptIn the lab's first inverter, the NMOS width goes from 1 µm to 2 µm and nothing else changes. What happens to VM?
ConceptRead the transfer-curve figure. At what input does the slope of vout pass −1 for the second time?
ConceptWhy does an inverter with a floating input draw current from the supply all the time?
ConceptEach line replaces one transistor of the lab's first inverter. Which one makes the inverter draw a large current even with its input at a rail?

Remember

  • An inverter's transfer curve has a steep middle where both transistors conduct; outside it one device is off and the gate draws almost nothing.
  • VM is where vout = vin; VIL and VIH are where the slope is −1. On SKY130 1/0.15 µm devices they are 0.837, 0.703 and 0.939 V, with a peak gain of −13.2.
  • A SKY130 transistor is an X line: drain, gate, source, body, model, then W and L in µm. NMOS body to ground, PMOS body to VDD.
  • With equal widths the weaker PMOS puts VM below mid-rail; even three times the PMOS width leaves it at 0.893 V.