Computer organization is about the parts a computer is built from and how they are joined. Computer architecture is the view a programmer sees: the instructions, registers and memory model. This course covers both.
The von Neumann design
Almost every computer since 1945 follows the design described by John von Neumann and others:
- a CPU (processor), which runs instructions;
- a memory, which holds both the program and its data, as numbers (the stored program idea: a program can be loaded like any other data);
- input and output devices;
- buses connecting them.
Inside the CPU:
| Part | Job |
|---|---|
| Control unit | fetches instructions, decodes them, and sends control signals to everything else |
| ALU (arithmetic logic unit) | adds, subtracts, compares, ANDs and ORs (the circuits from Digital Logic) |
| Registers | a few very fast storage places: operands, results, the program counter (PC, the address of the next instruction) |
Buses
A bus is a set of shared wires.
- The address bus says which memory cell or device to use. With k address lines, 2ᵏ addresses are possible: 32 lines reach 4 GB.
- The data bus carries the value read or written. Its width (8, 32, 64 bits) is how much moves at once.
- The control bus says what to do: read, write, wait, interrupt.
memory = [0] * 16
program = ["LOADI 5", "ADD 10", "STORE 11", "HALT"]
memory[0:4] = program # the program is stored in memory...
memory[10] = 37 # ...and so is its data
for address, value in enumerate(memory[:12]):
if value != 0:
print("address", address, ":", value)Because program and data share one memory and one bus, the CPU often waits for memory: the von Neumann bottleneck. Caches (later in this course) exist to hide it. Some designs, especially small microcontrollers, keep instructions and data in separate memories with separate buses: the Harvard architecture.
for lines in [8, 16, 20, 32]:
addresses = 2 ** lines
print(lines, "address lines ->", addresses, "addresses")
print("32 lines reach", 2 ** 32 // 2 ** 30, "GB of bytes")Common mistakes
- Thinking registers are part of memory. They are inside the CPU, with their own names (like
r1oreax), and far faster. - Mixing up the buses: the address bus says where, the data bus carries what.
- Thinking a program and its data are different kinds of thing to the hardware: both are just bits in memory.
Quick check
My notes
Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.