Lesson 7: The CPU & the Fetch-Decode-Execute Cycle
We have the two ingredients: a compute unit (the ALU from the combinational-logic lesson) and fast memory (the registers from the memory lesson). Now we'll assemble them into a complete CPU and see how it runs a program, instruction after instruction. We'll meet its parts: the control unit that orch
The CPU is a tireless worker repeating the same cycle without pause: fetch the next instruction, understand what it says, execute it, move to the next. The clock drums the beat, and the program counter marks where we are in the code.
- CPU (Central Processing Unit)
- The central unit that runs programs: it fetches instructions from memory, decodes and executes them using the ALU and registers, one after another.
- Control Unit
- The CPU's conductor: it decodes each instruction and sends signals that steer the ALU, registers, and memory to perform the right steps in the right order.
- Register File
- The collection of registers inside the CPU together, holding the values the instructions currently operate on — the fastest memory, closest to the ALU.
- Program Counter (PC)
- A special register holding the address of the next instruction to fetch. Usually it advances to the following instruction; a jump simply writes a different address into it.
- Instruction Register (IR)
- A register holding the current instruction fetched from memory, so the control unit can decode and execute it.
- Clock Cycle
- A single tick of the CPU's clock that paces all operations. A modern CPU performs billions of clock cycles per second (gigahertz).
- Fetch-Decode-Execute
- The CPU's basic cycle: fetch the instruction the program counter points to, decode what it means, execute it, advance the counter — and repeat.
- Bus
- A bundle of wires carrying data, addresses, and control signals between the CPU, memory, and other components — the 'road' on which information flows.
- von Neumann Model
- An architecture in which the code (instructions) and the data are stored together in the same memory, and the CPU fetches both instructions and data from there over the same buses.