1. Registers
Definition – Register
A register is a collection of binary storage elements (flip-flops). In theory it is a sequential circuit with a state table; in practice we view it as storing a vector of bits used for data storage, movement and simple processing.
Example – 2-bit register (two D flip-flops)
Inputs , state , outputs .
| Next for | 01 | 10 | 11 | Output | |
|---|---|---|---|---|---|
| 00 | 00 | 01 | 10 | 11 | 00 |
| 01 | 00 | 01 | 10 | 11 | 01 |
| 10 | 00 | 01 | 10 | 11 | 10 |
| 11 | 00 | 01 | 10 | 11 | 11 |
- States: 4; input combinations: 4; output combinations: 4
- Output function: (the state itself) → Moore
- Next-state function:
- For an n-bit register: states, input combinations → a state table with entries.
⚠️ For n = 32 that is entries — the state-table method is useless for real registers.
2. Register Design Models
Because grows so fast, registers are designed by:
- Adding predefined combinational blocks to flip-flops (e.g., flip-flops + an incrementer = up-counter).
- Designing one 1-bit cell with a state table (only 2 states) and replicating it n times.
Output is usually the state variable.
3. Register Storage (Load Control)
Expectation: a register should hold its data for many clocks and load only on command.
Reality: a D flip-flop loads on every clock edge.
Solutions:
- Clock gating — block the clock when not loading.
- Load-controlled feedback — a mux feeds the output back when not loading.
- Use S–R / J–K flip-flops — input (0,0) means hold.
Control signal Load: Load = 1 → load data inputs; Load = 0 → store (hold).
Registers with Clock Gating
For a positive-edge flip-flop:
When Load = 0, the gated clock is stuck at 1 → no rising edges → hold.
⚠️ Clock skew: the OR gate delays the gated clock relative to the main clock (and to other gated clocks), which can break timing. Avoid clock gating unless it is carefully designed.
Registers with Load-Controlled Feedback
Run the clock continuously; put a 2-to-1 MUX in front of each D input:
flowchart LR IN[In_i] -->|1| MUX{{2-to-1 MUX}} Q -->|0| MUX LOAD[Load] --> MUX MUX --> D[D flip-flop] CLK[Clock] --> D D --> Q[A_i / Y_i]
| Load | D input | Result |
|---|---|---|
| 0 | (own output) | Hold |
| 1 | Load new value |
More hardware than clock gating, but free of timing problems.
4. Register Transfer Operations
Definition – Register Transfer
Movement and processing of data stored in registers. Three components:
- a set of registers,
- operations on them,
- control of those operations.
Elementary operations (load, count, shift, add, bitwise OR…) are called microoperations.
Register notation
| Notation | Meaning | Example |
|---|---|---|
| Letters + digits | A register | R2, PC, IR |
| Parentheses ( ) | Bit or range of bits | R1(1), PC(7:0), PC(L) |
| Arrow ← | Data transfer | R1 ← R2 |
| Comma | Parallel (simultaneous) operations | R1 ← R2, R3 ← R4 |
| Brackets [ ] | Memory address | R0 ← M[AR], R3 ← M[PC] |
A 16-bit PC splits into PC(H) = bits 15:8 and PC(L) = bits 7:0.
Definition – Conditional Transfer
drives the Load input of R2. The transfer happens at the clock edge where ; at all other edges R2 holds.
5. Microoperations
Types
| Group | Purpose |
|---|---|
| Transfer | Move data between registers |
| Arithmetic | +, −, ×, / on register data |
| Logic | Bitwise ∨ (OR), ∧ (AND), ⊕ (XOR), ¯ (NOT) |
| Shift | Shift data within registers |
Examples
| Microoperation | Meaning |
|---|---|
| R1 ← R1 + R2 | Add R1 and R2, result in R1 |
| PC ← R1 × R6 | Multiply R1 by R6, result in PC |
| R1 ← R1 ⊕ R2 | Bitwise XOR |
| PC ← | 1’s complement of R2 into PC |
| : R1 ← R1 ∨ R3 | If OR , bitwise OR R1 with R3 |
⚠️ Two meanings of ”+”: in a control expression () it means logical OR; in a microoperation (R1 + R3) it means arithmetic addition. Bitwise OR in a microoperation is written ∨.
Control expressions
Written left of a colon; the operation occurs only when the expression = 1.
- enables the operation.
- X = 0 → add; X = 1 → add the 2’s complement of R2 = subtract.
Arithmetic microoperations
| Symbolic | Description |
|---|---|
| R0 ← R1 + R2 | Addition |
| R0 ← | 1’s complement |
| R0 ← + 1 | 2’s complement |
| R0 ← R2 + + 1 | R2 − R1 (via 2’s complement) |
| R1 ← R1 + 1 | Increment |
| R1 ← R1 − 1 | Decrement |
Logic microoperations
| Symbolic | Description | Typical use |
|---|---|---|
| R0 ← | Bitwise NOT | |
| R0 ← R1 ∨ R2 | Bitwise OR | Set bits |
| R0 ← R1 ∧ R2 | Bitwise AND | Clear bits (mask) |
| R0 ← R1 ⊕ R2 | Bitwise XOR | Complement selected bits |
Example – R1 = 10101010, R2 = 11110000
| Operation | R0 |
|---|---|
| R0 ← | 01010101 |
| R0 ← R1 ∨ R2 | 11111010 |
| R0 ← R1 ∧ R2 | 10100000 |
| R0 ← R1 ⊕ R2 | 01011010 |
Notice: where R2 = 1 (upper nibble), OR sets, AND keeps, XOR inverts; where R2 = 0 (lower nibble), OR keeps, AND clears, XOR keeps.
Shift microoperations
| Symbolic | Description |
|---|---|
| R1 ← sl R2 | Shift left |
| R1 ← sr R2 | Shift right |
Example – R2 = 11001001
| Operation | R1 |
|---|---|
| R1 ← sl R2 | 10010010 |
| R1 ← sr R2 | 01100100 |
These shifts zero-fill. Other variants: rotates, arithmetic shifts, or a separate flip-flop supplying/catching the shifted bit.
6. Register Transfer Structures
| Structure | Description |
|---|---|
| Multiplexer-based | Each register has its own MUX selecting its sources |
| Bus-based (MUX) | One shared MUX drives a bus feeding several registers |
| Three-state bus | Sources drive a shared bus through 3-state buffers |
| Other | Multiple MUXes/buses and combinations |
Example – Multiplexer-based transfer into R0
flowchart LR R1[R1] -->|1| M{{2-to-1 MUX<br/>S = K1}} R2[R2] -->|0| M M --> R0[R0] K1[K1] --> OR((OR)) K2[K2] --> OR OR -->|Load| R0
- Load = ; select S = .
- has priority: if both are 1, R1 is loaded.
⚠️ The MUX select gives priority — that’s why the second transfer’s condition is , not just .
7. Shift Registers
Definition – Shift Register
Moves data laterally toward the MSB or LSB. Simplest form: D flip-flops in a chain, each Q feeding the next D.
- In = serial input (shift-right input)
- Out = serial output
- (A, B, C, Out) = parallel output
flowchart LR IN[In] --> A[D FF A] --> B[D FF B] --> C[D FF C] --> O[D FF Out] CP[Clock CP] -.-> A & B & C & O
Example – Serial shifting (In = 0,1,1,0,1,1,1)
| Clock | In | A | B | C | Out |
|---|---|---|---|---|---|
| T0 | 0 | ? | ? | ? | ? |
| T1 | 1 | 0 | ? | ? | ? |
| T2 | 1 | 1 | 0 | ? | ? |
| T3 | 0 | 1 | 1 | 0 | ? |
| T4 | 1 | 0 | 1 | 1 | 0 |
| T5 | 1 | 1 | 0 | 1 | 1 |
| T6 | 1 | 1 | 1 | 0 | 1 |
Each clock, every bit moves one place right; the first input bit reaches Out after 4 clocks.
Parallel-load shift register
A 2-to-1 MUX before each stage:
- SHIFT = 0 → load parallel data
- SHIFT = 1 → shift right on each clock (IN enters A)
Extend with more bits for an n-bit parallel-load shift register.
Shift registers with additional functions
A 4-input MUX per stage gives four functions (one possible select encoding):
| Function | |
|---|---|
| 00 | Hold |
| 01 | Shift right |
| 10 | Shift left |
| 11 | Parallel load |
Further extensions: shifting more than one position, or by a variable shift amount (barrel shifter).
⚠️ Shifting left multiplies an unsigned binary number by 2; shifting right divides by 2 (dropping the remainder).