Topic 3 · Hardware

The CPU and the fetch–decode–execute cycle

Video lesson: 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

ComponentWhat 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

The fetch–decode–execute cycle

Fetch

  1. The address held in the PC is copied to the MAR, using the address bus.
  2. The PC is incremented by 1, so it points to the next instruction.
  3. The instruction stored at the address in the MAR is fetched from memory and copied into the MDR, using the data bus.
  4. The instruction in the MDR is copied into the CIR.

Decode

  1. The control unit decodes the instruction in the CIR to work out what needs to be done.

Execute

  1. 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?

Exam tips

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.