TALLMOVE
All arcs

Gates to a CPU

Switches to gates, gates to an adder, a loop of gates that remembers, a machine that fetches, decodes, and executes, and the caches, pipelines, predictors, and memory layout that make it fast.

How Computers Work

Progress0/9

Before you start

Some lessons here build on lessons from other arcs: Propositional Logic: Truth Tables.

  1. 1

    Counting with Switches

    Computers · Binary · ~15 min

    Build any number out of on/off switches, then flip one weight negative and unlock negative numbers.

  2. 2

    From Logic Gates to an Adderin review

    Computers · Logic · ~20 min

    Six truth tables, wired together: XOR is the sum bit, AND is the carry, and one full adder per column adds two bytes while the carry ripples from the lowest column to the top.

  3. 3

    Floating Point: IEEE 754in review

    Computers · Binary · ~25 min

    A sign, a biased exponent, and a fraction with a hidden leading 1: how 6.3 becomes 6.5 in eight bits, why the error is relative, and where zero, the subnormals, and infinity live.

  4. 4

    Flip-Flops: How Memory Remembersin review

    Computers · Logic · ~25 min

    Two NOR gates feeding each other hold a bit for as long as the power is on. Gate it with an enable for a latch; clock two latches and Q changes only on the edge.

  5. 5

    A Tiny CPU, Instruction by Instructionin review

    Computers · CPU · ~30 min

    Sixteen bytes, four registers, nine instructions: fetch the byte at the program counter, decode its two halves, execute. The adder does the arithmetic, and data runs as code if you let it.

  6. 6

    CPU Caches & Localityin review

    Computers · CPU · ~25 min

    A few lines of fast memory in front of the slow one: an address splits into offset, set, and tag, a hit costs nothing, a miss fetches a block, and whether a program hits is a question of locality.

  7. 7

    Instruction Pipeliningin review

    Computers · CPU · ~25 min

    Five stages, five instructions in flight, one finished per cycle: the assembly line inside a processor, and the data and control hazards that stall it, forward around it, or squash what it fetched.

  8. 8

    Branch Predictionin review

    Computers · CPU · ~20 min

    A pipeline must guess which way a branch goes before it knows: one bit remembers the last outcome, two bits forgive a single surprise, and a history table learns the pattern a loop makes.

  9. 9

    The Stack & The Heapin review

    Computers · Memory · ~25 min

    A call pushes a frame and a return pops it, free of charge; a block asked for by size comes from a heap of holes that split, merge, and fragment. The two grow toward each other until they meet.