Fetch Decode Execute Cycle & CPU Notes
CPU Components
- Control Unit (CU)
- Arithmetic & Logic Unit (ALU)
- Registers: Program Counter (PC), Memory Address Register (MAR), Memory Data Register (MDR), Current Instruction Register (CIR), Accumulator (ACC)
- Cache
- Main Memory (RAM)
- Input / Output devices
Von Neumann Buses
- Address Bus – carries memory addresses from MAR to RAM
- Data Bus – carries data/instructions between CPU and RAM
- Control Bus – carries control signals (read/write, clock, interrupt)
Fetch-Decode-Execute (FDE) Cycle – Overview
- Continuous loop; one instruction handled per cycle
- Stages: Fetch → Decode → Execute → repeat
- CPU can perform billions of cycles per second
Fetch Stage – Key Steps
- PC value (address of next instruction) ➔ MAR
- Address sent via Address Bus to RAM
- Instruction at that address returned via Data Bus to MDR
- Instruction copied MDR→CIR
- PC incremented by 1 (points to following instruction)
- Instruction passed to Control Unit for decoding
Registers Used in Fetch
- PC – holds address of next instruction
- MAR – holds address being accessed
- MDR – temporarily holds data/instruction fetched
- CIR – holds current instruction ready for decode/execute
Decode Stage
- Control Unit interprets opcode in CIR
- Determines required operation, operands, and hardware resources
Execute Stage
- ALU/Accumulator perform calculation, logic or data movement
- Results stored in ACC, registers, or RAM as directed
- Cycle repeats (return to Fetch)
CPU ↔ RAM Interaction
- RAM stores currently-needed data & program instructions
- CPU fetches instructions/data from RAM, processes them, writes back results if needed
- RAM organised as memory addresses containing either data or instructions
Quick-Recall Exam Points
- FDE cycle = Fetch→Decode→Execute
- Two events in cycle: instruction fetched from memory; instruction decoded/executed; PC incremented, etc.
- Four main registers in Fetch: PC,MAR,MDR,CIR
- Buses: Address, Data, Control
- After Fetch, PC is incremented; this occurs at end of Fetch stage