Hardware

Hardware

The fetch-decode-execute cycle

Computer Architecture Paper 1 9 min read

On this page
  1. In this note
  2. What you should already know
  3. The cycle
  4. Summary
  5. Ways they test it
  6. What the examiner looks for
  7. Past-paper questions, solved
  8. Common mistakes
  9. Practice
  10. Can I do this?
  11. Quiz

In this note

Syllabus 3.1 Computer architecture
  • 3.1.2bDescribe the fetch-decode-execute (FDE) cycle, including the role of each component in the process: storing data and addresses in registers, using buses to transmit them, using the units to fetch, decode and execute.

Before this: The CPU and Von Neumann architecture. Next: CPU performance and embedded systems.

Part 1Learn the topic

The notes: every idea from the start, with our own examples.

What you should already know

The registers

PC: address of the next instruction. MAR: address being fetched. MDR: data fetched. CIR: current instruction. ACC: results.

Quick check: which register holds the address of the next instruction?

The program counter (PC).

The buses

Address bus: addresses. Data bus: data and instructions. Control bus: signals.

Quick check: which bus brings the instruction from RAM?

The data bus.

The cycle

The CPU runs every program by repeating three stages over and over, billions of times a second: fetch the next instruction from RAM, decode it to work out what it means, then execute it. This is the fetch-decode-execute (FDE) cycle.

1 Fetch

PCMARRAMMDRCIR (in CU)① address② address bus③ data bus: the instruction④ to the CIRPC + 1
The fetch stage, in order ① to ④. The PC is increased by 1 so it points to the next instruction.

General methodThe fetch stage

  1. The program counter (PC) holds the address of the next instruction. This address is copied to the MAR.
  2. The PC is incremented (increased by 1) so it holds the address of the instruction after this one.
  3. The address in the MAR is sent to RAM along the address bus.
  4. The control unit sends a read signal along the control bus.
  5. The instruction stored at that address is sent from RAM to the MDR along the data bus.
  6. The instruction is copied from the MDR to the CIR (in the control unit).

2 Decode

General methodThe decode stage

  1. The instruction is in the CIR, in the control unit.
  2. The control unit decodes the instruction using the instruction set (the list of machine code commands the CPU understands).
  3. The instruction is split into the opcode (what to do, e.g. ADD) and the operand (what to do it to: data or an address).

3 Execute

General methodThe execute stage

  1. The control unit sends control signals to the parts that are needed to carry out the instruction.
  2. If the instruction needs data from memory, its address goes to the MAR and the data comes back into the MDR.
  3. If it is a calculation or comparison, the ALU carries it out and the result goes to the accumulator (ACC).
  4. The cycle then starts again with the next fetch.
StageRegisters usedBuses used
FetchPC, MAR, MDR, CIRaddress bus (MAR → RAM), data bus (RAM → MDR), control bus (read signal)
DecodeCIR (in the CU)data bus (MDR → CIR)
ExecuteACC, MAR, MDR (if more data is needed)any, depending on the instruction

Try it yourself

1
Which register is incremented during the fetch stage?
Show answer

Answer Program counter (PC)

2
Along which bus is the address sent from the MAR to RAM?
Show answer

Answer Address bus

3
What does the control unit use to decode an instruction?
Show answer

Answer The instruction set

Summary

  • Fetch: PC → MAR; PC + 1; MAR → RAM (address bus); instruction RAM → MDR (data bus); MDR → CIR.
  • Decode: the CU decodes the instruction in the CIR using the instruction set (opcode + operand).
  • Execute: the CU sends signals; the ALU calculates; results in the ACC. Then the cycle repeats.

If you see …

  • "registers used in the fetch stage"PC · MAR · MDR · CIR
  • "describe the decode stage"MDR → CIR / CU · data bus · split into opcode and operand · CU decodes · instruction set
Part 2How it is examined

Question types, what the examiner gives marks for, and real past-paper questions solved.

Ways they test it

Type 1 Fetch paragraph

"Complete the paragraph about fetching an instruction" [7]

Spot it a word list.

  1. Follow the fetch method in order: address · MAR · RAM · MDR · data · CIR · CU.

Type 2 Registers per stage

"Give two registers used in the fetch stage" [2]; "one register used in the execute stage" [1]

Spot it "stage".

  1. Fetch: PC, MAR, MDR, CIR. Execute: ACC (also MAR, MDR).

Type 3 Describe a stage

"Describe what happens at the decode stage" [3]

Spot it "decode".

  1. MDR → CIR on the data bus; split into opcode and operand; CU decodes using the instruction set.

Type 4 Diagram

"Complete and annotate the diagram to show how the data is decoded" [4]; draw the fetch stage [4]

Spot it "annotate".

  1. Boxes for each register, arrows in order, and label each arrow with the bus.

Type 5 Correct the statement

"Two statements are not correct. Suggest a corrected statement" [4]

Spot it "incorrect".

  1. Typical traps: "MAR stores instructions" (addresses), "MDR gets data from the PC" (from RAM via the data bus).

What the examiner looks for

"Describe what happens at the decode stage of the cycle" [3]

Marking points (one mark each, up to the marks shown)

  • The CIR / CU receives the instruction from the MDR …
  • … using the data bus
  • The instruction is separated into opcode and operand
  • The control unit decodes the instruction …
  • … using an instruction set

Keywords CIR control unit opcode operand instruction set

The fetch stage drawn as a diagram [4]

Marking points (one mark each, up to the marks shown)

  • The registers MAR, MDR and PC shown
  • Address sent from PC to MAR; PC is incremented
  • Address sent from MAR to RAM … using the address bus
  • Data / instruction sent from RAM to MDR … using the data bus
  • Data / instruction sent from MDR to CIR / CU
  • Control unit sending a control signal … using the control bus

Keywords PC MAR address bus MDR data bus CIR

Past-paper questions, solved

2210/12/M/J/24 Q5Paper 1 · Computer systems8 marksFull size
Complete the paragraph about fetching an instruction; define instruction set

How to start Walk through the fetch method: what does the PC hold, where does it go, which bus, where does the instruction land?

Show a full-mark answer and the mark scheme

(a) address · memory address register (MAR) · random access memory (RAM) · memory data register (MDR) · data · current instruction register (CIR) · control unit (CU)

(b) A list of all the machine code commands that can be processed by the CPU.

PartAnswer / workingMarksGuidance
5(a)address · MAR · RAM · MDR · data · CIR · CU, one mark each in the correct placeB7
5(b)a list of (machine code) commands that can be processed by the CPUB1
Total: 8 marks
0478/11/O/N/24 Q5Paper 1 · Computer systems9 marksFull size
Registers in the fetch and execute stages; the decode stage; the three buses

How to start (b) is the decode method: three points. (d) circle the three real bus names.

Show a full-mark answer and the mark scheme

(a) Program counter (PC); memory address register (MAR).

(b) The instruction is sent from the MDR to the CIR in the control unit along the data bus. It is split into the opcode and the operand, and the control unit decodes it using the instruction set.

(c) Accumulator (ACC).

(d) address · data · control

PartAnswer / workingMarksGuidance
5(a)Any two: PC · MAR · MDR · CIRB2
5(b)Any three: MDR → CIR / CU · data bus · opcode and operand · CU decodes · instruction setB3
5(c)Any one: ACC · MAR · MDRB1
5(d)data · address · controlB3
Total: 9 marks
0478/12/F/M/24 Q2Paper 1 · Computer systems4 marksFull size
Find and correct the two wrong statements about registers

How to start Check each statement against the register table: who holds addresses, who holds data, where does data come from?

Show a full-mark answer and the mark scheme

Incorrect statement 1: B. Corrected: the MAR stores the address of the instruction / data to be fetched, not the instructions.

Incorrect statement 2: C. Corrected: the MDR stores data passed to it from RAM along the data bus (from the address in the MAR), not from the PC.

PartAnswer / workingMarksGuidance
2(a)B … MAR stores addresses, not instructions · C … data comes from RAM / the address in the MAR (data bus), not the PCB4
Total: 4 marks

Common mistakes

  • ✗ "The PC sends the instruction to the MAR"✓ "The PC's ADDRESS is copied to the MAR"The PC never holds an instruction.
  • ✗ "The address goes on the data bus"✓ "Addresses go on the address bus"
  • ✗ Forgetting the PC is incremented✓ "PC + 1" in the fetch stageIt earns a mark in diagrams.
  • ✗ "The ALU decodes the instruction"✓ "The control unit decodes it using the instruction set"

Practice

Practice: easy, medium, hard

Easy

1
Name the three stages of the cycle, in order.
Show answer

Answer Fetch, decode, execute

2
Which register receives the instruction from RAM?
Show answer

Answer MDR (memory data register)

3
Which register holds the instruction while it is decoded?
Show answer

Answer CIR (current instruction register)

Medium

1
Describe the fetch stage. [4]
Show answer

Answer PC address copied to MAR; PC incremented; address sent to RAM on the address bus; instruction returned to MDR on the data bus; copied to CIR

2
What are the two parts an instruction is split into when it is decoded?
Show answer

Answer Opcode and operand

Hard

1
An instruction says ADD the value at address 50 to the accumulator. Describe what happens in the execute stage. [3]
Show answer

Answer CU sends signals; address 50 goes to the MAR → RAM; the value returns to the MDR on the data bus; the ALU adds it to the ACC; result stored in the ACC

2
Explain why the PC is incremented during the fetch stage.
Show answer

Answer So it holds the address of the next instruction, ready for the next cycle

Can I do this?

Anything unticked: revise that section first. All ticked: take the quiz.

Quiz

The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.

Your progress on this note is saved when JavaScript is on.

⬇️ Download this chapter as a PDF: Full notes