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.
- v(out)
- v(in)
- 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.
- 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.
- 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.
- 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.
- 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.
- 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 V | 1.8 V | 0 V |
| 200 mV | 1.8 V | 200 mV |
| 300 mV | 1.8 V | 300 mV |
| 400 mV | 1.8 V | 400 mV |
| 600 mV | 1.795 V | 600 mV |
| 703.5 mV | 1.751 V | 703.5 mV |
| 800 mV | 1.32 V | 800 mV |
| 837 mV | 837.1 mV | 837 mV |
| 870 mV | 433.8 mV | 870 mV |
| 939.5 mV | 69.24 mV | 939.5 mV |
| 1 V | 32.74 mV | 1 V |
| 1.2 V | 3.085 mV | 1.2 V |
| 1.4 V | 133.3 µV | 1.4 V |
| 1.5 V | 28.28 µV | 1.5 V |
| 1.6 V | 6.412 µV | 1.6 V |
| 1.8 V | 260.6 nV | 1.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.
| Transistor | On (path closed) when its gate is | Used to connect the output to |
|---|---|---|
| NMOS | 1 (high) | ground: it pulls the output down |
| PMOS | 0 (low) | VDD: it pulls the output up |
The two types react to opposite gate levels. CMOS means that a gate uses both types.
a controls both gates.- a = 0: y = 1
The gate of MP is low, so MP is on. It connects
yto VDD. MN is off, so no path leads to ground.charges y
- a = 1: y = 0
The gate of MN is high, so MN is on. It connects
yto 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.
| Name | Meaning | Measured |
|---|---|---|
| VIL | the highest input that still counts as 0 | 0.703 V |
| VIH | the lowest input that still counts as 1 | 0.939 V |
| VOH | the output when the input is at VIL | 1.751 V |
| VOL | the output when the input is at VIH | 0.069 V |
| Switching point | the input at which the output equals the input | 0.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.
- Power
- Device
- I/O
- Power
- 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
- data charge: VDD → PMOS
- data charge: PMOS → Output y
- 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
- data charge: Output y → NMOS
- 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 width | PMOS width | Output falls | Output rises |
|---|---|---|---|
| 1 µm | 1 µm | 35.8 ps | 76.5 ps |
| 1 µm | 2 µm | 37.3 ps | 45.7 ps |
| 1 µm | 2.7 µm | 38.3 ps | 38.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 inverter | Supply current |
|---|---|
| Input held at 0 V | 2.0 pA |
| Input held at 1.8 V | 320 pA |
| Input at 0.889 V, in the middle of a change | 19.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
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.
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.
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.
Run the netlist to draw its plots here.
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-09Check Yourself
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.
nmos n1 (y, vdd, a); // NMOS on top
pmos p1 (y, gnd, a); // PMOS at the bottompmos p1 (y, vdd, a); // PMOS on top
nmos n1 (y, gnd, a); // NMOS at the bottomWrong 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.