Study Guide
The Fetch-Decode-Execute Cycle
How the CPU obeys a program one instruction at a time: fetch the instruction, decode it, execute it, and what each register, unit and bus does at every stage, followed through a tiny invented program.
Lesson 3.2 Computer Systems
For: Cambridge IGCSE Computer Science learners
Stage: Think
The cook’s routine, again
Back in the made-up school kitchen from the last lesson: the cook takes one recipe card from the folder, works out what it says, does it, and moves on to the next card. The cook does this for every card until the lunch is made.
Think it through
Name the three things the cook does with each card, in order. And what must the cook change on the notepad before going back for the next card?
- Hint 1: What happens to the card first? Then what does the cook need to do before acting on it?
Show what happens
The cook takes the card, works out what it asks for, then does it. Before the next card, the notepad’s “next card number” goes up by one.
The CPU follows every program with the same routine, which is called the fetch-decode-execute cycle:
- Fetch: copy the next instruction from memory into the CPU.
- Decode: work out what the instruction asks for.
- Execute: carry the instruction out.
Then the cycle starts again for the next instruction. A CPU repeats it many millions of times each second.
Stage: Discover
Fetch: getting the instruction
To follow the cycle, we need a program. The one below is invented for this lesson, with simple word-like instructions so that it can be read. A real program is a long list of binary patterns, and real CPUs use different instructions. It adds the numbers stored at addresses 20 and 21 and puts the answer in address 22.
| Address | What is stored there | What it means |
|---|---|---|
| 1 | LOAD 20 | Copy the contents of address 20 into the ACC |
| 2 | ADD 21 | Add the contents of address 21 to the value in the ACC |
| 3 | STORE 22 | Copy the value in the ACC into address 22 |
| 20 | 9 | Data |
| 21 | 5 | Data |
| 22 | (empty) | Data |
The program counter (PC) holds 1, the address of the first instruction. The ACC holds 0.
Think it through
Before the CPU can obey LOAD 20, it has to bring it from memory into the CPU. Using the registers and buses from the last lesson, which would you expect to be involved, and in what order?
Work this out on paper or the board first. Nothing here is marked: compare yours with the model answer.
- Hint 1: Which register holds the address of the next instruction?
- Hint 2: Which register holds an address that is about to be sent to memory?
- Hint 3: What comes back from memory, and where does it wait?
Show a model answer
One possible order: the address in the PC goes to the MAR, and along the address bus to memory; memory finds the instruction and sends it along the data bus to the MDR; the instruction is copied to the CIR; and the PC is increased. The steps below follow exactly this order.
Each step names the part that acts. The fetch stage always has the same steps, whatever the instruction is.
Program counter (PC)
Step 1 of 6: The PC holds the address of the next instruction
It holds 1, the address of the instruction LOAD 20.
PC to MAR, then the address bus
Step 2 of 6: The address is copied to the MAR
The address 1 is copied from the PC to the MAR. From there it travels along the address bus to memory.
Control unit and the control bus
Step 3 of 6: A read signal is sent
The control unit sends a “read” signal along the control bus, so memory knows to look up address 1 and send back what is stored there.
Memory, the data bus and the MDR
Step 4 of 6: The instruction arrives in the MDR
The contents of address 1, the instruction LOAD 20, travel along the data bus and wait in the MDR.
MDR to CIR
Step 5 of 6: The instruction is copied to the CIR
LOAD 20 is copied from the MDR to the CIR, ready to be decoded and executed.
Program counter (PC)
Step 6 of 6: The PC is increased by one
The PC goes up from 1 to 2, so that it now holds the address of the next instruction.
Technical detail: Some books put this step second, straight after the address is copied to the MAR. The result is the same, because the address is already safely in the MAR.
The instruction does not go from memory straight to the CIR. Everything that arrives from memory, instruction or data, comes through the MDR first. The MDR is a waiting place; the CIR is where the instruction is kept while it is obeyed.
Check your understanding
Show the answer
Answer: C. The address 2 is copied from the PC to the MAR.
The fetch starts by copying the address in the PC to the MAR.
Stage: Discover
Decode: working out what it means
The CIR now holds LOAD 20. In memory, and in the CIR, the instruction is a pattern of bits, not words.
Think it through
The CIR holds the bits for LOAD 20. Before the computer can carry it out, what does the CPU need to work out, and which part of the CPU do you think does that?
- Hint 1: Think about the parts of an instruction: what is to be done, and what is it to be done with?
Show what happens
It must work out what the instruction asks for: the operation (copy a value into the ACC) and the address it refers to (20). The part that directs the others is the control unit.
In the decode stage, the control unit works out what the instruction in the CIR asks for. An instruction has two parts: what to do (here, LOAD) and what to do it with (here, address 20). Once the control unit knows, it can send the signals that make the other parts carry the instruction out.
Check your understanding
Show the answer
Answer: D. The control unit works out what the instruction in the CIR asks for.
Decode: the control unit interprets the instruction held in the CIR.
Stage: Discover
Execute: carrying out LOAD 20
LOAD 20 means “copy the contents of address 20 into the ACC”. The value is in memory, so it must be fetched, like the instruction was.
Think it through
Which two registers do you expect the value from address 20 to pass through on its way to the ACC, and which register must first hold the address 20?
Work this out on paper or the board first. Nothing here is marked: compare yours with the model answer.
- Hint 1: Everything that arrives from memory waits in one register first.
The same buses are used as in the fetch, but this time what is fetched is data, not an instruction.
Control unit
Step 1 of 4: The address in the instruction goes to the MAR
The control unit copies the address 20, which is part of the instruction in the CIR, into the MAR.
Address bus and control bus
Step 2 of 4: Memory is asked to read
The address 20 travels along the address bus and a “read” signal along the control bus.
Data bus and the MDR
Step 3 of 4: The value arrives in the MDR
The contents of address 20, which is 9, travel along the data bus and wait in the MDR.
MDR to ACC
Step 4 of 4: The value is copied to the ACC
The control unit copies 9 from the MDR into the ACC. The ACC now holds 9, and LOAD 20 has been executed.
Stage: Predict
Execute: ADD and STORE
The PC now holds 2, so the cycle begins again and fetches ADD 21 in just the same way as before. Decoding finds that the instruction means “add the contents of address 21 to the value in the ACC”. The ACC already holds 9.
Think it through
Executing ADD 21 means adding the contents of address 21, which is 5, to the 9 in the ACC. Which part of the CPU does the addition, and where do you expect the answer to end up?
- Hint 1: Which unit does arithmetic?
- Hint 2: Which register holds the ALU’s results?
Show what happens
The ALU does the adding, and the answer ends up in the ACC.
ADD 21 is executed like LOAD, with one difference. The address 21 goes to the MAR and the value 5 arrives in the MDR. This time, instead of being copied to the ACC, it is passed to the ALU, which adds it to the 9 already in the ACC. The result, 14, is put back in the ACC.
STORE 22 works in the opposite direction. The address 22 goes to the MAR, and the value in the ACC is copied to the MDR. The control unit sends a “write” signal along the control bus, and the value travels from the MDR along the data bus into memory address 22.
Check your understanding
Show the answer
Answer: B. The value being stored, 14, from the CPU to memory.
STORE sends the ACC’s value along the data bus into memory.
Stage: Experiment
Tracing the whole program
Now put the three instructions together. A trace table records what the registers hold after each stage. First, see how one row is worked out by reasoning.
At the start, the PC holds 1, the ACC holds 0, and the MAR, MDR and CIR hold nothing yet.
- Copy the PC to the MAR. The address of the next instruction is 1, so the MAR holds 1.
- Read from memory into the MDR. Address 1 holds LOAD 20, so the MDR holds LOAD 20.
- Copy the MDR to the CIR. The CIR holds LOAD 20, because the instruction must be kept while it is decoded and executed.
- Increase the PC. The PC goes from 1 to 2, so that the next fetch will find ADD 21.
- Leave alone what has not been used. The ACC is still 0: nothing has been executed yet.
Each row of the table is worked out by asking, for every register, whether it was used in this stage, and if it was, what went into it.
| After | PC | MAR | MDR | CIR | ACC |
|---|---|---|---|---|---|
| Start | 1 | empty | empty | empty | 0 |
| Fetching LOAD 20 | 2 | 1 | LOAD 20 | LOAD 20 | 0 |
| Executing LOAD 20 | 2 | LOAD 20 | |||
| Fetching ADD 21 | 9 | ||||
| Executing ADD 21 | 3 | ADD 21 | |||
| Fetching STORE 22 | |||||
| Executing STORE 22 | 4 | STORE 22 | 14 |
- Ask of each register: was it used in this stage? If it was, what went into it?
Show the completed table
| After | PC | MAR | MDR | CIR | ACC |
|---|---|---|---|---|---|
| Start | 1 | empty | empty | empty | 0 |
| Fetching LOAD 20 | 2 | 1 | LOAD 20 | LOAD 20 | 0 |
| Executing LOAD 20 | 2 | 20 | 9 | LOAD 20 | 9 |
| Fetching ADD 21 | 3 | 2 | ADD 21 | ADD 21 | 9 |
| Executing ADD 21 | 3 | 21 | 5 | ADD 21 | 14 |
| Fetching STORE 22 | 4 | 3 | STORE 22 | STORE 22 | 14 |
| Executing STORE 22 | 4 | 22 | 14 | STORE 22 | 14 |
Stage: Experiment
Which bus carries it?
Every transfer in the cycle uses one of the three buses. Use what the last steps showed.
| What is travelling | Bus |
|---|---|
| The address 2, from the MAR towards memory | |
| The instruction ADD 21, from memory to the MDR | |
| A “read” signal from the control unit | |
| The value 14, from the CPU to memory in a STORE | |
| The address 22, for the STORE | |
| A “write” signal from the control unit |
- Where: address bus. What: data bus. Do what: control bus.
Show the completed table
| What is travelling | Bus |
|---|---|
| The address 2, from the MAR towards memory | address |
| The instruction ADD 21, from memory to the MDR | data |
| A “read” signal from the control unit | control |
| The value 14, from the CPU to memory in a STORE | data |
| The address 22, for the STORE | address |
| A “write” signal from the control unit | control |
Stage: Apply
Using the cycle in new situations
Apply it
Show the answer
Answer: A. PC: 41. MAR: 40.
The PC points at the next instruction by the end of every fetch.
Apply it
Apply it
Show the answer
Answer: D. Memory, then the data bus, then the MDR, then the ALU.
Values arrive from memory by the data bus into the MDR, and are passed on from there.
Stage: Consolidate
Show what you know
Think it through
In your own words, explain why the PC has to be increased during every fetch. What would happen if it were not?
Show a model answer
Because the PC holds the address of the next instruction. If it were not increased, the next fetch would find the same address and fetch the same instruction again, so the program would repeat one instruction and never reach the next one. (A jump instruction, which a later course covers, works by putting a different address in the PC on purpose.)
Check your understanding
Show the answer
Answer: C. Fetch, then decode, then execute.
Fetch, decode, execute: and then again.
- The CPU repeats the fetch-decode-execute cycle for every instruction.
- Fetch: the address in the PC is copied to the MAR and sent along the address bus; the control unit sends a read signal along the control bus; the instruction comes back along the data bus into the MDR, and is copied to the CIR; the PC is increased by one.
- Decode: the control unit works out what the instruction in the CIR asks for.
- Execute: the control unit directs the other parts. Data from memory arrives through the MAR and MDR; the ALU does any calculation, and results are held in the ACC.
- The address bus carries addresses, the data bus carries data and instructions, and the control bus carries control signals.
Sources and scope
- What this lesson is. The second lesson of the Computer Systems module, written for this site. It teaches the fetch-decode-execute cycle as set out in Cambridge IGCSE Computer Science (0478) point 3.1.2(b) (2026 to 2028, version 6), building on Lesson 1. Its curriculum links are provisional and imply no endorsement by any examination board. It has not been approved by the site owner.
- Original material. The school kitchen, and the three-instruction program with its addresses and values, are fictional and were written for this lesson. The names LOAD, ADD and STORE are used for readability; they are not the instructions of any real CPU.
- Simplified on purpose. Real instructions are binary patterns; real CPUs differ in how they order the steps, and may overlap the stages of different instructions to save time. The PC is shown being increased at the end of the fetch, as many textbooks do. Jumps, interrupts and more registers are left to later courses.
A register that holds the data the ALU is working on and the results of its calculations.
The bus that carries the address of a memory location from the CPU to memory. It carries addresses only, and in one direction.
The part of the CPU that does arithmetic, such as adding and subtracting, and logic, such as comparing two values or applying AND, OR and NOT.
The number system with only two digits, 0 and 1, in which each column is worth twice the column to its right.
A single binary digit: 0 or 1. The smallest unit of data a computer stores.
A set of wires that carries bits between parts of a computer.
The bus that carries control signals, such as read and write, from the control unit to memory and the other parts of the computer.
The part of the CPU that decodes each instruction and sends signals that make the other parts of the computer carry it out, in the right order.
The part of a computer that carries out instructions: it fetches each instruction from memory, decodes it and executes it, processing data so that a result can be output.
A register that holds the instruction that is being decoded and executed.
The bus that carries data and instructions between the CPU and memory, in both directions.
The three-stage process the CPU repeats for every instruction: fetch the instruction from memory, decode it to work out what it means, then execute it.
A register that holds the address of the memory location the CPU is about to read from or write to.
A register that holds the data or instruction that has just been read from memory, or that is about to be written to memory.
A register that holds the address in memory of the next instruction to be fetched.
A very small, very fast storage location inside the CPU that holds a fixed number of bits: the address, data or instruction the CPU is working on at that moment.
A table used to follow an algorithm by hand, with a column for each variable and for the output and a row for each step, to record how the values change.
Your progress on this lesson
Saved in this browser only. It is not sent anywhere, does not follow you to another device, and is lost if you clear this site’s data.
This browser is not allowing the site to save progress, so it will be forgotten when you leave the page.