Micro-operations Control Word Design for a 16-Register Bus CPU
This section designs a micro-operation control word for a simple bus-based datapath containing:
- 16 registers connected to a common bus
- an ALU that supports 32 operations
- a shifter that supports 8 operations
Key idea: in a single micro-cycle, the bus typically carries one source register value into the ALU/shifter, and the ALU/shifter result is written into one destination register. The control word therefore must include bit-fields to:
- select the source register placed on the bus,
- select the destination register to be written,
- select which ALU or shifter operation to perform.
We denote a micro-operation as something like: but in a bus design, is selected to drive the bus, while is commonly taken from a second internal path/register or from another selected bus time. Since the question asks for the bit fields to specify the micro-operation , we will allocate sufficient bits for register selection and ALU operation, plus a one-bit “functional unit select” (ALU vs shifter) to be explicit.
Required selector bit-widths
For a selector with choices, the number of bits is:
So:
- Register selectors for 16 registers: bits
- ALU operation selectors for 32 ops: bits
- Shifter operation selectors for 8 ops: bits
We also include:
- A 1-bit field to choose ALU vs shifter (otherwise the shifter/ALU fields would overlap ambiguously)
Mermaid sketch of the datapath intent:
Keywords: micro-operation control word bus ALU shifter.
Control Word / Register Transfer Microoperations (Bus & Datapath) — Intro
(i) Formulate a control word for micro-operation
We define a control word structured as fields:
- Source register select (bus input)
- bits: selects which of appears on the bus
- Destination register select (write register)
- bits: selects to receive the result
- Functional unit select
- bit: 0 = ALU, 1 = Shifter
- ALU operation select
- bits: chooses one of 32 ALU operations (e.g., ADD, SUB, AND, OR, …)
- Shifter operation select
- bits: chooses one of 8 shifter operations (e.g., logical shift left/right, arithmetic shift, rotate, …)
Total control word length
We now present the control word format.
Control Word Bit Layout (example convention)
Let the control word be:
| Field | Bits | Meaning |
|---|---|---|
| 4 | Source register: | |
| 4 | Destination register: | |
| 1 | Unit select: ALU, Shifter | |
| 5 | ALU op code (valid when ) | |
| 3 | Shifter op code (valid when ) |
So the control word is:
Micro-operation meaning
- The selected source register is placed onto the bus.
- The functional unit selected by performs the selected operation.
- The output is written into destination register .
[Pro tip]{type="tip"}: When designing control words, it’s common to include unused fields for the inactive unit (ALU vs shifter). They may be don’t-cares in optimization, but it’s clean to allocate fixed bit-fields as done above.
[/Pro tip]
How to compute the fields for (i)
- 1Step 1
For 16 registers, choose bits for each of source and destination selectors.
- 2Step 2
For 32 ALU operations, choose bits for the ALU op field.
- 3Step 3
For 8 shifter operations, choose bits for the shifter op field.
- 4Step 4
Include 1 bit to indicate whether the active datapath operation comes from the ALU or from the shifter.
- 5Step 5
Total control word length is bits.
(ii) Show the bits of the control word for
We must map to control fields.
- Destination register:
- Source register (bus input):
Now: the operation is addition, so we choose:
- Functional unit: ALU, therefore
- ALU operation code: choose the binary code for ADD among 32 ALU ops.
However, the question does not provide the numeric mapping of “ADD” to a specific 5-bit code. In such problems, either:
- the ADD opcode is assumed to be (often “first” operation), or
- the answer expresses the field as “ALUop = (ADD’s 5-bit code)”.
To produce a fully explicit bit pattern, we adopt the standard teaching convention:
- ALU ADD corresponds to ALUop = 00000 (i.e., ADD is opcode 0)
If your course uses a different opcode mapping, only the ALUop[4:0] bits change; the register select bits remain the same.
Convert register indices to 4-bit binary
Assemble the control word
Using the layout :
- (ALU active)
- (ADD assumed)
- (unused when ); for a concrete value we set
So:
Written as a 17-bit string:
Or concatenated:
[Warning]{type="warning"}: If your curriculum assigns a different 5-bit opcode to the ALU’s ADD operation, replace only the field. The and fields ( and ) do not change.
[/Warning]
Mermaid: field decoding view
Keywords: ALU operation code opcode binary encoding don’t-care.
Microinstruction assembly workflow
Choose control word fields
1Allocate bit-widths for Rs, Rd, unit select, ALUop, Shop."
Encode register indices
2Convert R5 and R4 into 4-bit binary selectors."
Select the active unit
3Set U=0 for ALU because the operation is addition."
Encode operation
4Fill ALUop with ADD’s 5-bit opcode (assume 00000 if not specified)."
Fill remaining bits
5Set Shop to any value (e.g., 000) since it is inactive."
Common exam assumptions and edge cases
Knowledge Check
For 16 registers, how many bits are needed to select a register in the control word?