The Transistor as a Switch and the CMOS Inverter

Explain a CMOS inverter as two switches, then read its measured transfer curve, its delay and its supply current.

You Will Be Able To

  • State when an NMOS and a PMOS switch conduct.
  • Read the switching point and the safe input levels from a transfer curve.
  • Explain why the PMOS of an inverter is made wider than the NMOS.
  • Say when a CMOS gate draws supply current.
Lesson
G9.1
Time
25 min
Runs on
ngspice
Check
5 questions

A designer took 0.9 V, half the supply, as the line between 0 and 1. A slow sensor line rested at 0.87 V, and the design counted on a clean 1 at the inverter output. The output was 0.434 V. This inverter switches at 0.837 V.

DC sweepThe Inverter Output Against Its Input, MeasuredThe input goes slowly from 0 V to 1.8 V. Both transistors are 1 µm wide. The second curve is the input itself.
  • v(out)
  • v(in)
00.5 V1.0 V1.5 V2.0 VVoltage00.2 V0.4 V0.6 V0.8 V1.0 V1.2 V1.4 V1.6 V1.8 VInput voltage v(in)switching point: 0.837 Vinput 0.87 V: output 0.434 V00.5 V1.0 V1.5 V2.0 VVoltage00.5 V1.0 V1.5 VInput voltage v(in)switching point: 0.837 Vinput 0.87 V: output 0.434 V
  1. Input voltage v(in) 300 mVv(out) = 1.8 V · v(in) = 300 mV

    A low input gives a full 1.8 V at the output. Only the PMOS conducts.

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

    At 0.703 V the curve starts to fall quickly. Up to here the input counts as a clean 0.

  3. Input voltage v(in) 837 mVv(out) = 837.1 mV · v(in) = 837 mV

    At 0.837 V the output equals the input. This is the switching point. It is below 0.9 V, half the supply.

  4. Input voltage v(in) 870 mVv(out) = 433.8 mV · v(in) = 870 mV

    An input of 0.87 V is still under 0.9 V, but the output has already dropped to 0.434 V.

  5. Input voltage v(in) 939.5 mVv(out) = 69.24 mV · v(in) = 939.5 mV

    At 0.939 V the curve becomes flat again. From here on the input counts as a clean 1.

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

    A high input gives 0 V at the output. Only the NMOS conducts.

Read the plot as a table
Input voltage v(in)v(out)v(in)
0 V1.8 V0 V
200 mV1.8 V200 mV
300 mV1.8 V300 mV
400 mV1.8 V400 mV
600 mV1.795 V600 mV
703.5 mV1.751 V703.5 mV
800 mV1.32 V800 mV
837 mV837.1 mV837 mV
870 mV433.8 mV870 mV
939.5 mV69.24 mV939.5 mV
1 V32.74 mV1 V
1.2 V3.085 mV1.2 V
1.4 V133.3 µV1.4 V
1.5 V28.28 µV1.5 V
1.6 V6.412 µV1.6 V
1.8 V260.6 nV1.8 V

Measured with ngspice 42 on SKY130, 1.8 V (400 of 1801 points).

A Transistor Is a Switch

A logic gate is built from MOS transistors. In a gate, each transistor works as a switch. The voltage on its gate terminal opens or closes the path between its two other terminals.

TransistorOn (path closed) when its gate isUsed to connect the output to
NMOS1 (high)ground: it pulls the output down
PMOS0 (low)VDD: it pulls the output up

The two types react to opposite gate levels. CMOS means that a gate uses both types.

A CMOS InverterOne PMOS between the supply and the output, one NMOS between the output and ground. The input a controls both gates.
A CMOS inverterVDD1.8 VMPMNay
  1. VDD · supply1.8 Vvdd → VDD
  2. MP · PMOS transistorgate → n1 · source → VDD · drain → n2
  3. MN · NMOS transistorgate → n1 · drain → n2 · source → 0
  4. gnd · groundgnd → 0
  5. a · portterminal → n1
  6. y · portterminal → n2
  1. a = 0: y = 1

    The gate of MP is low, so MP is on. It connects y to VDD. MN is off, so no path leads to ground.

    charges y

  2. a = 1: y = 0

    The gate of MN is high, so MN is on. It connects y to ground. MP is off, so no path leads to VDD.

    empties y

Read the circuit as text
  • MP PMOS transistor: gate → n1, source → VDD, drain → n2
  • MN NMOS transistor: gate → n1, drain → n2, source → 0
  • a port: terminal → n1
  • y port: terminal → n2

For each input one transistor conducts and the other is off. The output is always the opposite of the input.

The PMOS side is the pull-up network. The NMOS side is the pull-down network. In a steady state exactly one of them conducts, so the output is a full 1 or a full 0.

Icarus Verilog has the switch primitives pmos and nmos. Their terminals are output, input and control. Two lines describe the inverter.

Logic Levels Are Voltages

A wire in a chip carries a voltage, and the gate that reads it must decide between 0 and 1. The curve at the top of this lesson shows how the inverter decides. Its name is the transfer curve.

The curve has two flat parts and one steep part. On the flat parts a small change of the input changes the output very little. On the steep part the output moves up to 13 times as far as the input.

NameMeaningMeasured
VILthe highest input that still counts as 00.703 V
VIHthe lowest input that still counts as 10.939 V
VOHthe output when the input is at VIL1.751 V
VOLthe output when the input is at VIH0.069 V
Switching pointthe input at which the output equals the input0.837 V

Measured with ngspice on SKY130, both widths 1 µm. VIL and VIH are the two points where the slope of the curve is −1.

The next gate has the same curve. It reads any input below 0.703 V as 0, and this gate sends at most 0.069 V for a 0. The gap of about 0.63 V is the noise margin for a low level. For a high level the margin is 1.751 V minus 0.939 V, about 0.81 V.

Noise that stays inside the margin does no harm. The flat part of the curve removes it, and the output is a clean level again. This is why digital signals survive long chains of gates.

Delay into a Load

The output of a gate drives wires and the gates of other transistors. Together they act as a small capacitor, the load. The output can change only as fast as a transistor can charge or empty that capacitor.

Which Transistor Moves the OutputArrows show the path of the charge. The load is 10 fF in the lab.
  • Power
  • Device
  • I/O
  • Power
CallValueReturnWaiting
Which transistor moves the outputArrows show the path of the charge. The load is 10 fF in the lab. power VDD 1.8 V supply power Ground 0 V device PMOS on while the input is 0 device NMOS on while the input is 1 io Output y the load: 10 fF supplycharges yempties yto ground
  1. power VDD1.8 V supply
    • supply → PMOS
  2. device PMOSon while the input is 0
    • charges y → Output y
  3. io Output ythe load: 10 fF
    • empties y → NMOS
  4. device NMOSon while the input is 1
    • to ground → Ground
  5. power Ground0 V
  1. The input falls: the output rises

    The PMOS turns on. Charge flows from VDD through the PMOS into the load. With a 2 µm PMOS the output crosses 0.9 V after 45.7 ps.

    Follow the calls, values and waits
    1. data charge: VDD → PMOS
    2. data charge: PMOS → Output y
  2. The input rises: the output falls

    The NMOS turns on. The charge leaves the load through the NMOS to ground. With a 1 µm NMOS the output crosses 0.9 V after 37.3 ps.

    Follow the calls, values and waits
    1. data charge: Output y → NMOS
    2. data charge: NMOS → Ground
Read the diagram as text
  • VDD: 1.8 V supply
  • Ground: 0 V
  • PMOS: on while the input is 0
  • NMOS: on while the input is 1
  • Output y: the load: 10 fF
  • VDD → PMOS: supply
  • PMOS → Output y: charges y
  • Output y → NMOS: empties y
  • NMOS → Ground: to ground

The rise delay belongs to the PMOS. The fall delay belongs to the NMOS.

Delay is counted from the moment the input crosses 0.9 V to the moment the output crosses 0.9 V. A wider transistor carries more current, so it moves the load sooner.

NMOS widthPMOS widthOutput fallsOutput rises
1 µm1 µm35.8 ps76.5 ps
1 µm2 µm37.3 ps45.7 ps
1 µm2.7 µm38.3 ps38.0 ps

Measured with ngspice: 10 fF load, 50 ps input edge, typical corner, 1.8 V. Delay runs from 50 % of the input to 50 % of the output.

At equal widths the rise takes about twice as long as the fall. A PMOS carries less current than an NMOS of the same size: 183.3 µA against 475.6 µA here. Lesson E2.1 in the Analog track explains the physics.

Designers make the PMOS wider to balance the two delays. Here a 2.7 µm PMOS gives 38.0 ps against 38.3 ps. The wider PMOS also adds a little capacitance at the output, so the fall gets slightly slower.

Static Power Is Close to Zero

In a steady state one of the two transistors is off. No path leads from VDD to ground, so almost no current flows. The gates of the next stage are insulated and take no steady current either.

State of the inverterSupply current
Input held at 0 V2.0 pA
Input held at 1.8 V320 pA
Input at 0.889 V, in the middle of a change19.4 µA

Measured with ngspice on SKY130, both widths 1 µm. The small currents at rest are leakage through the transistor that is off.

In the middle of a change both transistors conduct for a moment. The current is then about 60,000 times the larger rest value. A CMOS gate uses power mainly when it switches: to charge the load, and for this short overlap.

Asked in interviews
  1. Explain how a CMOS inverter works.

    A PMOS connects the output to VDD and an NMOS connects it to ground. The input drives both gates. A low input turns the PMOS on and the NMOS off, so the output is high. A high input does the opposite. In a steady state only one of them conducts.

  2. Why is the PMOS wider than the NMOS in an inverter?

    Holes move more slowly than electrons, so a PMOS carries less current than an NMOS of the same size. With equal widths the output rises more slowly than it falls. A wider PMOS balances the two delays and moves the switching point towards half the supply.

  3. Where does a CMOS gate use power?

    Mostly when it switches. Each change charges or empties the load capacitor, and for a short time both transistors conduct. At rest only a small leakage current flows, because one transistor is off.

Try It

The netlist holds two inverters. The first one is swept slowly: vm = 8.370250e-01 is its switching point, 0.837 V. The second one has a 2 µm PMOS and a 10 fF load. Its two delays are in seconds: 37.3 ps to fall and 45.7 ps to rise.

Open the Plots tab. The first plot is the transfer curve, y1 against a. The second plot shows in and y2 over time.

Change W=1 to W=3.5 on the line that starts with XMP1, then run. The switching point moves to 0.900 V, half the supply.

Now change W=2 to W=2.7 on the line that starts with XMP2. The delays become 38.3 ps and 38.0 ps: the inverter is balanced. Try 10f to 20f on the line CL with the first widths: 57.6 ps and 73.3 ps.

SPICEngspice 42 · simulator service
Edit the netlist, then run it
Expected measurements: vm = 8.370250e-01 fall = 3.733597e-11 targ= 1.062336e-09 trig= 1.025000e-09 rise = 4.573489e-11 targ= 3.120735e-09 trig= 3.075000e-09

Check Yourself

Predict the outputTwo inverters stand in a row: the output m of the first is the input of the second. The program prints y for a at 0 and then at 1. Predict the exact line.
module tb;
  logic a;
  wire  m, y;
  supply1 vdd;
  supply0 gnd;
  pmos p1 (m, vdd, a);     // first inverter: a to m
  nmos n1 (m, gnd, a);
  pmos p2 (y, vdd, m);     // second inverter: m to y
  nmos n2 (y, gnd, m);
  initial begin
    a = 0; #1 $write("%b", y);
    a = 1; #1 $display("%b", y);
  end
endmodule
ConceptThe input of a CMOS inverter is held at 0 V. Which transistor conducts?
ConceptWhy does a balanced inverter on this process need a PMOS about 2.7 times as wide as its NMOS?
ConceptWhen does the measured inverter draw the most current from its supply?
ConceptA slow input rests at 0.8 V. The measured levels are VIL = 0.703 V and VIH = 0.939 V. What can you say about the inverter output?

Common Mistakes

Wrong Put the NMOS at the top and the PMOS at the bottom.

Each transistor then passes its weak level: in ngspice the output only moves between 0.638 V and 1.162 V.

Fix Connect the PMOS to VDD and the NMOS to ground.

Before
nmos n1 (y, vdd, a);   // NMOS on top
pmos p1 (y, gnd, a);   // PMOS at the bottom
After
pmos p1 (y, vdd, a);   // PMOS on top
nmos n1 (y, gnd, a);   // NMOS at the bottom

Wrong Take half the supply, 0.9 V, as the line between 0 and 1.

The equal-width inverter switches at 0.837 V, so an input of 0.87 V already gives an output of 0.434 V.

Fix Read the switching point from the transfer curve, and keep inputs outside the range from VIL to VIH.

Wrong Count a steady current into the gate of a transistor.

The gate is insulated: with the input held at 1.8 V, ngspice reports a gate current of 0 A.

Fix Count the gate as a small capacitor. It takes charge only while its voltage changes.

Wrong Quote the delay of a gate without its load.

The same inverter rises in 45.7 ps into 10 fF and in 73.3 ps into 20 fF.

Fix State the load, the input edge and the corner next to every delay.

Remember

  • An NMOS is on when its gate is 1. A PMOS is on when its gate is 0.
  • In an inverter the PMOS pulls the output up and the NMOS pulls it down. Only one conducts at rest.
  • The switching point comes from the transfer curve: 0.837 V here, below half the supply.
  • Delay is the time to charge or empty the load. A wider PMOS balances rise and fall.
  • A CMOS gate draws almost no current at rest. It uses power when it switches.

Practice

Report a problem with this page