The CPU is the part of the machine that turns your source file into something that happened. TechSpot’s Anatomy of a CPU walks through the pieces in the order an instruction touches them, which is a better teaching order than the usual labelled diagram. This is a summary of that tour, with the numbers that make it useful.
The blueprint comes first: the ISA
Before any transistor layout, a CPU has an Instruction Set Architecture. The ISA defines which instructions exist, how the CPU talks to memory and caches, and how work is split across the stages of execution. x86 covers desktops and laptops, ARM covers phones and embedded boards, and RISC-V, MIPS and PowerPC fill narrower roles. The ISA is why the same C file compiles into completely different machine code on a laptop and a phone.
Control unit and datapath
Every core splits into two halves. The datapath is the engine: data flows through it, gets transformed, and leaves in the right place. The control unit is the conductor, routing signals, switching parts of the datapath on and off, and tracking the state of the machine. One moves the train, the other pulls the levers.
Fetch, decode, execute
The program counter holds the address of the next instruction. Fetch copies that instruction from memory into the instruction register. Decode reads the opcode to work out what kind of instruction it is — the same idea as a file extension telling an operating system how to open a file. Then execution routes it to the right unit.
Three instruction types cover most of what a program does: memory instructions (read or write a value at an address), arithmetic instructions (combine two registers into a third), and branch instructions (continue somewhere else depending on a condition). Registers are the scratch space — a few dozen of them, 64 bits wide on a 64-bit core, fast enough to act as an L0 cache.
The ALU and the memory hierarchy
Arithmetic lands in the Arithmetic Logic Unit: two inputs, a control signal, one output, plus status flags for zero, negative and overflow. The same unit often computes addresses for memory instructions and offsets for branches.
Memory is where the performance story lives. The CPU checks L1 first (a few hundred KB), then L2 (a few MB), then L3 (tens of MB), then RAM, then storage. Each step down is roughly an order of magnitude larger and dramatically slower: a cycle or two for registers, a handful for L1, about ten for L2, a few dozen for L3, and tens of thousands or more for main memory. Most “slow code” is a memory problem wearing a CPU costume.
Branches and pipelining
A modern core has 20 or more pipeline stages, so it is working on 20 or more instructions at once. The classic analogy is laundry: washing and drying two loads sequentially takes four hours, but overlapping them takes three. Throughput improves even though each load still takes two hours.
Branches break that arrangement. If the core does not know an instruction is a branch until stage ten, it has already started nine instructions that may be invalid. Branch predictors learn from previous branches and guess, with accuracy around 95% or better. When the guess is wrong, everything after the branch is discarded and the core restarts from the correct address.
Out-of-order execution and prefetching
Almost no modern processor executes instructions strictly in program order. If an upcoming instruction needs data that is not ready, the core pulls an independent instruction forward and does useful work in the gap. Prefetchers go further, looking ahead at which data future instructions will need and pulling it into cache before it is requested.
Accelerators and multicore
Task-specific accelerators — encryption, media encoding, machine learning — now take up most of the die on modern chips. On Intel’s first-generation Nehalem, cores and cache dominated the floorplan; on a recent AMD SoC, cores are a minority of the area. The general-purpose core is becoming one tenant among several.
Multicore is not four copies of a single core. Four cores need four times the instruction issue and four paths to memory, and because caches hold overlapping data, the design needs coherence and consistency protocols to decide which copy is correct when two cores touch the same value. That coordination is most of the engineering.
What to take from it
- Reason about memory before arithmetic. A cache miss costs orders of magnitude more than any instruction choice you can make in source code.
- Branch-heavy code has a ceiling. Predictable branches are nearly free; unpredictable ones throw away work already done.
- The ISA explains portability pain. Same logic, different instruction set, different machine code.
- Accelerators are the trend. The generic core is no longer where the area budget goes.
Sources: TechSpot, Anatomy of a CPU by William Gayde (6 April 2020), and the accompanying TechSpot CPU design series.



0 Comments