These pages grew out of my own notes while learning how a processor handles signed and unsigned numbers. They start with logic gates you can tap and end with an if statement compiled to ARM, traced flag by flag. Each page answers the question the one before it raises, every claim is drawn as bits or gates you can change, and the pages compute their values in the open rather than simulating anything behind the scenes.
They are about real machines: the assembly is ARM, the types are C’s, and where x86 differs they say so. They are one of three ways into the same machine. The Digital Design course builds a machine of your own, from gates to a running program. These notes read the machines you will actually meet. Assembly Lab, still being written, drives a real one: you step a real instruction set one instruction at a time, with the C each instruction came from beside it.
Reading order¶
From Gates to an ALU: one full adder from five gates, four of them chained, and why the carry ripples.
From Adding to Subtracting: why 3 − 5 comes out as 0xFE, negation as NOT then add 1, the borrow as a carry, and the method on paper.
Two Readings: Drills: one pattern is two numbers; read, write, find, step, negate and judge, at 4 bits first.
Where C Meets the Wheel: ten small C programs that go wrong at the edge of the range, stepped through in registers.
Bit Lab: a miniature ALU drawn as gates, thirteen operations, the N Z C V flags, exercises, a quiz and a breadboard build.
From Gates to a Register: how the same kinds of gates are made to remember; the register the lab’s flags live in.
Signed or Unsigned: Who Decides?: every ARM branch on one compare, then a real
ifin C beside the assembly a compiler emits.From Bytes to Registers: why a byte is widened to fill a register, and what the two loads write into the spare bits.
Flag drills: randomised predict-then-check exercises on all of the above.
Part 6 can be read out of order; nothing after it depends on it.
You need binary and hex, and the truth tables of NOT, AND, OR and XOR. Nothing else is assumed.