1. Counters

Definition – Counter

A sequential circuit that steps through a specific sequence of states (up, down, or any fixed sequence).

TypeClockingPros / cons
RippleOnly the LSB flip-flop gets the clock; each other FF is clocked by the previous FF’s outputLow power; not truly synchronous; delay grows toward the MSB
SynchronousAll flip-flops share the clock; logic decides the next stateNo 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 …

CP A B 012301

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 gatingParallel gating
StructureAND chain, carry ripples throughEach bit gets its own wide AND of all lower bits
DelayLongShort (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

LoadCountAction
00Hold
01Count up
1XLoad D

Load disables the count logic and the feedback, and enables the data inputs.


2. Design Example – Synchronous BCD Counter

State table

Next
00000001
00010010
00100011
00110100
01000101
01010110
01100111
01111000
10001001
10010000

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:

PresentNext
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

  1. Design one representative cell (bit ).
  2. Connect n copies to form the register.
  3. 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, , , ,
000101
111110

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
00hold ✅
10OR ✅
01XOR ✅

✅ 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.

StructureSimultaneous different sources?Relative cost
Dedicated MUXesYesHigh
MUX busNoMedium
3-state busNoLow

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)

ClockSum
101010
211001
310101
400110

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.
SystemControl unit
ProgrammableFetches and executes instructions of a program from memory (addressed by a PC)
Non-programmableSequences transfers directly from inputs and status bits — no instructions (only this type here)

Register transfer system design procedure

  1. Write a detailed specification.
  2. List all data/control/status inputs and outputs, and the registers.
  3. Draw a state machine diagram with register transfers as outputs.
  4. Define internal control and status signals; move output conditions/actions into a table.
  5. Draw block diagrams of the datapath (and control if it has registers).
  6. Design specialized register-transfer logic.
  7. Design the control unit logic.
  8. 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

SymbolFunctionType
STARTReset timer to 0 and startControl input
STOPStop and display timerControl input
CSSCompare, Store and display Shortest timeControl input
RESETSet shortest value to 99.99Control input
7-segment vectors (a–g) per digitData outputs
DPDecimal point (= 1)Data output
BFull 29-bit display vectorData output
TM4-digit BCD counter (16 bits)Register
SDParallel-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
StateRole
S1Reset: SD ← 99.99 (largest possible time)
S2TM ← 0; wait for START (separate from S1 so SD is not reset again)
S3Running: TM ← TM + 1 every 0.01 s, display TM
S4Stopped, display TM; CSS → compare, START → new dash
S5Compare TM with SD
S6New record: SD ← TM
S7Display SD (best time); START → new dash

Control and status signals

Action / statusSignalMeaning
TM ← 0000RSTM1: synchronous reset of TM
TM ← TM + 1ENTM1: count up; 0: hold
SD ← 9999UPDATE = 0, LSR = 1Select 1001 1001 1001 1001, load
SD ← TMUPDATE = 1, LSR = 1Select TM, load
DIS = TM / SDDS = 0 / 1Display mux select
TM < SDALTB1: 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

TermMeaning
Microprogrammed controlControl unit whose binary control values are stored as words in memory
MicroinstructionOne word in control memory
MicroprogramA sequence of microinstructions
Control memoryROM/RAM holding the microinstructions
Writable control memoryRAM 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.