---
title: CMOS gates, sizing and power
heading: From the inverter to NAND, NOR and complex gates
eyebrow: C7 · Lesson 8 · CMOS gates, sizing and power
xp: 40
---

::: hook
Every CMOS gate is built the same way as the inverter of lesson 7: a network of NMOS transistors that pulls the output down, and a mirror-image network of PMOS transistors that pulls it up, arranged so that exactly one of them conducts for any input. Transistors in series act like AND, in parallel like OR, and the pull-up network is the dual of the pull-down. That simple rule gives NAND and NOR gates with four transistors, and lets a single complex gate compute something like $\overline{AB + C}$ with six. It also explains why NAND gates are preferred over NOR, and where a chip's power goes.
:::

::: play
- A two-input NAND gate at transistor level: two NMOS in series to ground, two PMOS in parallel to the supply. A and B are square waves at 1 kHz and 500 Hz, so together they step through all four input combinations.
- The output is low only while both inputs are high, when both series NMOS conduct and both parallel PMOS are off. Every other time, at least one PMOS pulls it up.
:::
:::

```sim circuit
VA a 0 square 0 5 1k Hz             @ 0,2 down 3
VB b 0 square 0 5 500 Hz            @ -2,4 down 3
MP1 y a vdd pmos VTO=-1 KP=1m       @ 2,0 flip
MP2 y b vdd pmos VTO=-1 KP=1m       @ 4,0 left flip
MN1 y a m nmos VTO=1 KP=1m          @ 2,2
MN2 m b 0 nmos VTO=1 KP=1m          @ 2,4
CL y 0 10p                          @ 6,1 down 3
VDD vdd 0 5                         @ 7,-2 down 6
scope: v(a), v(b), v(y)
time: 0..4m s
```

::: predict
## In a CMOS process where electrons are twice as mobile as holes, why do designers prefer NAND gates to NOR gates?

- [ ] NAND gates compute more functions
- [x] A NOR gate's PMOS transistors are in series, and slow PMOS in series must be made very wide
- [ ] NOR gates need more transistors
- [ ] NAND gates use no PMOS transistors

::: reveal
In a NOR gate the slow PMOS transistors are stacked in series, so each must be made about twice as wide again to drive as strongly as the inverter's, on top of being twice as wide as an NMOS already. A NAND stacks the fast NMOS instead. Same transistor count, but the NOR is bigger, has more input capacitance, and is slower.
:::
:::

::: nameit
## Building a static CMOS gate

1. Write the function inverted, $\bar Y$ = f(inputs), using AND and OR of the plain inputs.
2. **Pull-down network** (NMOS, between the output and ground): AND becomes transistors in series, OR in parallel. It conducts exactly when the output should be 0.
3. **Pull-up network** (PMOS, between the supply and the output): the dual, with series and parallel swapped. It conducts exactly when the pull-down doesn't.

| Gate | Pull-down (NMOS) | Pull-up (PMOS) | Transistors |
|---|---|---|---|
| NAND2, $\overline{AB}$ | A, B in series | A, B in parallel | 4 |
| NOR2, $\overline{A + B}$ | A, B in parallel | A, B in series | 4 |
| AOI21, $\overline{AB + C}$ | (A series B) parallel C | (A parallel B) series C | 6 |

Static CMOS gates are naturally inverting; AND and OR take an extra inverter. An n-input NAND or NOR uses 2n transistors.

## Sizing

Transistors in series add their resistances, so to drive as strongly as an inverter, each of n series devices must be n times wider. With electrons about twice as mobile as holes, a unit inverter has NMOS width 1 and PMOS width 2:

| Gate | NMOS width | PMOS width |
|---|---|---|
| inverter | 1 | 2 |
| NAND n | n | 2 |
| NOR n | 1 | 2n |

Wider transistors mean more input capacitance, so large fan-in gates get slow; designers split them into trees of smaller gates.

## Power

Each output transition charges or discharges its load capacitance C, the inputs of the gates it drives plus wire. With an **activity factor** α (the fraction of clock cycles in which a node switches),

$$P_\text{dynamic} = \alpha CV_{DD}^2f$$

plus **static** leakage through transistors that are off, which grows as thresholds shrink. Lowering $V_{DD}$ cuts dynamic power quadratically, and gating the clock off idle blocks cuts α.
:::

::: example
## Size a NAND2 and a NOR2 to match a unit inverter (NMOS 1, PMOS 2). Compare their total widths.

::: solution
1. **Size the NAND2.** Series NMOS 2 each, parallel PMOS 2 each:
   $$2 + 2 + 2 + 2 = 8$$
2. **Size the NOR2.** Parallel NMOS 1 each, series PMOS 4 each:
   $$1 + 1 + 4 + 4 = 10$$
3. **Compare the input loads.** Each NOR2 input sees 1 + 4 = 5 units of gate against the NAND's 2 + 2 = 4, so the NAND is smaller and presents less load.

**Answer:** the NAND2 totals 8 units of width and the NOR2 10; each NAND2 input presents 4 units of gate against the NOR2's 5.
:::
:::

::: example
## A block of 10⁶ gates, each with 2 fF of load, switches with α = 0.1 at 2 GHz on 0.9 V. What dynamic power does it use?

::: solution
1. **Power at 0.9 V.** With $V^2 = 0.81$:
   $$\begin{aligned} P &= 0.1 \times 10^6 \times 2\ \text{fF} \\ &\quad \times 0.81 \times 2\ \text{GHz} \\ &= 0.32\ \text{W} \end{aligned}$$
2. **Power at 1.2 V.** With $V^2 = 1.44$:
   $$\begin{aligned} P &= 0.1 \times 10^6 \times 2\ \text{fF} \\ &\quad \times 1.44 \times 2\ \text{GHz} \\ &= 0.58\ \text{W} \end{aligned}$$
3. **Compare.** The supply voltage is the strongest lever.

**Answer:** 0.32 W at 0.9 V (0.58 W at 1.2 V).
:::
:::

::: example
## Size a three-input NAND to match a unit inverter (NMOS 1, PMOS 2). How much input capacitance does each input present, compared with the inverter?

::: solution
1. **Size the NMOS.** Three NMOS in series must together conduct like one unit NMOS, so each is 3 wide.
2. **Size the PMOS.** The PMOS are in parallel, and the worst case is one alone pulling up, so each stays 2 wide.
3. **Add up one input's gate.** Each input drives one NMOS and one PMOS:
   $$3 + 2 = 5$$
   units of gate, against the inverter's 3.
4. **Logical effort.** The ratio, $\frac53$, is the NAND3's **logical effort**: how much harder it is to drive than an inverter that delivers the same current.
5. **Wider gates.** It grows with the number of inputs, which is why wide gates are split into trees of narrow ones.

**Answer:** each NMOS is 3 wide and each PMOS 2, so each input presents 5 units of gate against the inverter's 3, a ratio of $\frac53$.
:::
:::

::: check
given: n = 2 | 3 | 4 | 8
answer: 2*n
tolerance: 0.1%

## How many transistors does a static CMOS NAND gate with {n} inputs use?

::: right
Right. n NMOS and n PMOS: {answer}.
:::

::: misses
- [n] Each input drives one NMOS and one PMOS.
- [any] Not yet. One transistor in each network per input.
:::
:::

::: check
kind: choice

## A gate's pull-down network has NMOS A and B in series, and that pair in parallel with NMOS C. What is the pull-up network?

- [ ] A, B and C all in parallel
- [x] PMOS A and B in parallel, that pair in series with PMOS C
- [ ] PMOS A and B in series, that pair in parallel with PMOS C
- [ ] A, B and C all in series

::: misses
- [1] The pull-up is the dual: series and parallel swap at every level.
- [3] That's the same structure as the pull-down; it must be the dual.
- [4] Only C's connection swaps to series; A and B swap to parallel.
:::
:::

::: check
kind: boolean
vars: A, B, C
answer: ~(A & B | C)
ops: and, or, not

## That gate (NMOS A and B in series, in parallel with C) computes what?

::: right
Right. $\overline{AB + C}$: an AND-OR-invert gate.
:::

::: misses
- [A & B | C] Static CMOS gates invert: the pull-down network conducts when the output is 0.
- [any] Not yet. The pull-down conducts when AB + C is true.
:::
:::

::: check
given: n = 2 | 3 | 4; r = 2 | 2.5
answer: r*n
tolerance: 0.5%

## In a process where electrons are {r} times as mobile as holes, a unit inverter has NMOS width 1 and PMOS width {r}. How wide must each PMOS in an {n}-input NOR be?

::: right
Right. {n} in series, each {r} wide to start with: {answer}.
:::

::: misses
- [n] Start from the inverter's PMOS width, then multiply by the number in series.
- [any] Not yet. Series devices must be n times wider.
:::
:::

::: check
given: a = 0.05 | 0.2; C = 1 | 50; V = 0.8 | 1.2; f = 0.5 | 3; N = 1 | 100
answer: a*N*1e6*C*1e-15*V^2*f*1e9
unit: W
tolerance: 0.5%

## {N} million gates, each with {C} fF of load, switch with α = {a} at {f} GHz on {V} V. What dynamic power do they use?

::: right
Right. $\alpha CV^2f$ for each, times the count: {answer}.
:::

::: misses
- [N*1e6*C*1e-15*V^2*f*1e9] Only a fraction α of the nodes switch each cycle.
- [any] Not yet. $P = \alpha CV_{DD}^2f$ per node.
:::
:::

::: check
given: fo = 2 | 4 | 8; Cin = 1 | 3; Cw = 0.5 | 4
answer: fo*Cin + Cw
unit: fF
tolerance: 0.5%

## A gate drives {fo} gate inputs of {Cin} fF each through {Cw} fF of wire. What load capacitance does it see?

::: right
Right. {answer}.
:::

::: misses
- [fo*Cin] Include the wire.
- [any] Not yet. Add every input it drives, plus the wire.
:::
:::

::: check
kind: parts
given: n = 2 | 3 | 4

## An n-input NAND with n = {n} is sized to match a unit inverter (NMOS 1, PMOS 2).

::: part
answer: n + 2
tolerance: 0.5%

### How many units of gate does each input drive?

::: misses
- [n + 1] The PMOS stays 2 wide.
- [any] Series NMOS n wide each, parallel PMOS 2 wide each.
:::
:::

::: part
answer: (n + 2)/3
tolerance: 0.5%

### What's its logical effort?

::: misses
- [any] Its input capacitance over the inverter's 3 units.
:::
:::
:::

::: check
kind: parts
given: n = 2 | 3 | 4

## An n-input NOR with n = {n} is sized to match a unit inverter (NMOS 1, PMOS 2).

::: part
answer: 1 + 2*n
tolerance: 0.5%

### How many units of gate does each input drive?

::: misses
- [any] Parallel NMOS 1 wide each, series PMOS 2n wide each.
:::
:::

::: part
answer: (1 + 2*n)/3
tolerance: 0.5%

### What's its logical effort?

::: misses
- [(n + 2)/3] That's the NAND's; the NOR's series PMOS are wider.
- [any] Input capacitance over 3.
:::
:::
:::

::: explain
## Why is a static CMOS gate's pull-up network the dual of its pull-down network?

::: model
For every input combination exactly one of the two networks must conduct: the pull-down when the output should be 0 and the pull-up when it should be 1, never both (that would short the supply) and never neither (that would leave the output floating). The pull-down conducts for the inverted function, built with series for AND and parallel for OR. PMOS transistors turn on when their inputs are low, and swapping series for parallel turns AND into OR; by De Morgan's laws that makes the pull-up conduct exactly when the pull-down doesn't.
:::
:::

::: practice

::: check
given: n = 2 | 3 | 4
answer: n
tolerance: 0.1%

## How wide must each series NMOS in an {n}-input NAND be to match an inverter's NMOS of width 1?

::: misses
- [any] n in series: n times wider.
:::
:::

::: check
kind: boolean
vars: A, B
answer: ~(A | B)
ops: and, or, not

## A gate has NMOS A and B in parallel to ground. What does it compute?

::: misses
- [any] The output is pulled low if either input is high.
:::
:::

::: check
given: C = 1 | 100; V = 0.8 | 3.3
answer: 0.5*C*V^2
unit: fJ
tolerance: 0.5%

## How much energy is stored on a {C} fF node charged to {V} V?

::: misses
- [any] $\frac12CV^2$.
:::
:::
:::
