Advanced CPU Simulator

OCR A Level H446 · processor structure & function
FETCH
DECODE
EXECUTE
HALTED

Processor components & Fetch–Decode–Execute

Follow register transfers, buses, control signals, opcode/operand decoding and instruction execution.

OCR H446 · 1.1.1(a–b)
Central Processing Unit (CPU)CU · ALU · dedicated registers
Processing & control coordinates, decodes, calculates
Control Unit (CU)
coordinates components · decodes CIR · issues control signals
Current CU activity
Waiting for the first micro-step.
Opcode—
Operand—
Arithmetic Logic Unit (ALU)
arithmetic · logic · shift operations
ALU activity
Idle — no ALU operation
Dedicated registers very fast storage inside the processor
PC
Program Counter
address of next instruction
1
MAR
Memory Address Register
address currently being accessed
—
MDR
Memory Data Register
value moving to / from memory
—
CIR
Current Instruction Register
current instruction: opcode + operand
—
ACC
Accumulator
working value / intermediate result
0
Address bus
Data bus
Control bus
Main Memory (RAM)instructions + data
AddressContents
Von Neumann model: instructions and data share main memory. Address bus selects a location; data moves on the data bus; READ/WRITE travels on the control bus.
Address bus: CPU → memory/I/OData bus: bidirectionalControl bus: control/timing signalsCurrent instruction: not yet fetched

Binary instruction words & Decode Unit

Fetch an 8-bit word from RAM, split it into opcode and operand, then watch the Decode Unit determine the instruction.

OCR-style binary teaching model
Central Processing Unit (CPU)binary datapath · decode unit · registers
Program CounterPC
4-bit address of next instruction
0000
Memory Address RegisterMAR
address currently being accessed
—
AccumulatorACC
8-bit working/result word
0000 0000
Memory Data RegisterMDR
8-bit word moving to/from RAM
—
Current Instruction RegisterCIR
current 8-bit instruction word
—
Opcode—
Operand—
Control UnitCU
coordinates transfers and control signals
READY
Arithmetic Logic UnitALU
operates on binary values
ALU activity
Idle — no ALU operation
CacheC
Included to mirror the OCR processor diagram. This mode focuses on instruction encoding and decoding rather than cache behaviour.
Decode Unit — instruction lookup
OpcodeOperandInstruction
4-bit Address bus
8-bit Data bus
Control bus
Main Memory (RAM)16 locations · one 8-bit word each
Address8-bit word
4-bit address bus → 2⁴ = 16 locations8-bit data bus → one 8-bit word per transferCurrent binary instruction: not yet fetched

Instruction pipelining

Observe Fetch, Decode and Execute overlapping across different instructions.

OCR H446 · 1.1.1(d)
Clock cycle
0
current pipeline cycle
Completed
0
instructions completed
Pipeline state
Empty
fill → steady state → drain
Ideal throughput
1 / cycle
after a 3-stage pipeline fills
Start: click Next clock. Without pipelining, one instruction would complete all three stages before the next starts. In this idealised pipeline, different instructions can occupy different stages simultaneously.
Pipeline model: 3 stages · one cycle per stageThroughput improves; individual instruction latency is not necessarily reduced.

Von Neumann, Harvard & contemporary architectures

Compare where instructions/data are stored and how their pathways are organised.

OCR H446 · 1.1.1(e)

Von Neumann

Instructions and data share the same main memory and shared pathways.

CPUCU · ALU · registersShared main memoryinstructions + datashared memory/bus bandwidth can be a bottleneck
Key feature: one memory space for instructions and data. The same system-bus resources are shared by both kinds of transfer.

Harvard

Instructions and data use separate memories and separate buses.

CPUprocessor coreInstructionmemoryDatamemoryinstruction and data access can occur independently
Key feature: separate instruction/data storage and pathways can permit simultaneous access. Memory sizes/word widths can differ between the two sides.

Contemporary / modified Harvard

A common modern arrangement mixes both ideas.

CPU coreInstruction cacheData cacheUnified main memoryinstructions + datacommon example — implementations vary
Common contemporary pattern: unified main memory but separate instruction/data caches close to the CPU. This is often described as modified Harvard.
These are architectural models; real processors may combine features.Selected: Von Neumann

Factors affecting CPU performance

Explore clock speed, number of cores and cache without pretending they combine into one universal benchmark.

OCR H446 · 1.1.1(c)

Clock speed

How many clock cycles occur each second. A higher clock can allow more processor operations per second, all else equal.

Clock cycles per second
3.0 billion
1 GHz = 1 billion cycles/s
Limitation: higher clock speed can increase heat/power use, and different CPU designs may do different amounts of useful work per cycle.

Number of cores

Multiple cores can execute instructions independently, but software must contain work that can run in parallel.

Parallel workload: several cores can be useful at the same time, increasing potential throughput.

Cache

Small, fast memory close to the CPU stores recently/frequently used instructions or data to reduce slower main-memory accesses.

Working set
12
Cache fits
8/12
Illustrative hit opportunity
67%
teaching model for repeated working-set access
Important: cache performance depends on access patterns, cache hierarchy, replacement policy and latency. Capacity alone does not determine speed.
OCR factors: clock speed · number of cores · cacheEffects depend on workload and processor design.