COA Notes
Microprogrammed control unit design, control memory, microinstructions, and microprogram sequencing.
Introduction
What if instead of hardwiring control signals into fixed logic circuits, we stored them in a memory? That's exactly what a microprogrammed control unit does. Each machine instruction is executed by a sequence of microinstructions stored in a special control memory. Each microinstruction is essentially a binary word where individual bits (or fields) specify which control signals to assert in that cycle. This approach trades a small amount of speed for enormous flexibility — you can change processor behavior by reprogramming the control memory.
Core Concept
Think of it as a "program within a program":
- Machine program: ADD, LOAD, BRANCH (what the user writes)
- Microprogram: The internal sequence of micro-operations that IMPLEMENTS each machine instruction
Architecture
| │ │ (CAR) │ │ Addr 0 | [microinstruction] │ │ |
| │ └────┬────┘ │ Addr 1 | [microinstruction] │ │ |
| │ │ │ Addr 2 | [microinstruction] │ │ |
| │ ┌────▼────┐ │ Addr n | [microinstruction] │ │ |
Components
Control Memory (CM)
- Stores all microinstructions (the microprograms)
- Typically ROM (Read-Only Memory) or writable control store
- Each address holds one microinstruction (one cycle's worth of control signals)
- Size: hundreds to thousands of words
Control Address Register (CAR)
- Holds the address of the CURRENT microinstruction being executed
- Equivalent to the PC but for microprograms
- Updated each cycle by the sequencing logic
Control Data Register (CDR)
- Holds the current microinstruction read from control memory
- Its bits directly drive the control signals
- Also called the Micro-Instruction Register (MIR)
Sequencing Logic
Determines the NEXT microinstruction address:
- Sequential: CAR ← CAR + 1 (next address)
- Branch: CAR ← address from microinstruction field
- Conditional branch: Based on flags, choose next address
- Return to fetch: Go back to the fetch microprogram
Microinstruction Format
Horizontal Microinstruction (Wide)
Every control signal has its own bit:
| MAR | MBR | PC | ALU | R1 | R2 | MEM | Next Address |
|---|---|---|---|---|---|---|---|
| _in | _in | out | ADD | out | out | _rd |
- Wide (many bits, 50-100+)
- Maximum parallelism (any combination of signals possible)
- Directly drives control lines
- Expensive (wide control memory)
Vertical Microinstruction (Narrow)
Operations encoded into fields that must be decoded:
| ALU Op | Source | Dest | Next Address |
|---|---|---|---|
| (3 bits) | (3 bits) | (3 bits) |
- Narrow (fewer bits, 16-32)
- Requires decoding before driving control lines
- Less parallelism (fields may conflict)
- Cheaper (narrow control memory)
- More microinstructions needed per machine instruction
Comparison
| Feature | Horizontal | Vertical |
|---|---|---|
| Width | 50-100+ bits | 16-32 bits |
| Parallelism | High | Limited |
| Decoding | None (direct) | Required |
| CM size (bits) | Larger | Smaller |
| Speed | Faster per micro-op | Slower |
| Microprogram length | Shorter | Longer |
Microprogram Example
Machine instruction: ADD R3, R1, R2
Microprogram (horizontal format):
| Address 0 (Fetch) | PC_out=1, MAR_in=1, READ=0, ... Next: 1 |
| Address 1 (Fetch) | MEM_read=1, PC_inc=1, ... Next: 2 |
| Address 2 (Fetch) | MBR_out=1, IR_in=1, ... Next: (decode) |
| Address 50 (ADD Execute) | R1_out_A=1, R2_out_B=1, ALU=ADD, R3_in=1 Next: 0 (back to fetch) |
The sequencer uses the opcode from IR to jump to the correct execute microprogram (address 50 for ADD).
Mapping Machine Instructions to Microprograms
How does the control unit find the right microprogram for each instruction?
Direct Mapping
Opcode directly determines the starting address:
Simple but wastes space (all microprograms must be same length).
Mapping ROM
A small lookup table converts opcodes to starting addresses:
Flexible (microprograms can be any length at any address).
Advantages of Microprogramming
- Flexibility: Change processor behavior by updating control memory
- Simplicity of design: Complex instructions are just longer microprograms
- Easy to add instructions: Write new microcode, no hardware changes
- Bug fixes: Microcode updates fix bugs without new silicon
- Emulation: Can emulate different ISAs by loading different microprograms
Disadvantages
- Slower: Extra memory read (control memory) per micro-step
- Control memory cost: Needs dedicated fast ROM/RAM
- Power: Additional memory access power consumption
Real-World Applications
- Intel x86 (pre-Pentium): Heavily microprogrammed for complex CISC instructions
- IBM System/360: Pioneer of microprogramming — same ISA on different hardware via microcode
- Modern x86: Complex instructions still use microcode; simple instructions use hardwired fast path
- Firmware updates: Intel and AMD ship microcode updates that patch CPU behavior
Key Takeaways
- Microprogrammed control stores control signals in a control memory as microinstructions
- Each machine instruction maps to a microprogram — a sequence of microinstructions
- The Control Address Register acts as the PC for the micro-level
- Horizontal format: wide, parallel, fast. Vertical format: narrow, encoded, compact
- Main advantages: flexibility and ease of modification
- Main disadvantage: slightly slower than hardwired (extra memory access)
- Modern processors often use a hybrid: hardwired for simple frequent instructions, microcode for complex rare ones
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Microprogrammed Control Unit.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Computer Organization & Architecture topic.
Search Terms
computer-organization, computer organization & architecture, computer, organization, cpu, microprogrammed, control, unit
Related Computer Organization & Architecture Topics