Describe the fetch–decode–execute cycle
Fetch–Decode–Execute Cycle
Think of a computer as a smart kitchen where a chef (the CPU) prepares dishes (programs). The fetch–decode–execute cycle is the chef’s recipe: 1️⃣ Fetch – grab the next instruction from the pantry (memory). 2️⃣ Decode – read the recipe card to understand what to do. 3️⃣ Execute – carry out the cooking steps (arithmetic, logic, data movement). After finishing, the chef moves to the next card, repeating the cycle until the meal is complete. 🍽️
Step 1: Fetch
The CPU uses the Program Counter (PC) to know where the next instruction is stored. It sends the PC’s address to memory, which returns the instruction bytes. The instruction is then placed in the Instruction Register (IR).
Step 2: Decode
The CPU’s Control Unit examines the opcode in the IR. It determines which operation to perform and which operands (data) are needed. The unit then sets up the necessary control signals to direct the rest of the CPU.
Step 3: Execute
Depending on the decoded instruction, the CPU may:
- Perform an arithmetic operation in the Arithmetic Logic Unit (ALU) (e.g., $A + B$).
- Move data between registers or memory.
- Change the PC for a jump or branch.
Illustration of the Cycle
| Cycle Phase | Key Components | Action |
|---|---|---|
| Fetch | PC, Memory, IR | Read instruction from memory into IR. |
| Decode | Control Unit, Opcode | Interpret opcode and set control signals. |
| Execute | ALU, Registers, Memory | Perform operation, update PC. |
Exam Tips 📚
- Understand the flow: Draw a simple diagram of the three stages to visualise the process.
- Key terms: Be clear on Program Counter (PC), Instruction Register (IR), Control Unit, ALU, and operands.
- Use analogies: Relate each stage to everyday actions (e.g., fetching = grabbing a book, decoding = reading the title, executing = reading the content).
- Practice with examples: Write a short pseudo‑code and step through the cycle manually.
- Remember the cycle repeats: The PC is updated after each execute, so the next instruction is fetched.
Revision
Log in to practice.