YpowergroundAp01Bp01An01Bn010174HC004 × NAND · 14 pinsABY01NANDNOR01NANDNORNANDNOR01A B → Y0 0 → 10 1 → 11 0 → 11 1 → 0A → Y0 → 11 → 0A B → Y0 0 → 00 1 → 01 0 → 01 1 → 1A B → Y0 0 → 00 1 → 11 0 → 11 1 → 1A B → Y0 0 → 00 1 → 01 0 → 01 1 → 1A B notA notB → Y0 0 1 1 → 00 1 1 0 → 11 0 0 1 → 11 1 0 0 → 1gate CMOSNOT 2NAND 4NOR 4AND 6OR 6
Bench wire coloured, with moving dashes: it carries a 1 (white: a 0)Lamps: a glowing lamp shows 1, a dark one 0Gate blocks: NAND or NOR, symbol on top, name on the frontTransistors: a glowing channel is switched onEvery circuit on the bench is made only of NAND blocks (or, once, only of NOR blocks): joined inputs make a NOT, a NAND then a NOT makes AND, and two NOTs into a NAND make OR. Henry Sheffer showed in 1913 that one operation, now called NAND (the Sheffer stroke), is enough to write every rule of Boolean logic. Charles Peirce had found the same for NOR in a note of about 1880, first published in 1933 (Collected Papers, vol. 4, paragraphs 12-20). Static CMOS counts with two inputs: NOT 2, NAND 4, NOR 4, AND 6 (NAND + NOT), OR 6 (NOR + NOT) (Harris and Harris, section 1.7). pMOS transistors are slower than nMOS because holes move about 2 to 3 times more slowly than electrons, so a NOR (pMOS in series) is slower than a NAND (nMOS in series) of the same size (Weste and Harris, CMOS VLSI Design, 4th ed.). Real parts: Texas Instruments' SN74HC00 holds four 2-input NAND gates and the SN74HC02 four 2-input NOR gates, each in a 14-pin package.

Why one gate is enough

  1. NAND means NOT AND. It gives 0 only when both inputs are 1, and 1 for every other row. Watch the lamps: A and B are the inputs, Y is the output, and the table highlights each row.

Building from NAND

NOR, and inside the chip

The circuit, row by row

;; step 1/9 · nand-recap
;; about: Input A, Input B, Last gate, Output Y, Table card
A B → Y
0 0 → 1
0 1 → 1
1 0 → 1
1 1 → 0

Python:
def nand(a, b): return 1 - (a & b)

Inside a chip, 1 and 0 are two voltage levels (high and low); the lamps just show them. On the gate bench, a coloured wire with moving dashes carries a 1 and a white wire carries a 0. On the transistor board, colour and dashes mark the path the switched-on transistors open: from power to Y (Y is 1) or from Y to ground (Y is 0). In Python, a & b on the numbers 0 and 1 is AND, and 1 - x flips a bit (~x would give -(x + 1)).