Microcode

Microcode is a layer of interpretation hidden inside a processor. The machine instructions that a programmer or compiler emits, the instruction set the chip publicly implements, are not always executed directly by the raw hardware. Instead, a complex instruction is broken down into a sequence of much simpler internal steps called micro-instructions or micro-operations, each of which drives the actual datapath: gating a register onto a bus, triggering the arithmetic unit, latching a result. The store of these sequences is the control store, and the program that runs there, the microprogram, defines what each machine instruction means in terms of the underlying hardware.

The idea comes from Maurice Wilkes, who set it out in his 1951 paper “The Best Way to Design an Automatic Calculating Machine,” delivered at the Manchester University Computer Inaugural Conference. Wilkes proposed that the control logic of a computer, normally a tangle of ad hoc circuitry, could instead be organized as a small stored program of micro-operations held in a matrix. This made the design of the control unit systematic and, crucially, alterable: the instruction repertoire of the machine could be changed by changing the microprogram rather than rewiring the hardware. His EDSAC 2, operational in 1958, was an early microprogrammed machine.

Microcode became central with the IBM System/360 in the 1960s, where it let a single architecture be implemented across a range of machines at different price and performance points; each model could realize the same instruction set with a different amount of hardware, filling the gap with microcode. This separation of architecture from implementation is one of microcode’s lasting contributions. It is also strongly associated with CISC designs, where rich, complex instructions are most economically built as microcoded sequences rather than as dedicated logic.

The RISC movement of the 1980s was in part a reaction against heavy microcoding. RISC designers argued that simple, fixed-length instructions could be executed directly by hardwired control, faster than interpreting them through a control store, and that compilers could synthesize the complex operations from simple ones. Modern x86 processors blend both philosophies: common simple instructions are decoded directly into micro-operations by hardwired logic, while rare or complex instructions are handled by a microcode ROM.

A practical consequence is the updatable microcode patch. Because a modern processor’s behavior partly depends on a microprogram, manufacturers can ship microcode updates that the firmware or operating system loads at boot, fixing errata, disabling buggy features, or installing mitigations. Several of the responses to the Spectre and Meltdown vulnerabilities were delivered exactly this way, as microcode updates that changed how the affected processors handled speculation.