Skip to main content
← CPUs Lesson 5 / 6

The CPU Datapath

A CPU is just a few registers (memory boxes), an ALU (the adder), and wires — driven by a clock. Each tick it fetches, decodes, and executes one instruction, then repeats.

Program

  1. 0 LOAD R0, 2 fetch
  2. 1 LOAD R1, 3
  3. 2 ADD R0, R1
  4. 3 HALT

One click = one stage. Each instruction takes three ticks: fetch → decode → execute.

Instruction set

LOAD Rn, v
put a number into a register
ADD Ra, Rb
Ra ← Ra + Rb (the ALU adds)
HALT
stop the clock
fetch decode execute
PC 0 MEMORY 0: LOAD R0, 2 1: LOAD R1, 3 2: ADD R0, R1 3: HALT IR (fetched) CONTROL R0 0 R1 0 ALU + ↩ reg
PC 0
Stage fetch
R0 / R1 0 / 0

Now: put 2 into R0.