Introduction
The control unit (CU) coordinates the operation of the processor by generating timed control signals that cause the data path and other parts of the computer to perform required micro-operations in a proper sequence. In a micro-programmed control unit the control signals for each machine instruction are produced by a stored sequence of micro-instructions residing in a special memory called the control memory. Each micro-instruction contains one or more fields that specify control signals, sequencing information and, optionally, condition tests.
Micro-programmed control units are commonly classified by the format of their micro-instructions (control words) into two main types:
- Horizontal micro-programming: Each control signal is represented explicitly by one bit (decoded format). If there are n control signals then the control field needs n bits.
- Vertical micro-programming: Control signals are encoded. Several control functions are represented by encoded fields (opcodes) that require fewer bits. If there are n control signals then an encoded field needs approximately log₂ n bits per encoded group.
Microinstruction structure and control memory
A typical microinstruction may contain the following fields (depending on implementation):
- Control field - specifies micro-operations (one bit per control signal in horizontal style; encoded fields in vertical style).
- Sequencing / next-address field - gives the address of the next microinstruction (can be unconditional, conditional, or relative/implicit).
- Test / condition field - selects flags or condition codes used for conditional branching.
- Microstore opcode field - in vertical microprogramming, an encoded opcode that selects one or more hardware control actions via a micro-decoder.
Comparison: Horizontal vs Vertical microprogramming
The following points summarise the principal differences and design trade-offs between the two approaches.
- Encoding: Horizontal uses decoded one-bit-per-signal representation; vertical uses encoded (compact) fields.
- Microinstruction width: Horizontal control words are wide (many bits), providing direct and parallel control of signals. Vertical control words are narrower, saving control memory width at the cost of a micro-decoder.
- Microinstruction density: Vertical microprogramming yields higher code density (fewer bits per microinstruction) and so lower control memory capacity for a given number of microinstructions.
- Speed: Horizontal microinstructions often allow faster execution because control bits directly drive hardware; vertical requires an extra decoding step, possibly adding delay.
- Flexibility and ease of design: Horizontal is simple to map from control signals to bits; vertical eases storage requirements and is convenient for complex ISAs where control signals can be grouped and encoded.
- Hardware complexity: Horizontal requires wider control memory and more wiring. Vertical requires a microinstruction decoder and more logic to expand encoded fields into control signals.


Microsequencing and conditional control
Microinstruction sequencing methods include:
- Sequential sequencing - next microinstruction address is implicit (PC + 1 in control memory).
- Jump/branch sequencing - next address is provided in the microinstruction (direct jump).
- Conditional sequencing - a condition field selects next address depending on tests of flags or status bits.
- Indexed or computed sequencing - microaddress is computed from register contents or instruction fields.
Advantages and disadvantages
- Horizontal microprogramming - Advantages: very fine control, parallel activation of many micro-operations, simple decoding of control bits, often faster per microinstruction.
- Horizontal microprogramming - Disadvantages: wide control words, large control memory bandwidth and storage, complex wiring.
- Vertical microprogramming - Advantages: compact control store, smaller memory width, easier to fit control store into limited memory, easier to maintain and update control code.
- Vertical microprogramming - Disadvantages: requires micro-decode logic, microinstructions perform fewer direct actions per instruction (may need multiple microinstructions), potential extra delay on decode.
Example
Consider a hypothetical control unit that supports 4 k words. The hardware contains 64 control signals and 16 flags. What is the size of the control word in bits and the size of control memory in bytes using:
(a) Horizontal programming
Solution - (a) Horizontal
Each control signal is represented by one bit and each flag is stored explicitly in the microinstruction.
\\[ \text{Control word size} = 64\ \text{(control signal bits)} + 16\ \text{(flag bits)} = 80\ \text{bits} \\]
Number of control memory words:
\\[ 4\ \text{kwords} = 4 \times 1024 = 4096\ \text{words} \\]
Control memory size in bytes:
\\[ \text{Control memory (bytes)} = \frac{4096 \times 80}{8} = 4096 \times 10 = 40960\ \text{bytes} = 40\ \text{kB} \\]
(b) Vertical programming
Solution - (b) Vertical
Compute encoded field widths required to represent:
\\[ \log_2 64 = 6\ \text{bits} \\] \\[ \log_2 16 = 4\ \text{bits} \\] \\[ \log_2(4\ \text{kwords}) = \log_2 4096 = 12\ \text{bits} \\]
Microinstruction fields typically include an encoded control/opcode field (for the 64 signals), a flags/test field, and a next-address field (address bits for control memory). Thus:
\\[ \text{Control word size} = 6\ \text{(signals)} + 4\ \text{(flags)} + 12\ \text{(address)} = 22\ \text{bits} \\]
Control memory size in bytes:
\\[ \text{Control memory (bytes)} = \frac{4096 \times 22}{8} = 4096 \times 2.75 = 11264\ \text{bytes} \approx 11\ \text{kB} \\]
Design notes and practical considerations
- Control store capacity vs. width: Designers trade off between the number of microinstructions (control store depth) and the width of each microinstruction. Horizontal increases width; vertical increases depth for the same total bits of storage.
- Decoder latency: Vertical microprogramming requires a micro-decode step; ensure timing meets processor cycle requirements.
- Microinstruction granularity: Horizontal microinstructions can issue many control signals in a single microinstruction (coarser granularity). Vertical microinstructions are typically finer-grained because encoded opcodes expand to multiple control signals via decoding.
- Maintainability: Vertical microprogramming often leads to more compact and maintainable microcode; horizontal microcode may be easier to understand when inspecting bits directly but is bulkier.
- Conditional control: Include conditional fields that test status bits or flags. These fields are often small encoded selectors in both horizontal and vertical formats.
Conclusion
Both horizontal and vertical microprogramming strategies are useful. Horizontal control words give direct and parallel control over many signals and can yield faster micro-operations, at the expense of wide control words and larger control memory. Vertical microprogramming reduces control word width and control memory size, improving storage efficiency and maintainability, but adds decode complexity and may require more microinstructions to perform the same function. The choice depends on design goals: speed, memory cost, hardware complexity, and ease of microcode development.