FormatArticle
Reading time9 min read
Published
ByReference
Demonstration piece

What a logic gate actually is

Every explanation of computing hurries past the gate. It is worth stopping, because almost everything above it is the same trick repeated.

Three logic gate symbols with input and output lines beside a column of on and off cells

A logic gate is a physical arrangement of switches that produces one output voltage from one or two input voltages. That is the whole thing. It is not a metaphor for reasoning and it does not know anything; it is a small piece of electrical plumbing that happens to behave the way a rule of logic behaves.

The reason it matters is that a gate is the smallest unit that is genuinely general. Wire enough of them together and you can build arithmetic, memory, and eventually the machine reading this page. Nothing new is added at any point above this level — only more of the same, arranged more cleverly.

Two voltages, called true and false

A digital circuit agrees, in advance, that any voltage above some threshold means one and anything below it means zero. Everything in between is noise the circuit is designed to squeeze out. This agreement is the actual invention: it lets an analogue, imprecise physical object behave as though it were exact, and it is why a computer can be copied a billion times without drifting.

The rules a gate can follow

  • AND — output is one only if both inputs are one. Two switches in series.
  • OR — output is one if either input is one. Two switches in parallel.
  • NOT — output is the opposite of the input. One switch that breaks the circuit when it is on.

From those three, everything else. XOR — one input or the other, but not both — is built from a handful of the first three. So is addition: an adder is a specific arrangement of gates that takes two binary digits and produces a sum and a carry, and a row of adders bolted together adds larger numbers. There is no arithmetic unit hiding underneath doing the real work.

The stack this piece sits in
  1. Voltage
  2. Switch
  3. Gate
  4. Adder
  5. Processor

Where the layers begin

The useful habit this establishes is the one the rest of How Computers Work depends on: at every level, a component is defined by what it does, not by what it is made of. An adder is anything that adds. A processor is anything that fetches and executes. Once a layer is reliable, the layer above stops caring how it was built — which is exactly what lets a network built from wires and gates carry a message across the world.

Sources & further reading3
  • The Elements of Computing SystemsNoam Nisan and Shimon Schocken, 2005Builds a working computer from NAND gates upwards. The clearest route through this material.
  • A Symbolic Analysis of Relay and Switching CircuitsClaude Shannon, 1937The paper that connected Boolean algebra to switching circuits.
  • Code: The Hidden Language of Computer Hardware and SoftwareCharles Petzold, 1999

Tags