IB Computer Science2027 syllabus
Level view
A1.1.5

The fetch-decode-execute cycle

SL & HL20 min readLesson

What you will learn

You will trace how a CPU fetches one machine-language instruction from memory, decodes what it means, and executes it. You will also follow the registers and buses used to move the instruction and its data.

Before you begin

This note builds on the roles of the program counter (PC), memory address register (MAR), memory data register (MDR), instruction register (IR), control unit (CU), arithmetic logic unit (ALU), and accumulator (AC). Review A1.1.1 if those roles are unfamiliar.

Key words

TermMeaning
Instruction cycleThe repeated process the CPU uses to process instructions
FetchRetrieve the next instruction from memory
DecodeInterpret the instruction and determine the required operation
ExecuteCarry out the operation specified by the instruction
Machine languageThe binary instruction representation a processor can execute

The cycle, step by step

The PC identifies the memory address of the next instruction. The CPU repeats the following stages for each instruction:

  1. Fetch: copy the address in the PC to the MAR. The address bus carries it to memory. The CU signals a read on the control bus; memory returns the instruction on the data bus to the MDR, and the instruction is copied into the IR. The PC is updated to point to the following instruction, usually during or immediately after the fetch.
  2. Decode: the CU interprets the instruction held in the IR. It determines the operation and, where needed, the address or data that the operation uses. It prepares the control signals for execution.
  3. Execute: the CPU carries out the operation. Depending on the instruction, this may use the ALU, access a data value in memory, change a register, or alter the PC. A result may be stored in a register such as the AC.

The buses have different jobs during this process:

BusWhat it carries during an instruction cycle
Address busThe memory address currently being accessed
Data busAn instruction or data moving between memory and the CPU
Control busSignals such as a memory read or write

The roles of the buses should not be confused: an address selects a location, data is the information transferred, and control signals specify what operation is taking place.

Worked example: adding a value from memory

Consider a simplified instruction ADD 0x2A. Assume it has been fetched into the IR, the AC contains 7, and memory location 0x2A contains 5. The notation illustrates the operation; actual machine-language encodings depend on the processor.

StageWhat happens
DecodeThe CU interprets the instruction in the IR as an addition using the value at 0x2A.
Locate the operandThe address 0x2A is placed in the MAR and sent to memory on the address bus. The CU signals a read over the control bus.
Fetch the operandThe value 5 travels from memory over the data bus and is held in the MDR.
ExecuteThe ALU adds the MDR value to the AC value: 7 + 5 = 12. The result is stored in the AC.

The instruction fetch and the operand fetch are separate memory accesses: first the CPU retrieves the instruction, then execution retrieves the data that the instruction needs.

Common mix-up

It is easy to think: the PC stores the instruction being executed.
Instead, remember: the IR stores the fetched instruction; the PC holds the address of the next instruction to fetch.

It is easy to think: the data bus carries the location of the instruction.
Instead, remember: the address bus carries the location. The data bus carries the instruction or data stored there.

Check your understanding

  1. During a fetch, which register receives the address copied from the PC?
  2. What is the difference between the MDR and the IR?
  3. Which bus carries a memory read signal?

Quick recap

  • The CPU repeats fetch, decode, and execute for each instruction.
  • The PC supplies the next instruction address; the instruction is fetched through the MAR, buses, MDR, and IR.
  • The CU decodes and coordinates operations. Execution may use the ALU and registers such as the AC.
  • Address, data, and control buses carry different kinds of information.

Textbook reading

  • Computer Science (Baumgarten, Ganea, Turland, 2025), A1 Computer fundamentals > A1.1 Computer hardware and operation > A1.1.5 The fetch-decode-execute cycle, Book pp. 11–13 (PDF pp. 21–23).

Sources and further learning

  • IB Computer Science Guide, first assessment 2027, outcome A1.1.5, p. 28 (PDF p. 34).
Check your understanding4 questions · 10 marks · 12 min
Take the lesson check
Something not right?