The Alphabet of Hardware
Digital circuits compute with just two voltage levels, interpreted as the boolean values 1 (true, high) and 0 (false, low). Every digital operation is built from tiny hardware elements called logic gates, each computing one boolean function of its inputs.
The three fundamental gates are:
- AND — outputs 1 only when all inputs are 1.
- OR — outputs 1 when at least one input is 1.
- NOT (inverter) — one input; outputs the opposite value.
From these, a few compound gates are so useful they get their own symbols:
- NAND (NOT-AND) — outputs 0 only when all inputs are 1 (the inverse of AND).
- NOR (NOT-OR) — outputs 1 only when all inputs are 0 (the inverse of OR).
- XOR (exclusive-OR) — outputs 1 when the inputs differ (an odd number of 1s).
| Gate | Output is 1 when... |
|---|---|
| AND | all inputs are 1 |
| OR | at least one input is 1 |
| NOT | the single input is 0 |
| XOR | the inputs differ |
A remarkable fact underlies all of digital design: NAND is universal — any boolean function whatsoever can be built using only NAND gates (NOR is universal too). This is why a single cheap gate type can, in principle, implement an entire computer. Gates are the physical atoms; everything from an adder to a processor is gates wired together.
Common pitfall: confusing OR with XOR. OR outputs 1 when at least one input is 1 (including when both are 1); XOR (exclusive-OR) outputs 1 only when the inputs differ — so for inputs 1 and 1, OR gives 1 but XOR gives 0. Watch the "both are 1" case, where they disagree.
The four basic gate symbols (AND, OR, NOT, XOR) each with input switches and an accent output LED, shown side by side lit for the inputs (1,1) so OR glows and XOR stays dark — the OR-vs-XOR distinction on the both-1.