← 🧠 ALU, Datapath & Control Unit
Subtopic 1 of 9

5.1Instruction cycle

The idea

Every instruction goes through the fetch → decode → execute cycle, using the same few registers again and again.

Think of it like this: Following a recipe: find the line (PC), read it (IR), do it (execute), move to the next.

Why it exists

It is the heartbeat of a computer: everything a program does is this loop.

How it works

  1. Fetch: MAR ← PC; MDR ← M[MAR]; PC ← PC + 1; IR ← MDR.
  2. Decode: control unit interprets the opcode.
  3. Execute: read operands, use the ALU, write the result.
  4. Check for interrupts and repeat.

Worked example: LOAD 200 at address 100

MAR = 100 → MDR = "LOAD 200" → IR = "LOAD 200", PC = 101. Then MAR = 200, MDR = M[200] = 5, ACC = 5.

Now play with it

  • →Press Auto play and watch the highlighted register on each step.
  • →Notice PC becomes 101 right after fetch, before execution.
PC100
MAR-
MDR-
IR-
ACC0
M[200]5
M[201]7
M[202]0
  • Start: PC = 100
  • Fetch: MAR ← PC (100)
  • Fetch: MDR ← M[MAR], PC ← PC + 1
  • Fetch: IR ← MDR
  • Decode: opcode LOAD, address 200
  • Execute: MAR ← 200
  • Execute: MDR ← M[200] = 5
  • Execute: ACC ← MDR
  • Fetch: MAR ← PC (101)
  • Fetch: MDR ← M[MAR], PC ← PC + 1
  • Fetch: IR ← MDR
  • Decode: opcode ADD, address 201
  • Execute: MAR ← 201
  • Execute: MDR ← M[201] = 7
  • Execute: ACC ← ACC + MDR
  • Fetch: MAR ← PC (102)
  • Fetch: MDR ← M[MAR], PC ← PC + 1
  • Fetch: IR ← MDR
  • Decode: opcode STORE, address 202
  • Execute: MAR ← 202
  • Execute: MDR ← ACC, M[MAR] ← MDR (writes 12)

Check yourself

An instruction is fetched from address 100 on a word-addressed machine. At the end of fetch, PC is:

Remember: Fetch, decode, execute; PC already points to the next instruction.
Exam notes (the dense version)

Fetch: MAR←PC; MDR←M[MAR], PC←PC+1; IR←MDR. Decode. Execute (operand fetch, ALU, write-back). Interrupt check at the end.

Previous year questions: ALU, Datapath & Control Unit (3)

PYQs are grouped by topic, so this is the full set for ALU, Datapath & Control Unit; try the ones that match this subtopic. Open all 3 on the topic page.