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

PhaseStepRTLMeaning
Fetch1address of next instruction
Fetch2read instruction word
Fetch3latch it as current instruction
Fetch4point at the next one
Decode5operand address from IR
Decode6read the operand
Execute7+instruction-specifice.g.
  • Decode variability โž” Add X needs 5 AND 6; Jump X needs 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)

CycleRTLPhase
1fetch
2fetch
3fetch
4fetch
5decode
6decode
7execute

โœ๏ธ Practice

โš ๏ธ 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.