CPU (PROCESSOR) SIMULATION

A simple CPU has no multiply instruction at all. To work out A times B it adds A into the result exactly B times and decrements a counter, a loop assembled from ADD, SUB and the conditional jump JZ. Every instruction runs through three phases: fetch the word at the address held in PC into the instruction register and bump PC by one, decode the opcode away from the operand, execute inside the ALU through the accumulator ACC. Instructions and data share one array of RAM cells in Von Neumann fashion, so a bare cell betrays nothing about whether it holds a number or an instruction.

▸ Supplying the clock pulses…
▸ Building the PC · IR · ACC registers & the ALU
▸ Addressing the RAM cells (von Neumann)
▸ Wiring the address / data / control BUS
▸ Loading the sample program into memory…
▸ Ready — Online. ✅
0%
⌂ Mind & Machine

Simulation room CPU — How a computer runs

CPU · Fetch–Decode–Execute
Online
fetch · decode · execute
Instruction cycle
⚙️ Fetch–Decode–Execute
PC (next instr)—
IR (instruction)—
ACC (accumulator)—
Phase—
Clock ticks—
Viewing—
Notes
A CPU just repeats one loop forever: FETCH the instruction at the PC address → DECODE → EXECUTE (ALU/ACC/RAM) → repeat. Billions of loops per second (GHz) weave together all software.
—
Pick a ‘Scenario’ to load a different program (add / loop / multiply / Fibonacci…) · ⏭ step one clock tick at a time · click a concept (PC/IR/ACC/ALU/RAM/BUS…) for details
Your browser has canvas disabled.
Accumulator ACC value over clock ticks ACC
About How a CPU Works

A simple CPU has no multiply instruction at all. To work out A times B it adds A into the result exactly B times and decrements a counter, a loop assembled from ADD, SUB and the conditional jump JZ. Every instruction runs through three phases: fetch the word at the address held in PC into the instruction register and bump PC by one, decode the opcode away from the operand, execute inside the ALU through the accumulator ACC. Instructions and data share one array of RAM cells in Von Neumann fashion, so a bare cell betrays nothing about whether it holds a number or an instruction.

Related topics in Mind & Machine