---
title: The CMOS inverter as a circuit
heading: Transfer curve, noise margins, delay and power from the square law
eyebrow: C5 · Lesson 50 · The CMOS inverter as a circuit
xp: 40
---

::: hook
Digital logic treats an inverter as a box that turns 1 into 0. Underneath it's two transistors, an NMOS pulling down and a PMOS pulling up, and the square law says exactly how it behaves: at what input voltage it switches, how much noise it can reject, how long it takes to charge the next gate's capacitance, and how much power that costs. Those numbers decide how fast and how cool a processor can run. C7 builds logic from the inverter; this lesson analyzes it as a circuit.
:::

::: play
- The voltage transfer curve of a **matched** inverter (equal $K$, equal thresholds): output against input. It's flat at $V_{DD}$, falls steeply around $V_{DD}/2$, and is flat at 0.
- The markers are $V_{IL}$ and $V_{IH}$, where the slope is −1: inputs below $V_{IL}$ read as low, above $V_{IH}$ as high.
- Raise the threshold: the transition gets steeper and the noise margins grow, at the cost of less drive current.
:::
:::

```sim plot
view: graph
x: vin = 0..5 V
y: vout = 0..5 V
slider: VDD = 3..5 step 0.1 = 5 V
slider: Vt = 0.2..1.2 step 0.05 = 1 V
plot: VDD*step(Vt - vin)*step(VDD - vin) + (VDD - ((VDD - vin - Vt) - sqrt(abs((VDD - vin - Vt)^2 - (vin - Vt)^2))))*step(vin - Vt)*step(VDD/2 - vin) + ((vin - Vt) - sqrt(abs((vin - Vt)^2 - (VDD - vin - Vt)^2)))*step(vin - VDD/2)*step(VDD - Vt - vin) | label: output | samples: 1000
marker: x = (3*VDD + 2*Vt)/8 | label: VIL
marker: x = (5*VDD - 2*Vt)/8 | label: VIH
readout: noise margin, V = (3*VDD + 2*Vt)/8 | digits: 3
readout: switching threshold, V = VDD/2 | digits: 3
```

::: predict
## An inverter's NMOS and PMOS have the same size, but holes are three times less mobile than electrons. Where does it switch, on a 3.3 V supply with 0.5 V thresholds?

- [ ] At 1.65 V, half the supply
- [x] Below half the supply, about 1.34 V
- [ ] Above half the supply, about 1.96 V
- [ ] At the threshold, 0.5 V

::: reveal
About 1.34 V. With the NMOS three times stronger, the input doesn't need to rise as far before the pull-down overpowers the pull-up. To center the switching point, the PMOS is made about three times wider, which is why CMOS layouts have wide PMOS transistors.
:::
:::

::: nameit
## The switching threshold

At the switching threshold $V_M$ both transistors are saturated and carry the same current:

$$\frac{k_n}{2}(V_M - V_{tn})^2 = \frac{k_p}{2}(V_{DD} - V_M - |V_{tp}|)^2 \quad\Rightarrow\quad V_M = \frac{V_{tn} + r(V_{DD} - |V_{tp}|)}{1 + r}, \quad r = \sqrt{k_p/k_n}$$

For a **matched** inverter ($k_n = k_p$, $V_{tn} = |V_{tp}|$), $V_M = V_{DD}/2$. Matching needs $(W/L)_p/(W/L)_n = \mu_n/\mu_p$, two to three.

## The transfer curve and noise margins

Between the threshold and $V_M$ the NMOS is saturated and the PMOS in triode, and above $V_M$ the reverse; solving each pair of equations gives the curve in the sim. The points of slope −1 mark where small input noise starts being amplified. For a matched inverter,

$$V_{IL} = \frac{3V_{DD} + 2V_t}{8} \qquad V_{IH} = \frac{5V_{DD} - 2V_t}{8} \qquad NM_L = NM_H = \frac{3V_{DD} + 2V_t}{8}$$

since the outputs reach the full rails, 0 and $V_{DD}$.

## Propagation delay

The output drives a capacitance C: the next gates' inputs and the wiring. Falling from $V_{DD}$ to $V_{DD}/2$, the NMOS starts saturated and ends in triode. Averaging its current over that interval gives

$$t_{PHL} = \frac{\alpha_nC}{k_nV_{DD}} \qquad \alpha_n = \frac{2}{\frac74 - 3\frac{V_{tn}}{V_{DD}} + \left(\frac{V_{tn}}{V_{DD}}\right)^2}$$

and $t_{PLH}$ the same with the PMOS's values. Stronger transistors, a higher supply and less load make a faster gate.

## Power

Each time the output charges C to $V_{DD}$ and discharges it again, the supply delivers $CV_{DD}^2$ and all of it becomes heat. At a switching rate f,

$$P = fCV_{DD}^2$$

plus a short burst of current through both transistors during each transition, peaking at $\frac{k_n}{2}(V_M - V_{tn})^2$, and leakage. Lowering $V_{DD}$ is the strongest lever on power, which is why logic supplies fell from 5 V to below 1 V.
:::

```sim circuit
VIN in 0 square 0 5 100k Hz             @ 0,1 down 3
MP out in vdd pmos VTO=-0.5 KP=1m       @ 2,0 flip
MN out in 0 nmos VTO=0.5 KP=1m          @ 2,2
CL out 0 1n                             @ 5,1 down 2
VDD vdd 0 5                             @ 7,-1 down 4
slider: CL 100p..10n log
scope: v(in), v(out)
time: 0..20u s
```

::: example
## For the inverter in the predict ($k_n = 3k_p$, $V_{DD}$ = 3.3 V, thresholds 0.5 V), find $V_M$.

::: solution
1. **Ratio.**
   $$\begin{aligned} r &= \sqrt{1/3} \\ &= 0.577 \end{aligned}$$
2. **Switching threshold.**
   $$\begin{aligned} V_M &= \frac{0.5 + 0.577 \times 2.8}{1.577} \\ &= 1.34\ \text{V} \end{aligned}$$

**Answer:** $V_M$ = 1.34 V.
:::
:::

::: example
## A matched inverter on 5 V has 1 V thresholds and $k_n$ = 1 mA/V², and drives 1 nF at 100 kHz. Find its noise margins, $t_{PHL}$ and power.

::: solution
1. **Input thresholds.**
   $$\begin{aligned} V_{IL} &= \frac{15 + 2}{8} \\ &= 2.125\ \text{V} \\ V_{IH} &= \frac{25 - 2}{8} \\ &= 2.875\ \text{V} \end{aligned}$$
2. **Noise margins.** Both margins are 2.125 V.
3. **Delay factor.**
   $$\begin{aligned} \alpha_n &= \frac{2}{1.75 - 0.6 + 0.04} \\ &= 1.68 \end{aligned}$$
4. **Fall delay.**
   $$\begin{aligned} t_{PHL} &= \frac{1.68 \times 1\ \text{nF}}{1\ \text{mA/V}^2 \times 5\ \text{V}} \\ &= 336\ \text{ns} \end{aligned}$$
5. **Power.**
   $$\begin{aligned} P &= 10^5 \times 10^{-9} \times 25 \\ &= 2.5\ \text{mW} \end{aligned}$$

**Answer:** both noise margins are 2.125 V, $t_{PHL}$ = 336 ns, and the inverter takes 2.5 mW.
:::
:::

::: example
## The matched inverter of the second example ($k_n$ = 1 mA/V², 1 V thresholds, 1 nF load) runs from 2.5 V instead of 5 V. How do its delay and its power at 100 kHz change?

::: solution
1. **At 5 V.** $\alpha_n$ = 1.68 and $t_{PHL}$ = 336 ns.
2. **Delay factor at 2.5 V.** $\frac{V_{tn}}{V_{DD}}$ = 0.4, so
   $$\begin{aligned} \alpha_n &= \frac{2}{1.75 - 1.2 + 0.16} \\ &= 2.82 \end{aligned}$$
3. **Delay at 2.5 V.**
   $$\begin{aligned} t_{PHL} &= \frac{2.82 \times 1\ \text{nF}}{1\ \text{mA/V}^2 \times 2.5\ \text{V}} \\ &= 1127\ \text{ns} \end{aligned}$$
4. **Power.** $fCV_{DD}^2$ falls from 2.5 mW to 0.625 mW.
5. **The trade.** Halving the supply saves four times the energy but costs 3.4 times the delay, because the threshold takes a larger share of a smaller supply. That trade is why chips scale their supply with their clock.

**Answer:** the delay grows 3.4 times, from 336 ns to 1127 ns, and the power falls four times, from 2.5 mW to 0.625 mW.
:::
:::

::: check
given: VDD = 1.8 | 3.3 | 5; Vt = 0.4 | 0.7; ratio = 0.33 | 0.5
answer: (Vt + sqrt(ratio)*(VDD - Vt))/(1 + sqrt(ratio))
unit: V
tolerance: 0.5%

## An inverter on {VDD} V has both thresholds at {Vt} V and $k_p/k_n$ = {ratio}. Where is its switching threshold?

::: right
Right. $\frac{V_{tn} + r(V_{DD} - |V_{tp}|)}{1 + r}$ with $r = \sqrt{k_p/k_n}$: {answer}.
:::

::: misses
- [VDD/2] That's for a matched inverter; here the NMOS is stronger.
- [(Vt + ratio*(VDD - Vt))/(1 + ratio)] Use $r = \sqrt{k_p/k_n}$.
- [any] Not yet. Set the two saturation currents equal.
:::
:::

::: check
given: VDD = 1.2 | 3.3 | 5; Vt = 0.3 | 0.8
answer: (3*VDD + 2*Vt)/8
unit: V
tolerance: 0.5%

## What are the noise margins of a matched inverter on {VDD} V with {Vt} V thresholds?

::: right
Right. $\frac{3V_{DD} + 2V_t}{8}$ = {answer}.
:::

::: misses
- [VDD/2] That's the switching threshold; the margins end where the slope reaches −1.
- [any] Not yet. $NM = V_{IL} = (3V_{DD} + 2V_t)/8$.
:::
:::

::: check
given: VDD = 1.8 | 5; Vt = 0.4 | 1
answer: (5*VDD - 2*Vt)/8
unit: V
tolerance: 0.5%

## What is $V_{IH}$ for a matched inverter on {VDD} V with {Vt} V thresholds?

::: right
Right. $\frac{5V_{DD} - 2V_t}{8}$ = {answer}.
:::

::: misses
- [any] Not yet. $V_{IH} = V_{DD} - V_{IL}$ for a matched inverter.
:::
:::

::: check
given: C = 0.01 | 1; kn = 0.2 | 2; VDD = 1.8 | 5; Vt = 0.4 | 0.7
answer: 2/(1.75 - 3*Vt/VDD + (Vt/VDD)^2)*C*1e-9/(kn*1e-3*VDD)*1e9
unit: ns
tolerance: 0.5%

## An inverter's NMOS ($k_n$ = {kn} mA/V², $V_t$ = {Vt} V) discharges {C} nF on a {VDD} V supply. What is $t_{PHL}$?

::: right
Right. $\frac{\alpha_nC}{k_nV_{DD}}$ = {answer}.
:::

::: misses
- [C*1e-9/(kn*1e-3*VDD)*1e9] Include $\alpha_n$, which accounts for the current falling as the NMOS leaves saturation.
- [any] Not yet. Find $\alpha_n$ from $V_t/V_{DD}$ first.
:::
:::

::: check
given: f = 0.1 | 1 | 100; C = 0.01 | 1; VDD = 1 | 3.3
answer: f*1e6*C*1e-9*VDD^2*1000
unit: mW
tolerance: 0.5%

## A gate switches {C} nF at {f} MHz on a {VDD} V supply. What dynamic power does it take?

::: right
Right. $fCV_{DD}^2$ = {answer}.
:::

::: misses
- [0.5*f*1e6*C*1e-9*VDD^2*1000] Each full cycle takes $CV_{DD}^2$ from the supply: half is lost charging, half discharging.
- [any] Not yet. $P = fCV_{DD}^2$.
:::
:::

::: check
given: k = 0.5 | 2; VDD = 3.3 | 5; Vt = 0.5 | 1
answer: k/2*(VDD/2 - Vt)^2
unit: mA
tolerance: 0.5%

## A matched inverter ($k$ = {k} mA/V², {VDD} V, {Vt} V thresholds) passes through $V_M$. What current flows through both transistors at that moment?

::: right
Right. $\frac k2(V_{DD}/2 - V_t)^2$ = {answer}.
:::

::: misses
- [any] Not yet. Both are saturated with $V_{GS} = V_{DD}/2$.
:::
:::

::: check
given: mun = 400 | 1350; mup = 150 | 480
answer: mun/mup
tolerance: 0.5%

## Electrons have mobility {mun} and holes {mup} cm²/V·s. How many times wider must the PMOS be to match the NMOS (same length)?

::: right
Right. $\mu_n/\mu_p$ = {answer}.
:::

::: misses
- [mup/mun] The PMOS is the weaker one, so it must be the wider one.
- [any] Not yet. Match $\mu C_{ox}W/L$.
:::
:::

::: check
kind: parts
given: V = 1.8 | 3.3 | 5; f = 1 | 10 | 100; C = 10 | 100

## A CMOS inverter switches {C} pF at {f} MHz from {V} V.

::: part
answer: f*1e6*C*1e-12*V^2*1000
unit: mW
tolerance: 0.5%

### What dynamic power does it draw?

::: misses
- [f*1e6*C*1e-12*V^2/2*1000] Each full cycle takes $CV_{DD}^2$ from the supply.
- [any] $P = fCV_{DD}^2$.
:::
:::

::: part
answer: C*1e-12*V^2*1e12
unit: pJ
tolerance: 0.5%

### How much energy does each full cycle take from the supply?

::: misses
- [C*1e-12*V^2/2*1e12] Half is stored on the capacitor, half is lost in the pull-up, and the stored half is lost on discharge.
- [any] $CV_{DD}^2$.
:::
:::
:::

::: check
kind: derivation
vars: t = 0.3..1.5, V = 1..5, k = 0.0001..0.01, C = 0.000000000001..0.000000001

## A CMOS inverter with thresholds t and $k_n$ = k drives C from a supply V.

::: step
answer: (3*V + 2*t)/8

### What's its noise margin?
:::

::: step
answer: 2/(1.75 - 3*t/V + (t/V)^2)

### What's $\alpha_n$?
:::

::: step
answer: 2/(1.75 - 3*t/V + (t/V)^2)*C/(k*V)

### What's $t_{PHL}$?
:::

::: right
Right. A lower supply lowers the margin and slows the gate, but cuts the energy as $V^2$.
:::
:::

::: explain
## Why does a CMOS inverter draw almost no current when its input is steady, yet consume power when it switches?

::: model
With the input steady at either rail, one transistor is fully off, so there's no path from the supply to ground and only leakage flows. Power is spent only when the output changes: charging the load capacitance draws $CV_{DD}$ of charge from the supply at $V_{DD}$, half of the energy ending up stored in the capacitor and half lost in the PMOS; discharging dumps the stored half through the NMOS. So every full cycle costs $CV_{DD}^2$, plus a brief current through both transistors while the input passes the middle. The power is proportional to how often the gate switches.
:::
:::

::: practice

::: check
given: VDD = 1 | 3.3 | 5
answer: VDD/2
unit: V
tolerance: 0.5%

## Where does a matched inverter on {VDD} V switch?

::: misses
- [any] $V_{DD}/2$.
:::
:::

::: check
given: C = 1 | 50; VDD = 0.8 | 3.3
answer: C*VDD^2
unit: pJ
tolerance: 0.5%

## How much energy does a {C} pF node take from a {VDD} V supply per full charge-discharge cycle?

::: misses
- [any] $CV_{DD}^2$.
:::
:::

::: check
given: Vt = 0.3 | 1; VDD = 1.2 | 5
answer: 2/(1.75 - 3*Vt/VDD + (Vt/VDD)^2)
tolerance: 0.5%

## What is $\alpha_n$ for $V_t$ = {Vt} V on a {VDD} V supply?

::: misses
- [any] $2/(7/4 - 3x + x^2)$ with $x = V_t/V_{DD}$.
:::
:::
:::
