The Fetch-Decode-Execute (FDE) Cycle

Every computer program consists of a sequence of binary instructions stored in primary memory. To run a program, the CPU continuously repeats a three-phase cycle called the Fetch-Decode-Execute (FDE) Cycle.


Learning Objectives

  • Trace the register-level operations of the Fetch stage step-by-step.
  • Explain how the Control Unit carries out the Decode stage using opcodes and operands.
  • Describe the Execute stage across arithmetic, data movement, and control instructions.
  • Explain the role of hardware and software interrupts within the instruction cycle.

Overview of the FDE Cycle

+-------------------------------------------------------------+
|                        1. FETCH                             |
|  - Address copied from PC to MAR                            |
|  - PC incremented by 1 (PC <- PC + 1)                       |
|  - Instruction fetched from RAM via Data Bus into MDR       |
|  - Instruction copied from MDR to CIR                       |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|                        2. DECODE                            |
|  - Control Unit splits instruction in CIR into:             |
|    * Opcode (command to execute)                            |
|    * Operand (data or memory address)                       |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|                        3. EXECUTE                           |
|  - CU sends control signals to CPU components (ALU/RAM)     |
|  - Operations performed; results stored in ACC or RAM       |
|  - Interrupt lines checked before starting next cycle       |
+-------------------------------------------------------------+

1. The Fetch Stage in Detail

The purpose of the Fetch stage is to retrieve the next machine-code instruction from primary memory (RAM) and bring it into the CPU.

Step-by-Step Register Operations:

  1. $PC \longrightarrow MAR$:

The memory address stored in the Program Counter (PC) is copied into the Memory Address Register (MAR) across the internal bus.

  1. $PC \longleftarrow PC + 1$:

The Program Counter is incremented by 1 so that it points to the memory address of the next sequential instruction in memory.

  1. Memory Read Signal:

The Control Unit places the address from MAR onto the Address Bus and asserts a Memory Read command on the Control Bus.

  1. $RAM \longrightarrow MDR$:

The instruction located at that physical RAM address is retrieved and transferred across the Data Bus into the Memory Data Register (MDR).

  1. $MDR \longrightarrow CIR$:

The instruction is copied from the MDR into the Current Instruction Register (CIR), completing the Fetch phase.


2. The Decode Stage in Detail

Once the instruction is safely held in the CIR, the Control Unit (CU) decodes the binary bits to determine what action is required.

Instruction Anatomy:

A machine instruction is divided into two distinct logical fields:

$$\text{Instruction} = \text{Opcode} + \text{Operand}$$
+---------------------------------------+---------------------------------------+
|             OPCODE (6 bits)           |            OPERAND (10 bits)          |
|    Specifies Operation (e.g. ADD)     |   Specifies Data or Address (e.g. 50) |
+---------------------------------------+---------------------------------------+
  • Opcode (Operation Code):
  • The binary pattern specifying the specific CPU instruction to perform (e.g., LOAD, STORE, ADD, COMPARE, JUMP).
  • The CU consults the CPU's built-in instruction set architecture decoder.
  • Operand:
  • The value or address that the opcode operates on.
  • In Immediate Addressing, the operand is the actual numerical data value (e.g. add the number 5).
  • In Direct Addressing, the operand contains the memory address where the required data is located in RAM.

3. The Execute Stage in Detail

During the Execute stage, the Control Unit directs other CPU subsystems to carry out the decoded instruction:

Common Execution Scenarios:

  1. Arithmetic / Logic Calculation (e.g., ADD 200):
  • The address 200 from the operand is loaded into the MAR.
  • The value stored at address 200 in RAM is fetched into the MDR.
  • The ALU adds the value in MDR to the existing value in the Accumulator (ACC).
  • The final sum is written back into the ACC.
  1. Data Storage (e.g., STORE 350):
  • The destination address 350 is placed into the MAR.
  • The value currently held in the ACC is copied into the MDR.
  • The CU asserts a Memory Write signal on the Control Bus, writing the value from MDR across the Data Bus into RAM location 350.
  1. Branch / Jump Instruction (e.g., JMP 120):
  • The target jump address 120 in the operand is copied directly into the Program Counter (PC).
  • The normal sequential execution ($PC + 1$) is overridden, and the next instruction will be fetched from address 120.

4. Checking for Interrupts

Before the CPU begins fetching the next instruction, it checks the Interrupt Register on the Control Bus:

  • If an external hardware event (such as a keyboard keystroke or printer out-of-paper signal) has raised an interrupt, the CPU pauses the current program, saves its registers, and executes the Interrupt Service Routine (ISR).
  • If no interrupt is pending, the CPU begins the Fetch stage of the next instruction immediately.

Written practice and self-review

Once an instruction is fetched into the Current Instruction Register (CIR), the CPU proceeds through the Decode and Execute stages.

  1. Describe what occurs during the Decode stage, referencing opcode and operand.
  2. Describe what occurs during the Execute stage if the instruction requires:
  • An arithmetic calculation (e.g. adding a value).
  • Reading data from an additional memory address.

Write an explanation before checking the theory. Check that each claim answers the question, uses the correct concept and explains why it applies. Discuss uncertain points with a teacher. The structured exercise below checks specific facts; it does not automatically mark this explanation.

AI Socratic Tutor

All-Access
Sign in or create an account. AI Tutor is an All-Access benefit.
Sign Up

Need guidance? Ask a question or use the hint below.

AI Socratic Tutor is an All-Access Benefit

Unlock step-by-step Socratic hints, algorithm trace table walkthroughs, and error diagnostics for every Cambridge exercise.

You're chatting with an AI tutor, not a person. AI can make mistakes, so double-check its answers.

Application: Check the reasoning

+30 XP

Application: Check the reasoning

  1. Register holding address of next instruction: [Space 1]
  2. Register holding instruction being decoded: [Space 2]
  3. Register holding address being accessed in memory: [Space 3]
Word Bank / Available Cards (Drag into spaces or tap to place)
All-Access Required

Interactive exercises for Module 2 and beyond require an active plan.