Chapter 2 The blocks that make up a CPU — the kitchen lineup
2.1 The kitchen lineup
What a CPU wants to do, in the end, is “execute a row of instructions in order, from the top.” For just that, a few parts with different roles are needed. Likened to a kitchen, the lineup is this. The stove that computes, the workbench that holds values, the distant warehouse, the bookmark pointing to which order number we’re on, the reader of the order slips, the head cook who directs the whole, and the metronome that keeps everyone’s beat. Let’s look at them in order.
2.2 The stove = the ALU (the device that computes)
What actually computes is the ALU (arithmetic logic unit). Like a stove, it takes materials (usually two values), does the cooking — addition and subtraction, logic like AND/OR, and comparisons like “is A less than B?” — and puts out one result. The work where a CPU “moves its hands” happens almost entirely here. It’s the lead of this kitchen.
2.3 The workbench = the register file (Chapter 1’s 32 cells)
The workbench we looked at closely in Chapter 1. 32 cells, one cell 32 squares (32-bit width). The stove (ALU) reads materials (values) from here, and writes computed results back here. The nearness of taking things out at hand, without going to the warehouse (memory), was the key to speed. What the designer decides here is, as in Chapter 1, the cell width (32/64).
2.4 The bookmark = the program counter (PC)
A program is a row of instructions lined up with addresses in the warehouse (memory). Unless the machine remembers “which address’s order slip it’s on now / which is next,” it gets lost. The small dedicated bookmark that points to it is the program counter (PC). It holds the address of the next order slip to execute. Usually it advances the address one at a time, forward — hence “counter (counting up)” — and only when a “jump over there” instruction comes does it get rewritten to a new address. Both loops and conditional branches are, in truth, this bookmark being rewritten.
2.5 The reader = the decoder / the head cook = the control unit
The order slip fetched from the warehouse is just a row of 0/1. The one who looks at it and reads out “this is ‘add,’ the materials are cells x1 and x2, the serving destination is x3” is the instruction decoder. It translates a cipher-like string of numbers into what, for a human, is “meaning.” The one who, based on the read-out directions, directs each place — “it’s addition now, so connect the x1 and x2 cells to the stove and return the result to x3” — is the control unit = the kitchen’s head cook. It doesn’t cook itself; it only sets the whole arrangement.
2.6 The warehouse = memory
Outside the kitchen, there’s a huge shelf with astronomically many cells lined up — memory. Each with an address. It has two roles. One is the place for instructions (order slips are stored here, and what the bookmark = PC points to by address is here). The other is the place for data (the values read and written in computation, and large amounts of values that don’t fit on the workbench).
2.7 The metronome = the clock
Last, the plainest and most indispensable backstage hand — the clock. If parts move at their own timings, a neighbor reads a value before it settles, and the computation goes to pieces. So there’s a metronome that hands out a steady beat — tick, tick, tick… — to the whole kitchen. Each beat (each cycle), every part advances exactly one step. A value settles during that beat, and at the head of the next beat, all together, they’re sent on to the next.
2.8 The whole picture — the kitchen’s wiring
The lineup is complete. Finally, let’s connect it, roughly. The bookmark (PC) points to an address in the warehouse (memory), and an order slip is fetched. The reader (decoder) reads it out, the head cook (control unit) directs. Between the workbench (registers) and the stove (ALU), values and results are exchanged, and if needed, moved in and out of the warehouse. And everything advances on the beat of the metronome (clock) — with this, it’s certainly one CPU.