Logic Gates — worked example
Digital Logic 101 · Logic Gates · Example
Build a 3-input AND from NAND gates
- Stage 1 — NAND of A and B. Compute with one 2-input NAND.
- Stage 2 — invert P to recover AND. Tie both inputs of a second NAND to ; the gate behaves as a NOT, so its output is .
- Stage 3 — NAND of Q and C. .
- Stage 4 — invert R. A fourth NAND with both inputs tied to outputs . Done — four NANDs, no other gate types.
Verify with the 8-row truth table
| A | B | C | A·B·C | Y |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
The pattern NAND-then-NAND-as-NOT appears every time you want an AND from NANDs. Cascading -input AND from 2-input NANDs takes NAND gates total — two per AND-pair.
Try drawing this — and other circuits — in the Simulate stage.