Introduction to Control Unit and its Design
The control unit is the part of the computer's central processing unit (CPU) which directs the operation of the processor. It fetches instructions from memory, decodes them, and generates control signals to manage the ALU, memory, and I/O devices.
- Its role is to coordinate instruction execution, and its functions vary depending on CPU architecture.
- Devices that need a Control Unit (CU) include CPUs and GPUs.
Functions of the Control Unit
- It coordinates the sequence of data movements into, out of, and between a processor's many sub-units.
- It interprets instructions.
- It controls data flow inside the processor.
- It receives external instructions or commands, which it converts to a sequence of control signals.
- It controls many execution units (i.e., ALU, data buffers and registers) contained within a CPU.
- It also handles multiple tasks, such as fetching, decoding, execution handling and storing results.
The control unit of a CPU fetches and executes instructions, playing a critical role in system performance. Its Design ensures smooth operation of various components.
Types of Control Unit
There are two types of control units:
- Hardwired
- Micro programmable control unit.
Hardwired Control Unit
In a Hardwired Control Unit, control signals for instruction execution are generated by fixed hardware logic circuits and cannot be modified without physically changing the circuit design. The operation code of an instruction provides the basic data for control signal generation, which is decoded in the instruction decoder. The decoder outputs activate specific lines connected to a control signal generator matrix that produces signals for execution units. These matrices function like programmable logic arrays, combining decoded opcode signals, control states, and external inputs (e.g., interrupts).
- Control signals must be generated throughout the instruction execution cycle, not at a single point. Accordingly, the control unit organizes a sequence of states, with some control signals fed back to the next state generator matrix.
- The timing unit (driven by a quartz generator) provides timing signals. When a new instruction arrives, the control unit begins fetching, moves through execution states, and responds to changes in timing, flags, or interrupts by shifting states.
- External signals such as interrupts trigger dedicated states for handling them. Flags and state variables guide the choice of states during execution.
- The final states of the cycle begin fetching the next instruction, and if a stop instruction is encountered, the control unit enters an OS state, waiting for the next command.
Micro Programmable control unit
In microprogrammed control units, subsequent instruction words are fetched into the instruction register in a normal way. However, the operation code of each instruction is not directly decoded to enable immediate control signal generation but it comprises the initial address of a microprogram contained in the control store.
Single-Level Control Store
The opcode from the instruction register points to the address in the control store where the microprogram starts. The first microinstruction is loaded, containing encoded control signals and the address for the next microinstruction. Microinstruction fields are decoded, and the control field determines which addressing mode or operation is used.
Conditional addressing applies processor flags to select the next microinstruction. The final microinstruction fetches the next instruction from memory.
Two-Level Control Store
In a control unit with a two-level control store, besides the control memory for microinstructions, a nano-instruction memory is included. In such a control unit, microinstructions do not contain encoded control signals. The operation part of microinstructions contains the address of the word in the nano-instruction memory, which contains encoded control signals. The nano-instruction memory contains all combinations of control signals that appear in microprograms that interpret the complete instruction set of a given computer, written once in the form of nano-instructions. In this structure, microinstructions are shorter, reducing the total control memory size. Control sequencing is handled by microinstructions, while control signals are generated from nano-instructions, often in simple 1-bit/1-signal encoding without further decoding.