Learning Objectives
By the end of this topic you will be able to:
Describe in detail each step of the Fetch, Decode and Execute stages
State which registers are involved at each stage
Explain how interrupts integrate into the FDE cycle
Trace register values through the FDE cycle for a given instruction
Fetch Stage
Step 1 — Fetch
1
PC → MAR: contents of the Program Counter (address of next instruction) copied to the Memory Address Register.
2
Memory → MDR: address bus carries address from MAR to memory. Data at that address is placed on the data bus and loaded into the MDR.
3
MDR → CIR: the fetched instruction is copied from the MDR to the Current Instruction Register.
4
PC increments: the Program Counter is incremented by the size of one instruction to point to the next instruction.
Interrupts
Interrupts in the FDE Cycle
An interrupt is a signal sent to the CPU to pause the current task and deal with a higher-priority event. The CPU checks for interrupts at the end of each execute stage.
If an interrupt is flagged: current register values are saved to the stack (context saved).
The PC is loaded with the address of the Interrupt Service Routine (ISR).
The ISR executes. When complete, saved context is restored from the stack and the original program resumes.
Interrupt types: hardware (keyboard, mouse), software (program exception), timer (OS scheduler). Higher priority interrupts can interrupt ISRs (vectored interrupts).
Common Mistakes
Don’t Lose Marks
!
Saying the PC increments during decode or execute — the PC increments during the fetch stage, after the instruction address is copied to the MAR.
!
Forgetting to mention both the address bus and data bus during the fetch stage. The address bus carries the MAR value; the data bus returns the instruction to the MDR.
!
Saying interrupts are checked continuously — they are checked at the end of each execute stage, not during fetch or decode.