Unit 3
How a computer runs a program.
A toy eight-bit processor, one tick at a time: memory, instructions that are numbers, the fetch–execute cycle, and loops.
Before this unit
The unit, lesson by lesson
Lessons
4 lessons · 23 practice questions · about 2 hours
Memory and addresses
What is inside a computer before it does anything: numbered memory cells, a byte of eight bits, the addresses a four-wire bus can give, and a program that is nothing but numbers in memory.
Fetch, decode, execute
The loop every processor repeats: fetch an instruction from memory, decode its opcode and carry it out, one clock tick for each step. The program counter, the instruction register, and the control unit that decides what moves where.
Registers and the ALU
Where the processor actually computes: two eight-bit registers, an ALU that adds and subtracts, a sum over 255 that wraps round past zero, a subtraction that goes below zero, and flags that remember what happened.
Jumps, loops and clock speed
How a processor that can only add multiplies: a jump that sends the program counter back, a conditional jump that leaves the loop in time, counting instructions and ticks, and the clock speed that turns ticks into seconds.