1. Counters
Definition – Counter
A sequential circuit that steps through a specific sequence of states (up, down, or any fixed sequence).
| Type | Clocking | Pros / cons |
|---|---|---|
| Ripple | Only the LSB flip-flop gets the clock; each other FF is clocked by the previous FF’s output | Low power; not truly synchronous; delay grows toward the MSB |
| Synchronous | All flip-flops share the clock; logic decides the next state | No ripple delay; more logic |
Ripple counter (2-bit, D flip-flops wired as toggles)
- Each FF has → it toggles on each active edge of its clock.
- FF A is clocked by CP; FF B is clocked by .
- When A goes 1 → 0, rises → B toggles.
Sequence : 00 → 01 → 10 → 11 → 00 …
Each extra bit toggles at half the rate of the one before it. 3 bits: 000, 001, … , 111, 000.
⚠️ “Ripple”: each change waits one clock-to-output delay after the stage before it, so the MSB settles last and intermediate (wrong) counts appear briefly.
Synchronous counter (4-bit binary up-counter)
Common clock + incrementer feeding the D inputs:
- XOR complements a bit…
- …when the AND chain says all lower bits are 1 (and EN = 1).
- Count Enable EN = 0 forces the AND chain to 0 → hold.
- Carry Out CO connects to EN of the next 4-bit counter to build larger counters.
Serial vs parallel gating
| Serial gating | Parallel gating | |
|---|---|---|
| Structure | AND chain, carry ripples through | Each bit gets its own wide AND of all lower bits |
| Delay | Long | Short (like carry-lookahead) |
Lookahead on CO/EN between counter blocks prevents long paths in large counters. Symbol: block CTR 4 with EN, Q0–Q3, CO.
Other counters
- Down counter – counts down.
- Up-down counter – direction set by an Up/Down input.
- Parallel-load counter – Load input loads a value.
- Divide-by-n (modulo-n) counter – n states (n need not be a power of 2), e.g. BCD (mod-10) counter.
Counter with parallel load
| Load | Count | Action |
|---|---|---|
| 0 | 0 | Hold |
| 0 | 1 | Count up |
| 1 | X | Load D |
Load disables the count logic and the feedback, and enables the data inputs.
2. Design Example – Synchronous BCD Counter
State table
| Next | |
|---|---|
| 0000 | 0001 |
| 0001 | 0010 |
| 0010 | 0011 |
| 0011 | 0100 |
| 0100 | 0101 |
| 0101 | 0110 |
| 0110 | 0111 |
| 0111 | 1000 |
| 1000 | 1001 |
| 1001 | 0000 |
States 1010–1111 are don’t-cares.
Next-state equations (D flip-flops, XOR form)
Add a synchronous or asynchronous reset.
What happens in unused states?
Evaluating the equations for 1010–1111:
| Present | Next |
|---|---|
| 1010 (10) | 1011 (11) |
| 1011 (11) | 0110 (6) |
| 1100 (12) | 1101 (13) |
| 1101 (13) | 0100 (4) |
| 1110 (14) | 1111 (15) |
| 1111 (15) | 0010 (2) |
stateDiagram-v2 s0 --> s1 s1 --> s2 s2 --> s3 s3 --> s4 s4 --> s5 s5 --> s6 s6 --> s7 s7 --> s8 s8 --> s9 s9 --> s0 s10 --> s11 s11 --> s6 s12 --> s13 s13 --> s4 s14 --> s15 s15 --> s2
From any invalid state the counter returns to a valid one within two clocks (self-correcting). Whether that is acceptable depends on the application and the design group’s policy.
⚠️ Always check what your don’t-care choices do to unused states — a bad choice can trap the circuit in an invalid loop.
3. Register Cell Design
Approach
- Design one representative cell (bit ).
- Connect n copies to form the register.
- Apply boundary conditions to the end cells and simplify where possible.
Register specification includes
- the register and its data inputs,
- the control inputs and their allowed combinations:
- not encoded (e.g., Load, Shift, Add — at most one is 1),
- encoded (e.g., — all combinations used),
- the register functions as transfers (e.g., Load: A ← B; Shift: A ← sr B; Add: A ← A + B),
- the hold condition (all controls 0 → keep state).
Example 1 – Register A with controls ,
Allowed control combinations: (0,0), (0,1), (1,0).
Design 1 – Multiplexer approach
- Load
- 3-input MUX with , :
- (hold)
- ()
- ()
Cost ≈ 19 gate inputs per cell + 8 for the shared decoder, plus a flip-flop with enable.
Design 2 – Sequential (state table) approach
Only two states per cell ( or ). With don’t-cares for :
| Hold | , | , | , | , | |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 | 0 |
K-map (variables ) gives:
Factor and use DeMorgan:
Gate-input cost per cell (slide count), with a plain D flip-flop (no enable).
Check
| Expected | ||
|---|---|---|
| 00 | hold ✅ | |
| 10 | OR ✅ | |
| 01 | XOR ✅ |
✅ Saves more than 5 gate inputs per cell compared with the MUX design.
⚠️ In the slides, "" uses ”+” for XOR (⊕) — the state table confirms it ().
4. Multiplexer and Bus-Based Transfers for Multiple Registers
Dedicated MUX per register
Each of R0, R1, R2 has its own 2-to-1 MUX selecting one of the other two registers.
- Simultaneous transfers: every register can load from a different source in the same clock, e.g. a swap (R0 ← R1, R1 ← R0) or a rotate (R0 ← R1, R1 ← R2, R2 ← R0).
- Cost: highest (one n-bit MUX per register).
Single MUX bus
One n-bit 3-to-1 MUX () drives a bus feeding all registers.
- Only one source per clock, but that value can be loaded into several destinations at once (e.g., R1 ← R0, R2 ← R0).
- Cost: one MUX instead of three → cheaper; swaps now take multiple cycles.
Three-state bus
The MUX is replaced by 3-state buffers () on a shared bus node.
- Same transfer limit as the MUX bus (one source at a time).
- Cheaper still; buffers are distributed — easy to add more sources.
- Allows bidirectional pins (register input and output share the bus wire).
flowchart LR R0[R0] -->|E0| BUS[(3-state bus)] R1[R1] -->|E1| BUS R2[R2] -->|E2| BUS BUS -->|L0| R0 BUS -->|L1| R1 BUS -->|L2| R2
⚠️ Exactly one may be 1 at a time — two enabled sources cause bus contention.
| Structure | Simultaneous different sources? | Relative cost |
|---|---|---|
| Dedicated MUXes | Yes | High |
| MUX bus | No | Medium |
| 3-state bus | No | Low |
5. Serial Transfers and Microoperations
Serial transfers
Used when the path is “narrow”:
- telephone/cable line: parallel→serial at the source, serial→parallel at the destination;
- testing: link all flip-flops into one big shift register to load and capture their contents.
Serial microoperations
- Shift left = ×2; shift right = ÷2.
- Serial addition, parity generation/checking, error-correcting codes (e.g., CDs).
Example – Serial adder
Two shift registers hold A(3:0) and B(3:0). A single full adder and a carry flip-flop process one bit per clock, LSB first; the sum shifts back into A and the final carry stays in the flip-flop.
flowchart LR A[Shift reg A] -->|A0| FA[Full adder] B[Shift reg B] -->|B0| FA FF[Carry D FF] -->|Cin| FA FA -->|Cout| FF FA -->|Sum → serial in| A
Trace: A = 0110 (6), B = 0011 (3)
| Clock | Sum | ||||
|---|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 1 | 0 |
| 2 | 1 | 1 | 0 | 0 | 1 |
| 3 | 1 | 0 | 1 | 0 | 1 |
| 4 | 0 | 0 | 1 | 1 | 0 |
A = 1001 = 9 ✅ after 4 clocks. Cheap: one full adder regardless of word length; a tree of serial adders can sum many operands (common in DSP).
6. Control of Register Transfers
Datapath and control unit
flowchart LR CI[Control inputs] --> CU[Control unit] CU -- Control signals --> DP[Datapath] DP -- Status signals --> CU DI[Data inputs] --> DP DP --> DO[Data outputs] CU --> CO[Control outputs]
- Datapath: registers + operations.
- Control unit: sequences the register transfers.
| System | Control unit |
|---|---|
| Programmable | Fetches and executes instructions of a program from memory (addressed by a PC) |
| Non-programmable | Sequences transfers directly from inputs and status bits — no instructions (only this type here) |
Register transfer system design procedure
- Write a detailed specification.
- List all data/control/status inputs and outputs, and the registers.
- Draw a state machine diagram with register transfers as outputs.
- Define internal control and status signals; move output conditions/actions into a table.
- Draw block diagrams of the datapath (and control if it has registers).
- Design specialized register-transfer logic.
- Design the control unit logic.
- Verify the combined system; debug and re-verify if needed.
7. Design Example – DASHWATCH
Specification
Cheap stopwatch for sprinters:
- times up to 99.99 s (clock = 100 Hz, one count = 0.01 s),
- stores the best (shortest) time of the session (cleared by power-off or RESET),
- 4-digit BCD LCD with decimal point.
Inputs, outputs, registers
| Symbol | Function | Type |
|---|---|---|
| START | Reset timer to 0 and start | Control input |
| STOP | Stop and display timer | Control input |
| CSS | Compare, Store and display Shortest time | Control input |
| RESET | Set shortest value to 99.99 | Control input |
| 7-segment vectors (a–g) per digit | Data outputs | |
| DP | Decimal point (= 1) | Data output |
| B | Full 29-bit display vector | Data output |
| TM | 4-digit BCD counter (16 bits) | Register |
| SD | Parallel-load register (16 bits) | Register |
State machine diagram (register transfers as outputs)
stateDiagram-v2 [*] --> S1 : RESET S1 --> S2 S2 --> S2 : START' S2 --> S3 : START S3 --> S3 : STOP' S3 --> S4 : STOP S4 --> S4 : CSS'·START' S4 --> S2 : CSS'·START S4 --> S5 : CSS S5 --> S6 : TM < SD S5 --> S7 : TM ≥ SD S6 --> S7 S7 --> S7 : START' S7 --> S2 : START note right of S1 : SD ← 9999 (BCD) note right of S2 : TM ← 0000 (BCD) note right of S3 : TM ← TM + 1, DIS = TM note right of S4 : DIS = TM note right of S6 : SD ← TM note right of S7 : DIS = SD
| State | Role |
|---|---|
| S1 | Reset: SD ← 99.99 (largest possible time) |
| S2 | TM ← 0; wait for START (separate from S1 so SD is not reset again) |
| S3 | Running: TM ← TM + 1 every 0.01 s, display TM |
| S4 | Stopped, display TM; CSS → compare, START → new dash |
| S5 | Compare TM with SD |
| S6 | New record: SD ← TM |
| S7 | Display SD (best time); START → new dash |
Control and status signals
| Action / status | Signal | Meaning |
|---|---|---|
| TM ← 0000 | RSTM | 1: synchronous reset of TM |
| TM ← TM + 1 | ENTM | 1: count up; 0: hold |
| SD ← 9999 | UPDATE = 0, LSR = 1 | Select 1001 1001 1001 1001, load |
| SD ← TM | UPDATE = 1, LSR = 1 | Select TM, load |
| DIS = TM / SD | DS = 0 / 1 | Display mux select |
| TM < SD | ALTB | 1: TM < SD; 0: TM ≥ SD |
Datapath
- TM: 4-digit BCD counter, SRST = RSTM, incoming carry = ENTM.
- A < B comparator: TM vs SD → ALTB (left-to-right iterative cell array).
- SD: 16-bit parallel-load register, LOAD = LSR, asynchronous RESET; input from a 16-bit 2-to-1 MUX (S = UPDATE) choosing 1001100110011001 or TM (contracted, since one input is constant).
- Display: 16-bit 2-to-1 MUX (S = DS) → 4-digit BCD-to-7-segment converter → 4-digit LCD, DP = 1.
flowchart TB ENTM --> TM[TM: 4-digit BCD counter] RSTM --> TM TM --> CMP[A < B comparator] --> ALTB SD[SD: storage register] --> CMP TM --> MUXU[MUX S=UPDATE] K[9999 BCD] --> MUXU --> SD LSR --> SD TM --> MUXD[MUX S=DS] SD --> MUXD --> CONV[BCD → 7-seg] --> LCD[4-digit LCD, DP=1]
Control-signal SMD and equations (one-hot, 7 flip-flops)
S1 is entered only via asynchronous RESET, so .
Outputs
⚠️ The slide equations lost their overbars; the versions above follow the arcs of the SMD (e.g., S2 stays in S2 only while START = 0).
8. Microprogrammed Control
Definitions
| Term | Meaning |
|---|---|
| Microprogrammed control | Control unit whose binary control values are stored as words in memory |
| Microinstruction | One word in control memory |
| Microprogram | A sequence of microinstructions |
| Control memory | ROM/RAM holding the microinstructions |
| Writable control memory | RAM into which microinstructions can be written |
Organization
flowchart TB IN[Control inputs + status from datapath] --> NAG[Next-address generator] NAG --> CAR[Control address register] CAR -->|Control address| ROM[Control memory ROM] ROM --> CDR[Control data register - optional] CDR -->|Next-address info| NAG CDR --> OUT[Control outputs + control signals to datapath]
The sequencer (next-address generator + control address register) picks the next microinstruction from the current one’s next-address field, the control inputs and the datapath status.