+2jumpimmZ0 LDI r2, 32 LDI r3, 14 SUB r2, r36 ST r2, [32]8 JNZ 410 HALTprogram in memoryopcode0001d11s00imm1MICROCODE ROM010101-010101PCSrcRegWriteALUSrcALUOpMemReadMemWriteMemToReg0110MUXr00r10r23r30PC210MUXALUAB-[32]010MUX000
Control wire with moving dashes: it carries a 1Lamps on the control unit: one per signal, glowing = 1White pucks: the opcode and data values on the moveMux paths: the thick line is the input the select signal picksThe control unit reads each instruction's opcode and drives one wire per job into the datapath. A lit wire with moving dashes carries a 1; the lamps on the control unit show the whole row of the control table. For a single-cycle processor the control signals depend only on the opcode, plus a flag for conditional jumps, so the control unit is a truth table with one row per instruction (Harris and Harris, Digital Design and Computer Architecture, section 7.3.2). Maurice Wilkes proposed microprogramming in 1951 (Wilkes and Stringer, 1953). IBM brought it to the mainstream with the System/360 family in 1964. Hard-wired control was faster; a ROM of microcode was easier to get right and to change (Patterson and Hennessy, Computer Organization and Design, 3rd ed., section 5.12).

Decoding

  1. The datapath has registers, an ALU, memory and multiplexers (muxes), but on its own it does nothing. Every clock cycle something must tell each part what to do. That is the control unit's job: it reads each instruction and sets the parts up.

Four instructions

Building it

Opcode in, signals out

;; step 1/10 · the-boss
datapath = the parts that hold and change data
  registers r0-r3 · ALU · memory · muxes

control unit = tells those parts what to do
  input:  the opcode (+ the Z flag)
  output: control signals, one wire per job

TINY-8: 8-bit data, 4 registers,
16 instructions, each 2 bytes.

A dash in the table means don't care: the signal has no effect for that instruction, so the designer may let the circuit output either value. The figure shows those as 0. Every encoding, register value and PC in the figure comes from TINY-8, the course's teaching CPU, and its reference simulator. The figure draws seven of the control signals; the full table also has FlagWrite, OutWrite (for OUT), Halt and the input port as a third write-back choice (for IN).