Fetch-Decode-Execute and RTL (Control)
Context: FIT1047_MOC ยท how the control unit actually runs a program โ the cycle + Register Transfer Language ยท the A2/exam hand-trace skill ยท registers from Sequential Circuits (Latches, Flip-Flops, Registers)
Quick Revision
- ๐ฏ Objective: every instruction = fetch (steps 1โ4) โ decode (5โ6 as needed) โ execute (instruction-specific), one register transfer per clock cycle.
- ๐ฆ Core Components: clock (oscillator, cycles, GHz) โ RTL steps โ control signals (which register/memory/ALU mode per step).
- โก Key Constraint: fetch is ALWAYS the same 4 steps; decode steps 5โ6 vary by instruction (both / only 5 / neither) โ knowing which is where marks are won.
๐ Core
- Control unit โ coordinates registers, ALU, memory per instruction via three phases: fetch โ decode โ execute.
- Clock โ oscillator flipping 0โ1; each flip = a cycle; cycles/second in Hz (modern: GHz). Unit convention: one register/memory/ALU transfer per cycle (real instructions vary โ memory loads can cost hundreds).
- Control signals โ physical wires selecting: which register reads/writes, memory read-or-write, ALU operation โ set by (current phase, current instruction).
The RTL steps
| Phase | Step | RTL | Meaning |
|---|---|---|---|
| Fetch | 1 | address of next instruction | |
| Fetch | 2 | read instruction word | |
| Fetch | 3 | latch it as current instruction | |
| Fetch | 4 | point at the next one | |
| Decode | 5 | operand address from IR | |
| Decode | 6 | read the operand | |
| Execute | 7+ | instruction-specific | e.g. |
- Decode variability โ
Add Xneeds 5 AND 6;Jump Xneeds only 5 (then ); some instructions need neither. - Signals per step โ e.g. : register file writes MBR + memory in read mode; : read AC, write AC, ALU in Add mode.
๐ Exam Execution Trace โ complete Add X (7 cycles)
| Cycle | RTL | Phase |
|---|---|---|
| 1 | fetch | |
| 2 | fetch | |
| 3 | fetch | |
| 4 | fetch | |
| 5 | decode | |
| 6 | decode | |
| 7 | execute |
โ๏ธ Practice
Write the full RTL sequence for
Jump X, and state how many cycles it takes under the unit's one-transfer-per-cycle convention.Answer
- Steps 1โ4 (fetch, identical always) โ 5: โ 6: โ 6 cycles, and memory is NOT read for an operand.
- Key move: Jump manipulates PC, so decode step 6 () is skipped โ no data needed.
โ ๏ธ Common Mistakes
- ๐ก PC increments during FETCH (step 4) โ before execute; a Jump then overwrites the incremented PC โ tracing PC wrongly is the classic error.
- ๐ก MBR is the only door to memory โ all reads/writes pass MAR (address) + MBR (data); RTL that moves memory straight into AC is invalid.
- ๐ก Clock speed โ instructions/second โ one instruction spans several cycles (Add = 7 here); GHz counts cycles.