Sub topic 18
Choosing between hardwired and microprogrammed control
This chapter assumes you know the fetch-decode-execute cycle, the datapath and register transfer notation, and the basic idea of a control unit that issues control signals. It also assumes you have seen both control styles introduced separately. Here the goal is to compare them, connect the choice to RISC and CISC, and size a control store the way GATE does.
The two designs in one picture
A control unit turns the opcode in the instruction register, plus status flags and a timing step, into control signals. The two designs build that mapping differently.
- A hardwired control unit uses fixed logic: a decoder, a step counter, and gates (or a PLA). The opcode and time step go in, and the signals come out as Boolean functions.
- A microprogrammed control unit stores the signal patterns in a small memory called the control store. Each instruction runs a short microprogram, which is a sequence of microinstructions. Each microinstruction holds one set of control signals plus information about which microinstruction comes next.
Comparison on the dimensions that matter
| Dimension | Hardwired | Microprogrammed |
|---|---|---|
| Speed | Faster. Delay is only gate delay through the logic. | Slower. Each step needs a control store read. |
| Design effort | Hard. Logic must be derived and minimized by hand or by tools. | Easier. You write microcode like a program. |
| Changing or fixing the design | Costly. Requires redesigning logic. | Cheap. Edit the microprogram, or reload a writable control store. |
| Complex instructions | Logic grows quickly. | Natural. A long instruction is a longer microroutine. |
| Chip area | Irregular logic, which grows with instruction count. | Regular memory array plus sequencing logic. |
| Typical use | RISC processors. | CISC processors. |
The rows connect to each other. A CISC machine has many instructions, many addressing modes, and variable-length encodings. Hardwiring all of that produces a large, irregular, error-prone circuit. A microprogram handles it with a regular structure and lets designers patch mistakes late. A RISC machine has few, uniform instructions, so the hardwired logic stays small, and the speed gain justifies the design effort.
Failure modes and edge cases
- Microcode is not free speed. Each microinstruction needs a control store access, so a simple instruction can cost several extra cycles compared with a hardwired implementation.
- Writable control stores. If the control store is RAM or flash, the vendor can ship fixes after manufacture. This is the main flexibility argument. A ROM control store gives no such option.
- Hardwired is not always one level of logic. The step counter and decoder add depth, and signals that depend on many opcodes need wide OR gates. Hardwired is faster, but not instantaneous.
- Modern hybrids. Many CISC processors hardwire the common simple instructions and use microcode only for rare, complex ones. Questions that ask for the best choice for a given design usually want the pure trade-off, not the hybrid.
Sizing a control store
GATE asks for the control store size in bits. The method has three steps.
- Count the microinstructions: the number of words in the control store.
- Compute the width of one microinstruction: control signal field(s) plus the next-address field, plus any condition-select field.
- Multiply the count by the width.
The next-address field must be able to name every control store word, so it needs ceil(log2(number of words)) bits.
The width of the signal field depends on the format. A horizontal format uses one bit per control signal, so it is wide but fast and allows parallel signals. A vertical format encodes mutually exclusive signals into fields, so it is narrow but needs decoders and is slower.
Worked example
A processor has 40 control signals. Its control store holds 512 microinstructions. A condition-select field of 2 bits chooses among test conditions. Compare horizontal and vertical formats, where the vertical format groups the 40 signals into 5 groups with 8, 8, 8, 8 and 8 mutually exclusive signals each (every group can issue at most one signal at a time, with one code reserved for "none").
import math
words = 512
cond_bits = 2
next_addr_bits = math.ceil(math.log2(words)) # 9
# Horizontal: one bit per signal
horizontal_signals = 40
horizontal_width = horizontal_signals + cond_bits + next_addr_bits
horizontal_total = words * horizontal_width
# Vertical: each group of 8 signals plus "none" needs 9 codes -> 4 bits
groups = 5
bits_per_group = math.ceil(math.log2(8 + 1)) # 4
vertical_signals = groups * bits_per_group
vertical_width = vertical_signals + cond_bits + next_addr_bits
vertical_total = words * vertical_width
print("next-address bits:", next_addr_bits)
print("horizontal width:", horizontal_width, "total bits:", horizontal_total)
print("vertical width:", vertical_width, "total bits:", vertical_total)The output is:
next-address bits: 9
horizontal width: 51 total bits: 26112
vertical width: 31 total bits: 15872The vertical control store is about 39% smaller. The price is a decoder per group in front of the control signals, which adds delay.
Sizing from instruction counts
Sometimes the question gives the number of instructions and the microroutine length instead of the store size. For example, 64 instructions with an average microroutine of 8 microinstructions, plus a shared 4-microinstruction fetch routine, need 64 × 8 + 4 = 516 words. Round up to the next addressable size when the question asks for the next-address field: ceil(log2(516)) = 10 bits, because 2^9 = 512 is too small.
Decision criteria
Use these questions in order when a problem asks which design suits a scenario.
- Is raw speed the top priority, or is the instruction set small and regular? Choose hardwired.
- Is the instruction set large, complex, or likely to change after release? Choose microprogrammed.
- Is a post-release fix needed without new silicon? Microprogrammed with a writable store.
- Is the control store size or access time the bottleneck? Consider a vertical format or hardwiring the hot instructions.
Exercise
A microprogrammed control unit has 1024 microinstructions. The control word has 30 bits for control signals and 3 bits for condition select. Each microinstruction also holds a next-address field. What is the size of the control store in bits?
Show answer
The next-address field needs log2(1024) = 10 bits. Width = 30 + 3 + 10 = 43 bits. Total = 1024 × 43 = 44032 bits, which is 5504 bytes (5.375 KiB).
Exercise
A designer must choose a control unit for a new RISC processor with 40 uniform instructions and a strict clock-speed target. Which control unit type fits best, and what is the main cost of that choice?
Show answer
A hardwired control unit fits best, because its delay is only gate delay and the small uniform instruction set keeps the logic manageable. The main cost is design effort and inflexibility: fixing an error or adding an instruction means redesigning the logic rather than editing microcode.