1. Datapath and Control Unit: Who Does What
A processor can be roughly divided into two parts: the datapath and the control unit. The datapath consists of exactly the building blocks covered in previous chapters – an ALU (adders, multipliers), a set of registers (flip-flops, usually grouped into what is called a register file with 16 to 32 entries), and buses that move data between them, with multiplexers at every point where a choice must be made about which data source is currently being passed through. The datapath itself makes no decisions; every clock cycle, it does exactly what the signals present at its control inputs force it to do.
Concretely, these are typically: the address lines of the register file, which determine which two registers are placed on the ALU inputs and which register the result is written back to; a write-enable signal that actually authorizes this write-back; an ALU opcode that determines whether the ALU adds, subtracts, forms a logical combination, or shifts; and various mux-select lines that determine, for example, whether the second ALU input comes from a register or directly from a constant value (immediate) contained in the instruction. All of these signals are generated by the control unit, purely from two inputs: the current clock cycle within instruction execution, and the so-called opcode, the first few bits of the instruction currently being executed. The control unit "understands" nothing in the human sense here – it is itself just a (potentially very complex) combinational and sequential circuit that outputs a fixed, predetermined pattern of control signals for every combination of opcode and cycle.