A01B0101A → 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 → 10 1 → 11 0 → 11 1 → 0A B → Y0 0 → 10 1 → 01 0 → 01 1 → 0A B → Y0 0 → 00 1 → 11 0 → 11 1 → 0A01B0101ABYNOTANDORNANDNORXOR010101
Lit wire with moving dashes: it carries a 1 (current is flowing)Lamps: a glowing lamp shows 1, a dark one 0Gate block: its symbol is on top, its name on the frontTruth table: every input row and its outputTwo transistor switches in series light the bulb only when both are on (AND); in parallel, when either is on (OR). The gate bench shows the same rules as symbols: lamps A and B are the input bits, Y is the output, and the truth table card behind it highlights the row being shown. Counts are for static CMOS gates with two inputs: NOT 2, NAND 4, NOR 4 (Harris and Harris, Digital Design and Computer Architecture, section 1.7). In a NAND the two series transistors connect the output to ground and the two parallel ones connect it to power. A real example: Texas Instruments' SN74HC00 contains four independent 2-input NAND gates and runs on 2 V to 6 V.

Gates from switches

  1. Two transistor switches sit one after the other, just like in the transistors lesson. Current reaches the bulb only when switch A and switch B are both on. That rule is called AND.

Symbols and truth tables

Inside a gate

The rule, row by row

;; step 1/10 · series-and
;; about: Switches in series
battery → switch A → switch B → bulb

A off, B off → bulb off
A off, B on  → bulb off
A on,  B off → bulb off
A on,  B on  → bulb ON

One open switch breaks the only path.

Inside a chip, 1 and 0 are two voltage levels (high and low); here the bulbs and lamps just show them. A lit wire means it carries a 1. In Python, &, | and ^ on the numbers 0 and 1 work as AND, OR and XOR. For NOT write 1 - a, because ~a in Python gives -(a + 1).