Topic 3 · Hardware
The CPU and the fetch–decode–execute cycle
▶ Watch the video lessonShort, exam-focused explanation of this topic on the CS with Aamir YouTube channel.The central processing unit (CPU) processes the instructions and data that make a computer work. It does this by repeating the fetch–decode–execute cycle billions of times every second. Computers that store data and instructions together in the same memory follow the Von Neumann architecture.
Components of the CPU
| Component | What it does |
|---|---|
| Arithmetic logic unit (ALU) | Carries out calculations and logical comparisons |
| Control unit (CU) | Decodes instructions and sends control signals to manage the flow of data through the CPU |
| Program counter (PC) | Holds the address of the next instruction to be fetched |
| Memory address register (MAR) | Holds the address of the memory location being read from or written to |
| Memory data register (MDR) | Holds the data or instruction that has been fetched from, or is to be written to, memory |
| Current instruction register (CIR) | Holds the instruction currently being decoded and executed |
| Accumulator (ACC) | Temporarily holds the results of calculations done by the ALU |
The buses
- Address bus: carries addresses from the CPU to memory. It is one-way (unidirectional).
- Data bus: carries data and instructions between the CPU and memory. It is two-way (bidirectional).
- Control bus: carries control signals, such as read and write signals. It is two-way.
The fetch–decode–execute cycle
Fetch
- The address held in the PC is copied to the MAR, using the address bus.
- The PC is incremented by 1, so it points to the next instruction.
- The instruction stored at the address in the MAR is fetched from memory and copied into the MDR, using the data bus.
- The instruction in the MDR is copied into the CIR.
Decode
- The control unit decodes the instruction in the CIR to work out what needs to be done.
Execute
- The instruction is carried out, for example a calculation by the ALU, with the result stored in the accumulator. Then the cycle starts again.
What affects CPU performance?
- Clock speed: the number of cycles the CPU can carry out per second, measured in GHz. A higher clock speed means more instructions can be processed per second.
- Number of cores: each core can process instructions, so more cores can process more instructions at the same time.
- Cache size: cache is very fast memory inside the CPU that stores frequently used data and instructions. A larger cache means the CPU waits less for data from RAM.
Exam tips
- Learn the fetch stage in the exact order – PC → MAR → PC incremented → memory → MDR → CIR. Each correct step usually earns a mark.
- Always name the bus used: the address bus for addresses and the data bus for the instruction.
- Don't confuse the MAR (holds an address) with the MDR (holds the data or instruction).
Want the full topic notes, slides and worksheets? See Notes & Slides, practise with the free CS with Aamir Quiz App, or order the O Level Computer Science Study Guide.