Processor Architecture

How a CPU works inside: the fetch–decode–execute cycle, ALU, registers, program counter, control unit and buses; von Neumann vs Harvard architectures; CISC vs RISC; clock rate, CPI and MIPS; pipelining and hazards; and the memory hierarchy with caches.

Every processor — from an 8-bit 8085 to a smartphone's ARM cores — repeats the same loop: fetch an instruction from memory, decode it, execute it, and store the result. Architecture is how that loop is organised to run fast and efficiently.

An analogy

A CPU is like a chef following a recipe: fetch the next line (instruction), understand it (decode), do it (execute), and keep ingredients close at hand in small bowls (registers) and the fridge (cache) instead of the supermarket (main memory).

Building blocks

ALU (arithmetic and logic), register file (fast storage), control unit (decodes instructions and generates control signals), PC (address of next instruction), and buses: address bus (where), data bus (what), control bus (read/write/interrupt).

Architectures

Von Neumann: shared memory for code and data (simple, bottleneck). Harvard: separate instruction and data memories (MCUs, DSPs). CISC (x86): complex, variable-length instructions. RISC (ARM, RISC-V): simple, fixed-length load/store instructions, easy to pipeline.

Pipelining

Classic 5-stage pipeline: fetch, decode, execute, memory, write-back. Hazards — structural, data (use forwarding/stalls) and control (branch prediction) — reduce ideal speed-up.

Memory hierarchy

Registers → L1 → L2 → L3 caches → DRAM → storage; each level larger and slower. Caches exploit temporal and spatial locality. Superscalar, out-of-order, multicore and SIMD extend performance further.

Formulas

Worked example: Execution time

Given: 10⁶ instructions, CPI 1.5, 100 MHz

Find: Time and MIPS.

Answer: 15 ms, 66.7 MIPS

Worked example: Cache effect

Given: Hit 1 cycle, miss rate 5 %, penalty 50 cycles

Find: AMAT.

Answer: 3.5 cycles (3.5× slower than always hitting)

Common mistakes

Applications

Key takeaways

Going further