DLD Notes: Advanced Combinational & Sequential Logic

Nov 19, 2026·Pranesh Mahanta·21ECC203T — Digital Logic Design

FSM analysis and design, Hamming codes and multipliers — the complete unit, with every worked design stated in full and solved step by step.

Contents
  1. Unit 4 — what's new after Unit 3
  2. The analysis toolbox
  3. Worked analysis 1 — two D flip-flops (Mano fig. 5-15)
  4. Worked analysis 2 & 3 — JK and T flip-flop circuits
  5. Mealy and Moore models
  6. State reduction — same behaviour, fewer states
  7. State assignment — naming the states
  8. The FSM design recipe (7 steps — memorise)
  9. Design — sequence detector “110” (the flagship example)
  10. Design — sequence detector “0111” (Moore vs Mealy)
  11. Design — the 15¢ vending machine
  12. Flip-flop conversion — one FF from another
  13. Hamming code — detect and correct single-bit errors
  14. Adder delay — ripple-carry vs carry look-ahead
  15. Design — the 2-bit multiplier
  16. Unit-4 formula sheet (copy these lines)

1Unit 4 — what's new after Unit 3

The bridge. Unit 3 built the components: latches, flip-flops, registers, counters and shift registers (all of that lives in the Unit-3 notes — the Part-I deck repeats it almost word for word, so only the characteristic equations are recapped below). Unit 4 now treats sequential circuits as systems: you are given (or you invent) a behaviour and you must analyse a circuit into a state table, or design a circuit from a word statement. Around that core the unit adds four practical circuits — the Hamming error-correcting code, the ripple-carry vs carry-look-ahead adder delay story, and the 2-bit multiplier.

Unit-4 map: ① analysis (state equations / table / diagram / FF-input equations) → ② Mealy vs Moore → ③ state reduction & assignment → ④ FSM design recipe (sequence detectors 110 / 0111 / 1011, vending machine) → ⑤ flip-flop conversion → ⑥ Hamming code → ⑦ adder delay: ripple vs look-ahead → ⑧ 2-bit multiplier.
Carried over from Unit 3 (memorise!)Characteristic equation
SR flip-flopQ+ = S + R′Q  (S = R = 1 forbidden)
D flip-flopQ+ = D
JK flip-flopQ+ = JQ′ + K′Q
T flip-flopQ+ = T ⊕ Q
Worked problem
What does "analysis of a clocked sequential circuit" mean? Name the tools it uses.
Analysis is the reverse of design: start from a logic diagram and extract its behaviour. The behaviour is determined by the inputs, the outputs and the state of the flip-flops, and it is captured with four tools — state (transition) equations, the state table, the state diagram and the flip-flop input (excitation) equations. Outputs and next state are both functions of the present state and the inputs.
How the exam uses this unit: one "explain/compare" question (Mealy vs Moore, or state reduction), one "analyze the given circuit" question, and one full design — a sequence detector or the vending machine — plus definition MCQs on Hamming, CLA and conversion. The 7-step recipe in section 8 answers every design question.

2The analysis toolbox

State equations. A state (transition) equation specifies the next state as a Boolean function of the present state and the inputs. For a circuit with D flip-flops it is read straight off the gates that drive each D pin. It is customary to write A(t+1) — or A+ — for "the value A will have after the next clock edge". The output equation is written the same way: y(t) = f(A, B, x).

Example notation:  A(t+1) = Ax + Bx  →  shorthand A+ = Ax + Bx.  Every variable on the right is either a present-state bit or a circuit input.

State table — two equivalent forms. The state table enumerates the time sequence of inputs, outputs and flip-flop states — a truth table for the whole circuit. A circuit with m flip-flops and n inputs needs 2m+n rows. Form 1 has four sections (present state, input, next state, output) with one row per input combination. Form 2 collapses to three sections: next-state and output columns are grouped under each input value — this is the form you use for Mealy machines because it makes the transition pattern visible at a glance.

FormSectionsRowsBest for
1 — list formPS · input · NS · output2m+nreading a circuit mechanically
2 — grouped formPS · NS(x=0, x=1) · out(x=0, x=1)2mMealy diagrams, state reduction

State diagram. The same information as a picture: one circle per state (binary value written inside), one directed edge per transition. On a Mealy machine each edge is labelled input/output; on a Moore machine the output lives inside the circle and edges carry only the input. The state table is easier to derive from a logic diagram; the state diagram is easier for humans to read — exams ask for both.

Flip-flop input equations. To draw a circuit from its behaviour you need the Boolean expressions feeding the flip-flop inputs — the excitation equations (e.g. DA = Ax + Bx, DB = A′x) plus the output equations (y = (A+B)x′). During analysis you read them off the diagram; during design you derive them from K-maps. They are the hinge between tables and hardware.

Worked problem
Define a state equation and a state table. How many rows does the state table of a circuit with m flip-flops and n inputs need?
A state equation gives the next state of one flip-flop as a Boolean function of present state and inputs (also called a transition equation). The state table lists — for every present state and input — the next state and the output; it is the truth table of the sequential circuit. With m flip-flops and n inputs it has 2m+n rows (e.g. m = 2 FFs + 1 input → 8 rows).
Worked problem
Explain the analysis procedure of a clocked sequential circuit, and the two forms of the state table.
Steps: ① write the flip-flop input equations from the diagram; ② substitute them into the FF characteristic equation (Q+ = D, or JQ′ + K′Q, or T ⊕ Q) to get the state equations; ③ evaluate both for every present-state/input combination to build the state table; ④ evaluate the output equation; ⑤ draw the state diagram. Form-1 table: separate input column, one row per (state, input) pair — 2m+n rows. Form-2 table: next state and output grouped under x = 0 and x = 1, only 2m rows; it directly mirrors the Mealy state diagram and is the working form for state reduction.

3Worked analysis 1 — two D flip-flops (Mano fig. 5-15)

The circuit. Two D flip-flops A and B share one clock; input x enters the gate layer and output y leaves it. Reading the gates: DA = Ax + Bx (two ANDs into an OR), DB = A′x (inverter on A), and y = (A+B)·x′ (OR of the states, ANDed with the inverted input). Note the Mealy fingerprint already: y depends on x, not just on the state bits.

xA(t+1) = Ax + BxB(t+1) = A′xy = (A+B)·x′DQQADQQBCLKCLKABD_A = Ax + Bxoutput y is Mealy: needs x too
The two-D-FF analysis example: DA = Ax + Bx, DB = A′x, y = (A+B)x′. Credit: redrawn (after Mano fig. 5-15, lecture deck "State Equations").

Step 1 — state equations. Because the FFs are of type D, Q+ = D substitutes directly, so A+ = Ax + Bx and B+ = A′x, with y = (A+B)x′. With D flip-flops the excitation equations are the state equations — no characteristic-table detour is needed. That is exactly why designs with D FFs are the fastest to both analyse and build.

Step 2 — the 8-row table. Two FFs + one input → 23 = 8 rows. For each row, plug (A, B, x) into the three equations. Example row A = 0, B = 1, x = 1: A+ = 0·1 + 1·1 = 1, B+ = 1·1 = 1, y = (0+1)·0 = 0. All eight rows (machine-checked):

ABxA₂B₂y
000000
001010
010001
011110
100001
101100
110001
111100

Step 3 — read the behaviour. The output y = 1 whenever A or B is set and x = 0 — the machine "raises its hand" when the input falls back to 0 after any activity. Every state except 11 flows back to 00 on x = 0, and 00 moves to 01 on x = 1; state 01 either loops (x = 1) or returns with y = 1. The diagram below is the same table drawn as four circles with input/output edge labels.

000110110/01/00/11/01/00/10/11/0edges labelled input/output (Mealy) · y = 1 whenever A or B is set and x = 0
State diagram of the fig. 5-15 circuit — Mealy labels input/output on every edge. Credit: redrawn (after Mano fig. 5-16).
Worked problem
Analyze the circuit with two D flip-flops: D₁ = Ax + Bx, D₂ = A′x, y = (A+B)x′. Give the state table and diagram.
Since Q+ = D: A+ = Ax + Bx, B+ = A′x, y = (A+B)x′. Tabulate the 8 rows (A, B, x → A₂, B₂, y) — 000→000·0, 001→010·0, 010→000·1, 011→110·0, 100→000·1, 101→100·0, 110→000·1, 111→100·0 — then draw the 4-state Mealy diagram: 00 self-loops on 0/0, 00→01 on 1/0, 01 self-loops on 1/0, and every state returns to 00 on 0/1 except 11 which goes to 10 on 1/0. y fires only when the input is 0 while some FF is still set.

4Worked analysis 2 & 3 — JK and T flip-flop circuits

A one-FF warm-up (Mano fig. 5-17). With DA = A ⊕ x ⊕ y the machine simply toggles whenever an odd number of (A, x, y) are 1. Its state table is the XOR truth table; the diagram is two circles where inputs 01 and 10 flip the state and inputs 00 and 11 self-loop. It behaves exactly like a T flip-flop with T = x ⊕ y — a nice reminder that any 1-FF machine is a T-FF in disguise.

JK circuit (Mano fig. 5-18). Now the FFs are JK type, so the characteristic equation Q+ = JQ′ + K′Q does real work. The gates give JA = B, KA = Bx′, JB = x′, KB = A ⊕ x. Substituting:

A+ = JAA′ + KA′A = BA′ + (Bx′)′A = A′B + AB′ + Ax
B+ = JBB′ + KB′B = x′B′ + (A ⊕ x)′B = B′x′ + ABx + A′Bx′
xJ₁ = Bx′K₁ = Bx′J₂ = x′K₂ = A ⊕ xJKQQAJKQQBCLKCLKABJ₁=B· K₁=Bx′ · J₂=x′ · K₂=A⊕x
The JK analysis circuit. Credit: redrawn (after Mano fig. 5-18, deck "Analysis with JK flip-flops").
ABxJ₁K₁J₂K₂A₂B₂
000001001
001000100
010111011
011100110
100001111
101000010
110111100
111100011
0001101110010,110no output — the circuit only moves between states (pure analysis example)
State diagram of the JK circuit (no output in this example — pure state movement). Credit: redrawn (after Mano fig. 5-19).

T circuit (Mano fig. 5-21). With T flip-flops Q+ = T ⊕ Q, so each T input decides whether that bit flips. The gates give TA = Bx, TB = x and output y = AB. B therefore toggles on every x = 1 — B is a 1-bit counter of the input pulses — while A toggles only when x = 1 and B = 1, i.e. A counts the overflows of B. The pair is a 2-bit ripple counter being fed by x, and y fires when both bits are 1 (count 3).

xT₁ = BxT₂ = xy = ABTQQATQQBCLKCLKABB counts x-pulses; A counts only when B = 1
The T flip-flop analysis circuit. Credit: redrawn (after Mano fig. 5-21, deck "Analysis with T flip-flops").
ABxT₁T₂A₂B₂y
00000000
00101010
01000010
01111100
10000100
10101110
11000111
11111001
00/001/011/110/001010101Moore labels state/output — y = 1 only in state 11 (A·B)
State diagram of the T circuit — Moore-style labels state/output, y = 1 only in state 11. Credit: redrawn (after the deck's Fig. 5-22 diagram).
Worked problem
Analyze the JK circuit: J₁ = B, K₁ = Bx′, J₂ = x′, K₂ = A ⊕ x. Give the state equations, table and diagram.
Substitute into Q+ = JQ′ + K′Q: A+ = A′B + AB′ + Ax and B+ = B′x′ + ABx + A′Bx′. The 8-row table gives 00→01 (x=0) or 00 (x=1); 01→11 (x=0) or 10 (x=1); 10→11 (x=0) or 10 (x=1); 11→00 (x=0) or 11 (x=1). Diagram: 00 self-loops on 1 and steps to 01 on 0; 01 goes to 11 on 0 and 10 on 1; 10 self-loops on both inputs; 11 self-loops on 1 and clears to 00 on 0.
Worked problem
Analyze the T flip-flop circuit: T₁ = Bx, T₂ = x, y = AB. Give the state table and diagram, and explain the behaviour.
Q+ = T ⊕ Q gives A+ = (Bx)′A + (Bx)A′ = AB′ + Ax′ + A′Bx, B+ = x ⊕ B = xB′ + x′B. Table: 000→00, 001→01, 010→01, 011→10, 100→10, 101→11, 110→01 (y = 1), 111→00 (y = 1). Reading: B toggles each x = 1 pulse (it counts the pulses); A toggles only when B was 1 during an x = 1 (it counts carries); y = AB signals the terminal count 11.

5Mealy and Moore models

Two output conventions. Every synchronous FSM is built from the same two blocks — next-state logic and a state register — but the output block can be wired two ways. Mealy model: the output is a function of both the present state and the inputs, so it can change mid-cycle whenever an input changes. Moore model: the output is a function of the present state only, so outputs are synchronized with the clock and stay stable for a whole clock period. The difference is one wire: does the input reach the output logic or not.

Mealy modeloutput = f(state, input)Next-state logiccombinationalState registerclocked flip-flopsOutput logiccombinationalinoutpresent stateMoore modeloutput = f(state) only — synchronized with clockNext-state logiccombinationalState registerclocked flip-flopsOutput logicdecodes state onlyinoutpresent state
Block diagrams — the Mealy output logic sees the input arrow, the Moore output logic sees only the state register. Credit: original drawing for these notes (after Mano fig. 5-20 / lecture deck "Mealy and Moore model").
PropertyMealyMoore
Output depends onstate and inputstate only
Output timingcan change as soon as inputs change (async glitch risk)changes only on clock edges — stable for a full period
States neededfewer (output rides on edges)usually more (a state per output value)
Diagram notationedges labelled input/outputoutput written inside the circle, edges carry input only
Output glitchingpossibleno (cleaner for driving other clocked logic)
Typical usesequence detectors, fast responsecontrollers, vending machines, decoders
Worked problem
Define the Mealy model of a sequential machine.
A Mealy machine is a synchronous sequential circuit whose output is a function of both the present state and the current input (output = f(state, input)); only the state is clocked. In the state diagram the input/output pair is written on each directed edge. Because the input feeds the output logic directly, the output may change during a clock cycle as the input changes.
Worked problem
Define the Moore model of a sequential machine.
A Moore machine is a synchronous sequential circuit whose output is a function of the present state only (output = f(state)); the output is therefore synchronized with the clock and changes only at clock edges. In the diagram the output value is written inside each state circle and edges carry only the input. Moore machines typically need more states than the equivalent Mealy machine.
Worked problem
Compare Mealy and Moore machines (minimum five points) with one example of each.
See the table above — hit: dependence (state+input vs state only), output timing (immediate vs clock-synchronised), state count (Mealy smaller), diagram notation (edge labels vs in-circle labels), glitch behaviour (Mealy can glitch), and give one example of each (110 detector in 3 Mealy states vs 4 Moore states; vending machine). Conclude: same next-state machinery, only the output wiring differs.

6State reduction — same behaviour, fewer states

The rule. Two states are equivalent if, for every possible input sequence, they produce exactly the same output sequence — starting from either state, the machine is externally indistinguishable. For a state table that means: two rows are equivalent when (a) their outputs match for every input value and (b) their next states are the same or themselves equivalent. The check is iterative: scan for obviously identical rows, delete one and replace all references to it, then repeat — removing one pair can unlock another (exactly what happens below).

Why bother? Fewer states → fewer flip-flops (5 states need 3 FFs, but 9 states would need 4), fewer K-maps, less logic — and the external input-output behaviour stays identical, which is the whole point: reduction never changes what the outside world observes.

The worked example (Mano fig. 5-22): a 7-state Mealy machine that answers "how long since a pattern completed". Here is its table (machine-checked):

PSNext stateOutput
x=0x=1x=0x=1
aab00
bcd00
cad00
def01
eaf01
fgf01
gaf01

Pass 1: rows e and g are literally identical — NS (a, f), out (0, 1). Declare e ≡ g, delete g, replace every g with e (row f′s x=0 target becomes e). Pass 2: now d reads NS (e, f) and f reads NS (e, f) with outputs (0, 1) both — so d ≡ f; delete f, replace every f with d. The table shrinks to 5 states:

PSNext stateOutput
x=0x=1x=0x=1
aab00
bcd00
cad00
ded01
ead01
abcdegf0/01/00/01/00/01/00/01/10/01/11/10/00/01/17 states · outputs in salmon where y = 1 · a–g (Mano fig. 5-22)
The original 7-state diagram — salmon edges carry output 1. Credit: redrawn (after Mano fig. 5-22).

Proof by sequence. Drive both machines with the demo input 01010110100. The 7-state machine walks a→a→b→c→d→e→f→f→g→f→g→a and outputs 00000 11010 0; the 5-state machine walks a→a→b→c→d→e→d→d→e→d→e→a and outputs exactly the same 00000110100. (The verification script also exhaustively proves output-equivalence on every input sequence.)

abcde0/01/00/01/00/01/01/10/00/01/15 states — same input→output behaviour, one flip-flop input saved
The reduced 5-state diagram — identical input→output behaviour. Credit: redrawn (after Mano fig. 5-23).
Worked problem
State the rule for state reduction and reduce the classic a–g table (Mano fig. 5-22).
Rule: states are equivalent if they give the same outputs and equivalent next states for every input; equivalent states can be merged (delete one, redirect all arrows). Apply: pass 1 finds e ≡ g (identical rows) → delete g; pass 2 then finds d ≡ f → delete f. Reduced table = 5 rows a–e as tabulated. Verify on input 01010110100: both machines output 00000110100 — behaviour unchanged, logic smaller.

7State assignment — naming the states

The job. After reduction the states have letters (a, b, c…); hardware needs binary codes. With n states you need at least ⌈log₂n⌉ flip-flops — 5 states → 3 FFs (3 bits give 8 codes, so 3 stay unused and act as don't-cares in the K-maps). The choice of which code goes to which state changes the amount of gate logic; a lucky assignment gives noticeably simpler equations, and the standard exam answer lists the three classic options below.

StateBinary (counting)Gray (adjacent)One-hot (1 of n)
a00000000001
b00100100010
c01001100100
d01101001000
e10011010000
FFs needed⌈log₂5⌉ = 335

Trade-offs. Binary uses the minimum flip-flops but the K-maps may stay large because neighbouring states get unrelated codes. Gray assigns codes that differ in one bit to states that are frequently visited in sequence — good when the state graph has a natural cycle, and it kills hazards in async contexts. One-hot spends one flip-flop per state (5 FFs here) but each next-state equation looks at far fewer variables and becomes a simple OR of transition terms — this is what FPGA tools do automatically because their fabrics are register-rich. For exams: state the bit count, draw the three columns, and say "one-hot trades flip-flops for simpler, faster decode logic; only one flip-flop is high at any time".

Worked problem
A reduced FSM has five states. Show binary, Gray and one-hot assignments and give the flip-flop count of each.
5 states → ⌈log₂5⌉ = 3 flip-flops for binary (codes 000, 001, 010, 011, 100; three codes unused → K-map don't-cares) and 3 for Gray (000, 001, 011, 010, 110 — adjacent codes differ in one bit, handy when the state graph is a cycle). One-hot uses 5 flip-flops (00001, 00010, 00100, 01000, 10000; exactly one hot at a time) but every transition test reduces to a simple OR of two flip-flop outputs, and the output decode is a single AND — that is why FPGA flows pick it automatically.
Worked problem
What is state assignment? What is one-hot assignment?
State assignment is the process of giving each symbolic state of an FSM a distinct binary code (deciding how many flip-flops are used and which pattern each state gets). One-hot assignment uses one flip-flop per state: exactly one FF is 1 at any time (a 5-state machine uses 5 FFs with codes 00001, 00010, 00100, 01000, 10000). It needs more flip-flops than binary but gives simpler next-state and output logic — popular in FPGA implementations.

8The FSM design recipe (7 steps — memorise)

From words to wires. Every design question in this unit — sequence detectors, the vending machine, any controller — is answered by the same seven steps. The 3-bit up/down counter of Unit 3 was step-for-step the same procedure; here it runs on FSMs with outputs. Write the step numbers in the exam margin; markers look for them.

1 · Word → states. Decide Mealy or Moore, then list the minimal set of states and what each remembers.
2 · State diagram. Draw circles + labelled edges (Mealy: in/out; Moore: out inside).
3 · State table. Copy the diagram into grouped form (PS · NS(x=0,1) · out(x=0,1)).
4 · State assignment. Binary codes (Gray if a cycle dominates); extend the table with present-state and next-state bit columns — add rows for unused codes as don't-cares.
5 · Excitation table. For each flip-flop write its input value that produces the required transition: D = Q+; T = Q ⊕ Q+; JK from the J/K excitation table; SR likewise.
6 · K-maps. One map per FF input and one per output; mark unused state codes as X to shrink the algebra.
7 · Circuit + verify. Draw gates, then sanity-simulate a short input sequence through the equations and compare with the diagram.

Choosing Mealy or Moore at step 1. If the output must fire on the same edge that completes the condition — sequence detectors — Mealy saves a state. If the output must be a clean, full-period level — a dispense pulse driving a mechanical gate — Moore is safer. Exams accept either unless the question fixes it; state your choice in one sentence.

Common mark-losers: forgetting the don't-care rows for unused state codes (step 4), deriving T from the wrong direction (T = Q ⊕ Q+ = Q+ ⊕ Q), and omitting the verification sentence in step 7. Two minutes of simulation catches sign errors that cost half the marks.

9Design — sequence detector “110” (the flagship example)

Specification. Design a Mealy machine that outputs y = 1 on the clock edge where the input stream completes 110; overlapping is allowed (the stream 110110 reports twice). This is the exact worked example of the handwritten Unit-4 notes, done here with machine-verified algebra.

Step 1-2 — states and diagram. The machine must remember how much of "110" it has seen: nothing, "1", or "11" — three Mealy states. On input 0 from "11" the pattern completes: output 1, and since "110" ends in 0 the machine restarts in S0. On input 1 from "11" the last two symbols are still "11" — stay in S2 (that is the overlapping trick). Non-overlapping behaviour differs only in that arrow: S2 goes back to S0 with output 0.

S0S1S2nothing yetseen 1seen 110/01/00/01/00/11/0Mealy 110 detector, overlapping — the 0/1 edge fires while the next match restarts
Mealy 110 detector, overlapping variant — the salmon 0/1 edge is the detection. Credit: original drawing for these notes.
PSNext stateOutput y
x=0x=1x=0x=1
S0 (none)S0S100
S1 (1)S0S200
S2 (11)S0S210

Step 4 — assignment. Three states, 2 FFs. Use the Gray walk along the detection path: S0 = 00, S1 = 01, S2 = 11 (code 10 unused → don't-care). This choice pays off immediately: every transition that sets QB is one that comes with x = 1.

Step 5 — excitation table (D-FFs: D = Q+).

xQ₁Q₂Q₁₂Q₂₂D₁D₂y
00000000
10001010
00100000
10111110
01100001
11111110
state 10 (unused) → both D₁, D₂, y rows are XX

Step 6 — K-maps. Three 3-variable maps over (x, Q₁, Q₂), using X for the whole unused row:

Q₁Q₂D₁D₂y
x=0x=1x=0x=1x=0x=1
00000100
01010100
11010110
10XXXXXX
D₁ = x·Q₂  ·  D₂ = x  ·  y = x′·Q₁·Q₂  ←  remarkably small — that is the Gray assignment doing its job

Step 7 — circuit and verify. Two D-FFs, one 2-input AND for D₁, a wire for D₂, a 3-input AND for y (with an inverter on x). Verification: simulate the stream 110110110 — outputs 001001001 (three overlapping hits), and the stream 1110110 — outputs 0001001: the "110" hiding inside "1110" is caught because the machine stayed in S2. Both match the specification FSM on every input (script-checked).

xD₁ = x·Q₁D₂ = xy = x′·Q₁·Q₂DQQADQQBCLKCLKQ₁ (A)Q₂ (B)assignment: S0=00 · S1=01 · S2=11
The 110 detector circuit — two D flip-flops and three gates in total. Credit: original drawing for these notes.

Non-overlapping variant. Change one transition: S2 —x=1→ S0 (output 0, fresh start). The K-maps then give D₁ = x·Q₁′·Q₂, D₂ = x·Q₁′, y unchanged. Same demo stream 1110110 now gives 0000001 — the "110" inside "1110" is missed because the machine wiped its memory at the third 1. Overlap costs one extra AND-input term; it buys detections that share symbols.

Worked design
Design a Mealy sequence detector that outputs 1 when the input stream completes 110 (overlapping allowed). Use D flip-flops: state diagram, excitation table, K-maps, equations, circuit. State the change needed for non-overlapping detection.
Follow the 7-step recipe: 3 states (none / 1 / 11); Mealy diagram with S2→S0 on 0/1 and S2→S2 on 1/0; assignment S0=00, S1=01, S2=11; excitation table as above; K-maps give D₁ = xQ₂, D₂ = x, y = x′Q₁Q₂; circuit = 2 D-FFs + 2 ANDs + 1 inverter. Verify 110110110 → 001001001. Non-overlap: S2 —1→ S0/0, giving D₁ = xQ₁′Q₂, D₂ = xQ₁′ (verify 1110110 → 0000001).
Worked problem
Design the 110 detector as a Moore machine and compare it with the Mealy version.
Moore needs the output in a state, so a fourth state S3 = "110 seen" is required: S0→S1→S2 on 1s, S2→S3 on 0, S3→S0 on 0 and S3→S1 on 1 (a fresh 1 after detection starts the next match). With Gray assignment S0=00, S1=01, S2=11, S3=10 the D-FF equations come out as D₁ = Q₂(x + Q₁), D₂ = x, y = Q₁Q₂′ — still tiny, but the machine needs 4 states against Mealy’s 3, and the output arrives one clock period later (registered). That is the general trade: Moore = +1 state, cleaner timing; Mealy = fewer states, same-edge response.

10Design — sequence detector “0111” (Moore vs Mealy)

Specification. Detect 0111 in a serial stream — the handwritten notes run this as the Moore example with 5 states (Mealy needs only 4). A fresh 0 can always begin the next pattern, so every 0-input falls back to the "seen 0" state; that edge is what makes overlapping detections like 0110111 possible.

Moore version — 5 states. States remember the longest suffix of the stream that is a prefix of 0111: S0 (nothing), S1 ("0"), S2 ("01"), S3 ("011"), S4 ("0111" → output 1). From any state, a 0 either keeps you in S1 (if it starts a fresh match) or returns you to S1 (it can only ever extend a "0"-suffix — 0111 has no other 0-prefixes). From S4, a 1 restarts (suffix "1" matches nothing) — the notes' "jump to initial state".

S00S10S20S30S411001010101Moore 0111 detector — output lives inside S4; every 0 falls back to S1 (keeps the fresh 0)
Moore 0111 detector — outputs live inside the circles; every 0 feeds S1. Credit: original drawing for these notes (after the handwritten deck).
PS (out)Next state
x=0x=1
S0 (0)S1S0
S1 (0)S1S2
S2 (0)S1S3
S3 (0)S1S4
S4 (1)S1S0

Implementation snapshot (D-FFs, Gray-path assignment S0=000, S1=001, S2=011, S3=010, S4=100; unused codes 101/110/111 as X). Five states need 3 flip-flops, and the K-maps (full 8-row excitation table) reduce to:

D₁ = x·Q₂·Q₃′  ·  D₂ = x·Q₁′·Q₃  ·  Q₃₂ = x′ + Q₂′·Q₃  ·  y = Q₁·Q₂′·Q₃′

Verification (script-checked). Stream 0111011110111 walks S0 → S1 → S2 → S3 → S4(1) → S1 → S2 → S3 → S4(1) → S0 → S1 → S2 → S3 → S4(1) — three detections including the "…01111…" overlap case, outputs 00010001000 01. The equation-derived circuit reproduces the FSM on all 10 state/input pairs.

Mealy version — 4 states. Drop S4: the output rides on the edge S3 —1/1→ S0. With assignment S0=00, S1=01, S2=11, S3=10 the K-maps give D₁ = x·Q₂, D₂ = x′ + Q₁′Q₂, y = Q₁Q₂′x (all 8 rows verified). Note the teaching point the notes stress: because 0111 has no self-overlap (no proper suffix equals a prefix), the overlapping and non-overlapping Mealy machines are identical here — unlike 110, where S2's self-loop on 1 is the overlap.

Worked problem
Design a Moore machine that detects 0111 using D flip-flops: states, diagram, excitation table, equations.
Five states S0–S4 as tabulated (y = 1 only in S4); every x = 0 transition lands in S1 because a lone 0 is always a fresh prefix. Assignment S0=000, S1=001, S2=011, S3=010, S4=100 with unused codes as don't-cares; excitation table 10 rows (5 states × 2 inputs); K-maps give D₁ = xQ₂Q₃′, D₂ = xQ₁′Q₃, Q₃₂ = x′ + Q₂′Q₃, y = Q₁Q₂′Q₃′. Circuit: 3 D-FFs + the gate layer; verify on 0111011110111 → 0001000100001.
Worked problem
Design a Mealy sequence detector for 1011 (overlapping) using D flip-flops.
Four states: none / 1 / 10 / 101. The subtlety: from "1" an input 1 stays in "1" (the suffix "1" of "11" is still a prefix), and from "101" an input 0 goes to "10" (the suffix "10" of "1010" restarts the pattern). Diagram: S0 —0/0→ S0, S0 —1/0→ S1; S1 —0/0→ S2, S1 —1/0→ S1; S2 —0/0→ S0, S2 —1/0→ S3; S3 —0/0→ S2, S3 —1/1→ S1. Assignment S0=00, S1=01, S2=11, S3=10; K-maps over the 8-row excitation table give D₁ = x′(Q₁ ⊕ Q₂) + x·Q₁Q₂, D₂ = (Q₁ ⊕ Q₂) + x·Q₁′, y = Q₁Q₂′x — all 8 rows script-verified. Demo: 101011011011 → outputs 000001001001 (three overlapping hits).

11Design — the 15¢ vending machine

Specification (the classic FSM word problem). The machine accepts nickels (N, 5¢) and dimes (D, 10¢), one coin per clock. When the total reaches 15¢ it releases a package of candy; if the total overshoots (20¢) it also returns 5¢ change. After release it returns to the starting state. The handwritten notes design exactly this as the "design application" of FSM theory.

Moore view — 5 states. States are totals: 0¢, 5¢, 10¢, plus release states 15¢ (output candy = 1) and 20¢ (candy = 1 and change = 1). Transitions add the coin value; S15 and S20 return to S0 unconditionally. This version is the cleanest to explain because the outputs sit inside the circles.

0¢05¢010¢015¢120¢1 + changeNDNDDNcandy → resetcandy + 5¢ back → reset15¢ candy machine (Moore) — N = nickel, D = dime; S15/S20 release, then return to 0¢
15¢ candy machine — totals as Moore states; green edges release and reset. Credit: original drawing for these notes (after the handwritten Unit-4 deck).

Implementable version — Mealy, 3 states, 2 FFs. Since "candy" fires on the release edge, a Mealy output works: states 0¢, 5¢, 10¢ with codes 00, 01, 10; inputs N and D (one-hot, never both 1 — treat N·D as don't-care). Transitions: 0¢ —N→ 5¢, 0¢ —D→ 10¢; 5¢ —N→ 10¢, 5¢ —D→ release (z = 1, back to 0¢); 10¢ —N→ release (z = 1), 10¢ —D→ release with change (z = 1, c = 1). The excitation table (6 used rows + 2 don't-care input rows) reduces to machine-checked equations:

D₁ = Q₁′(Q₂′D + Q₂N)  ·  D₂ = Q₁′Q₂′N
z = Q₁(N + D) + Q₁′Q₂D  ·  c = Q₁Q₂′D

Scenario checks (script-verified). N,N → 10¢, no candy yet; N,D or D,N or N,N,N → candy, no change; D,D or N,N,D → candy plus 5¢ change. The machine never reaches an illegal total because 20¢ is the only possible overshoot and the change edge handles it.

Worked problem
Design the FSM of a 15¢ vending machine that accepts nickels (N) and dimes (D), releases candy at 15¢ and returns 5¢ change on a 20¢ total.
States 0¢/5¢/10¢ (codes 00/01/10) as a Mealy machine — candy z fires on the release edge, change c only on the 10¢ + D edge. Excitation table 6 rows (N·D = 11 as X); K-maps give D₁ = Q₁′(Q₂′D + Q₂N), D₂ = Q₁′Q₂′N, z = Q₁(N+D) + Q₁′Q₂D, c = Q₁Q₂′D. Verify: N,N,D → z = 1 and c = 1 (20¢); N,D → z = 1, c = 0 (15¢ exact). Draw the Moore 5-state diagram first if the question asks for both views.

12Flip-flop conversion — one FF from another

The method. Sometimes you have SR flip-flops in the drawer but the design asks for JK behaviour. Conversion wraps the given FF in a small gate layer so that the pair behaves like the desired FF. The recipe builds a conversion table: take the desired FF's truth table (J, K, Q, Q+), look up the required (given-FF input) values for each transition in the given FF's excitation table, then K-map the new inputs in terms of the desired FF's inputs and Q. It is exactly the design recipe of section 8 with one flip-flop as the "machine".

JKS = J·Q′R = K·QSRQQSRCLKQQ̄the two AND gates make an SR flip-flop behave exactly like a JK
The finished SR→JK conversion: two AND gates steer J and K into S and R. Credit: original drawing for these notes (after the lecture deck "Conversion of SR flip-flop to JK flip-flop", Mano ch. 5).

Worked: SR → JK. Write the JK truth table (8 rows), and for each row ask "what S, R makes an SR FF do this?" using the SR excitation table (Q→Q needs S=0, R=X; Q→1 needs S=1, R=0; Q→0 needs S=0, R=1; 1→1 and 0→0 are the "no change" rows):

JKQQ₂SR
00000X
0011X0
01000X
011001
100110
1011X0
110110
111001

K-maps over (J, K, Q): S = 1 at rows 4, 6, 7 (Q = 0 side) → S = J·Q′; R = 1 at rows 3, 7 (Q = 1 side, K = 1) → R = K·Q. Both use the X entries to stay two literal AND gates. Sanity check the magic row J = K = 1, Q = 1: S = 1·0 = 0, R = 1·1 = 1 → reset — the SR pair toggles instead of going invalid. The conversion also repairs the forbidden SR condition: S = R = 1 becomes a toggle because S = JQ′ and R = KQ can never both be 1.

ConversionGatingNote
SR → JKS = JQ′, R = KQ11 becomes toggle, invalid state cured
SR → DS = D, R = D′one inverter
SR → TS = TQ′, R = TQT = 1 → toggle
D → JKD = JQ′ + K′QAND-OR layer
D → TD = T ⊕ Qone XOR gate
D → SRD = S + R′QSR characteristic as data
JK → TT = JQ′ + KQJ=K=1 → T = 1 → toggle
JK → SRJ = S, K = RSR’s 11 now toggles (JK side effect)
T → DT = D ⊕ QXOR layer

Every row of this table is brute-force verified in the companion script — each converted pair reproduces the desired characteristic table on all 8 input combinations (with the SR "11" row handled as toggle/invalid where noted).

Worked problem
Why is one flip-flop converted to another type, and which tables drive the process?
Practical designs may stock only one FF type while the logic (or the exam!) calls for another; conversion wraps the available FF in gates so it emulates the wanted one. The process uses the desired FF's truth table joined with the available FF's excitation table to form a conversion table; K-maps then express the available FF's inputs in terms of the desired FF's inputs and Q. Example: SR→JK gives S = JQ′, R = KQ.
Worked problem
Derive the SR → JK conversion completely (table + K-maps + circuit).
Build the 8-row conversion table (JK truth table + SR excitation entries, as tabulated above); two K-maps over (J, K, Q) give S = JQ′ (cells 100, 110, 111 + X’s) and R = KQ (cells 011, 111 + X’s). Circuit: J ANDed with Q′ into S, K ANDed with Q into R of the SR FF. Cross-check J = K = 1: Q = 0 → set (Q+ = 1), Q = 1 → reset (Q+ = 0) — toggling, exactly JK behaviour, and the SR invalid input pair can no longer occur.
Worked problem
Derive (a) the D → T conversion and (b) the JK → D conversion.
(a) A T FF must toggle when T = 1: with a D FF, D = Q ⊕ Q+ = Q ⊕ (T ⊕ Q) — but simpler: Q+ = T ⊕ Q must equal D, so D = T ⊕ Q (one XOR). Check T = 1: D = Q′ → toggles; T = 0: D = Q → holds. (b) A D FF stores whatever is on D; to emulate JK, D = JQ′ + K′Q — the JK characteristic equation itself becomes the D input. Check: J = K = 1 → D = Q′ (toggle); J = K = 0 → D = Q (hold); J = 1, K = 0 → D = 1 (set); J = 0, K = 1 → D = 0 (reset).

13Hamming code — detect and correct single-bit errors

The idea. R. W. Hamming's code stores data together with parity bits (redundant bits) so that any single-bit error can be located and corrected. Data of k bits gets p parity bits, total n = k + p — written as an (n, k) code. The parity bits sit at power-of-two positions (1, 2, 4, 8, …) and each one parity-checks a group of positions: parity bit Pₖ checks every position whose binary representation contains 2i. Position numbers are the convention here: D3 means "the data bit standing at position 3".

Sizing rule: 2p ≥ p + k + 1  (p parity bits must cover p positions, k data positions and the "no error" case).
k = 4: 2³ = 8 ≥ 3 + 4 + 1 = 8 ✓ → p = 3, n = 7 — the (7, 4) code.
k = 5: 2⁴ = 16 ≥ 4 + 5 + 1 = 10 ✓ → p = 4, n = 9 — the (9, 5) code.

(7, 4) layout and parity groups. Positions 1–7: P1, P2, D3, P4, D5, D6, D7. Each group must have even parity:

P1 = D3 ⊕ D5 ⊕ D7   (positions 1,3,5,7 — xx1)
P2 = D3 ⊕ D6 ⊕ D7   (positions 2,3,6,7 — x1x)
P4 = D5 ⊕ D6 ⊕ D7   (positions 4,5,6,7 — 1xx)

Encoding example (7, 4). Data 1011 → D3 = 1, D5 = 0, D6 = 1, D7 = 1. P1 = 1⊕0⊕1 = 0; P2 = 1⊕1⊕1 = 1; P4 = 0⊕1⊕1 = 0. Codeword (positions 1→7) = 0110011. Each group now holds an even number of 1s — that invariant is the whole code.

Correction. On reception, recompute each parity check (a XOR over the same group); the three check bits C₄C₂C₁ form the syndrome — a binary number that is 0 when the word is clean and otherwise names the erroneous position. Flip that bit; the data is recovered. The handwritten notes' example: received 1110101 (positions 7→1). C1 = 1⊕1⊕1⊕1 = 0, C2 = 0⊕1⊕1⊕1 = 1, C4 = 0⊕1⊕1⊕1 = 1 → syndrome 110₂ = 6: the 6th bit is wrong. Flip it: 1010101 — data bits (positions 7,6,5,3) = 1011. All 16 codewords × 7 single-error positions verified by script.

(9, 5) encoding — the notes' own example. Data 01101 (5 bits) needs p = 4, n = 9: positions 9→1 hold D9, P8, D7, D6, D5, P4, D3, P2, P1 with P1 = D3⊕D5⊕D7⊕D9, P2 = D3⊕D6⊕D7, P4 = D5⊕D6⊕D7, P8 = D9. Fill D9 = 0, D7 = 1, D6 = 1, D5 = 0, D3 = 1: P1 = 1⊕0⊕1⊕0 = 0, P2 = 1⊕1⊕1 = 1, P4 = 0⊕1⊕1 = 0, P8 = 0 → final code (positions 9→1) = 001100110 — exactly the handwritten notes' answer.

Worked problem
What is a Hamming code? State the condition the parity bits must satisfy.
A Hamming code is an error-correcting code that appends p parity bits to k data bits (total n = k + p, written (n, k)) so that any single-bit error can be detected and corrected by a syndrome. Parity bits occupy power-of-two positions and each checks a distinct binary subgroup of positions. The sizing condition is 2p ≥ p + k + 1; e.g. k = 4 → p = 3 → the (7, 4) Hamming code.
Worked problem
Encode data 1011 into a (7, 4) Hamming codeword.
Place data at positions 3, 5, 6, 7: D3 = 1, D5 = 0, D6 = 1, D7 = 1. Compute P1 = D3⊕D5⊕D7 = 0, P2 = D3⊕D6⊕D7 = 1, P4 = D5⊕D6⊕D7 = 0. Codeword positions 1→7 = 0110011. Verify: group 1 {1,3,5,7} = 0,1,0,1 (even ✓); group 2 {2,3,6,7} = 1,1,1,1 (even ✓); group 4 {4,5,6,7} = 0,0,1,1 (even ✓).
Worked problem
The received Hamming (7, 4) word is 1110101 (even parity). Detect and correct the error.
Read positions 7→1 = 1,1,1,0,1,0,1. Check bits: C1 = pos1⊕pos3⊕pos5⊕pos7 = 0; C2 = pos2⊕pos3⊕pos6⊕pos7 = 1; C4 = pos4⊕pos5⊕pos6⊕pos7 = 1. Syndrome C₄C₂C₁ = 110₂ = 6 → bit 6 is in error. Flip position 6: corrected word 1010101, from which the data bits (positions 7, 6, 5, 3) = 1011.
Worked problem
Represent the 5-bit data 01101 in Hamming code (9, 5) and show the correction of a single-bit error in the stored word.
k = 5 → 2⁴ = 16 ≥ 4 + 5 + 1 → p = 4, n = 9. Positions 9→1: D9 P8 D7 D6 D5 P4 D3 P2 P1 = 0, ?, 1, 1, 0, ?, 1, ?, ?. Parity: P1 = D3⊕D5⊕D7⊕D9 = 0, P2 = D3⊕D6⊕D7 = 1, P4 = D5⊕D6⊕D7 = 0, P8 = D9 = 0 → 001100110. Now corrupt bit 1 (P1 flips): received 001100111. Syndrome: C1 = 1⊕1⊕0⊕1⊕0 = 1, C2 = 1⊕1⊕1⊕1 = 0, C4 = 0⊕0⊕1⊕1 = 0, C8 = 0⊕0 = 0 → syndrome 0001 = 1 → bit 1 (a parity bit) was hit; flip it back. Data 01101 is intact — a neat demonstration that parity-bit errors are corrected without touching the data.

14Adder delay — ripple-carry vs carry look-ahead

Where ripple time goes. In an n-bit ripple-carry adder each full adder cannot finish until its carry-in settles, and each carry needs two gate delays (carry = a·b + (a⊕b)·Cₗ: one AND, one OR). Carries therefore crawl stage by stage:

C₁ = 2 · C₂ = 4 · C₃ = 6 · C₄ = 8 gate delays  →  Cₗ = 2n
sum bits: s₀ = 2, s₁ = 3, s₂ = 5, s₃ = 7  →  last sum sₗ₋₁ = 2n − 1
overflow V = Cₗ₋₁ ⊕ Cₗ is ready at 2n + 1 gate delays
Ripple-carry addercarry crawls stage by stageFA0a0b0s0FA1a1b1s1FA2a2b2s2FA3a3b3s3C₀C₄C₁→2 · C₂→4 · C₃→6 · C₄→8 gate delaysworst case grows linearly: 2n gate delaysCarry look-ahead adderall carries solved in parallelP3 · G3stage 3a3b3P2 · G2stage 2a2b2P1 · G1stage 1a1b1P0 · G0stage 0a0b0one look-ahead block emits C1..C4 togetherPi = ai ⊕ bi Gi = aibiCi+1 = Gi + PiCiexpand the recursion → every C is a2-level AND-OR of P, G, C0C₄ after ~3 delays, every sum by 4
Top: the ripple chain — C₀ enters at the LSB side and C₄ leaves after 8 gate delays. Bottom: the look-ahead structure — one block solves every carry in parallel. Credit: original drawing for these notes.

The look-ahead idea. Each stage announces two signals: generate Gₗ = aₗ·bₗ ("this stage creates a carry no matter what comes in") and propagate Pₗ = aₗ ⊕ bₗ ("this stage forwards an incoming carry"). The carry recursion Cₗ₊₁ = Gₗ + PₗCₗ then unrolls into flat two-level AND-OR expressions, so every carry is computed simultaneously:

C₁ = G₀ + P₀C₀
C₂ = G₁ + P₁G₀ + P₁P₀C₀
C₃ = G₂ + P₂G₁ + P₂P₁G₀ + P₂P₁P₀C₀
C₄ = G₃ + P₃G₂ + P₃P₂G₁ + P₃P₂P₁G₀ + P₃P₂P₁P₀C₀
sₗ = Pₗ ⊕ Cₗ

Delay accounting. P and G form after 1 gate delay; the two-level AND-OR gives every C after 2 more; each sum is one XOR after its carry. So C₄ is ready after ~3 gate delays and all sums by ~4 — independent of width, against the ripple's 2n − 1 = 7…8. The price: the AND-OR gates grow wider (fan-in n+1 for Cₗ), so real 64-bit adders cascade 4-bit look-ahead blocks — but each block still beats ripple. The script verifies all 256 (a, b) pairs: the unrolled carries are bit-identical to the ripple carries.

Worked problem
Define the propagate and generate signals used in a carry look-ahead adder.
For stage i: generate Gₗ = aₗ·bₗ (stage i creates a carry regardless of carry-in) and propagate Pₗ = aₗ ⊕ bₗ (stage i passes an incoming carry to the next stage). The carry recursion Cₗ₊₁ = Gₗ + PₗCₗ unrolls into 2-level AND-OR logic, letting all carries be produced in parallel after 2 gate delays following P/G formation.
Worked problem
How many gate delays does an n-bit ripple-carry adder need? Give the 4-bit figures.
Each carry stage costs 2 gate delays (AND + OR), so the final carry out is ready after Cₗ = 2n gate delays and the last sum bit after 2n − 1 (it needs one extra XOR after its carry). For 4 bits: C₄ = 8, s₃ = 7 gate delays; overflow (C₃ ⊕ C₄) takes 2n + 1 = 9. The delay grows linearly with width — the motivation for carry look-ahead.
Worked problem
Derive the carry look-ahead equations for a 4-bit adder and compare the delay with a ripple-carry adder.
With Pₗ = aₗ⊕bₗ, Gₗ = aₗbₗ and Cₗ₊₁ = Gₗ + PₗCₗ, substitute repeatedly to get C₁, C₂, C₃, C₄ as flat AND-OR sums of (G, P, C₀) — as boxed above; each is at most 5 product terms of fan-in up to 5. Timing: P/G = 1 gate delay; all carries +2; sums +1 XOR → ~3 gate delays to C₄, ~4 to every sum, versus ripple’s 8/7 — and the gap widens with width (ripple 2n vs CLA O(log n) across cascaded blocks). Verification: all 256 input pairs give identical carries in both schemes.
Worked problem
Design a 4-bit carry look-ahead adder: block diagram, carry equations, delay count; explain the advantage over ripple and what is traded away.
Structure: four P/G stages (XOR + AND each) feeding one look-ahead block that outputs C₁…C₄ from the boxed equations; sums sₗ = Pₗ ⊕ Cₗ. Delays: P/G 1, carries 3, sums 4 gate delays — constant with width. Ripple: C₄ = 8, s₃ = 7. Trade-off: fan-in and gate count grow linearly inside the look-ahead block (C₄ needs a 5-input AND-OR), so practical wide adders cascade 4-bit CLA blocks, still roughly halving the critical path at every level.

15Design — the 2-bit multiplier

Set the problem. Multiply A₁A₀ × B₁B₀ → product P₃P₂P₁P₀ (2+2 bits multiply to 4). Write the four partial products exactly as in long multiplication: A₀B₀ (weight 1), A₁B₀ and A₀B₁ (weight 2), A₁B₁ (weight 4). The weight-2 column can produce a carry into weight 4 — that carry chain is what the half adders absorb.

P₀ = A₀B₀
HA₁(A₁B₀, A₀B₁): sum = P₁, carry = C₁
HA₂(C₁, A₁B₁): sum = P₂, carry = C₂ = P₃
→ P₃P₂P₁P₀ = A₁A₀ × B₁B₀  (verified for all 16 input pairs)
A₁B₀A₀B₁HA 1half adderP₁C₁HA 2half adderP₂P₃ = C₂P₀A₁A₀ × B₁B₀ = P₃P₂P₁P₀ — two half-adders + three AND pairs
The multiplier: three AND pairs (P₀ uses its own AND), two half-adders chaining the weight-2 carry into weight-4. Credit: original drawing for these notes (after the handwritten Unit-4 deck, "2-bit multiplier").

Worked check (10 × 11). A = 10₂ (2), B = 11₂ (3) → product must be 6 = 0110₂. P₀ = 0·1 = 0; A₁B₀ = 1·1 = 1, A₀B₁ = 0·1 = 0 → HA₁ gives P₁ = 1, C₁ = 0; A₁B₁ = 1·1 = 1 → HA₂(0, 1) gives P₂ = 1, C₂ = 0 → P₃ = 0. Output 0110 ✓. The heavy case is 11 × 11 = 9 = 1001: P₀ = 1; HA₁(1, 1) → P₁ = 0, C₁ = 1; HA₂(1, 1) → P₂ = 0, P₃ = 1 → 1001 ✓.

Why half adders suffice. No weight column ever sums three bits: weight 1 has one term, weight 2 has two terms (one HA), weight 4 has C₁ and A₁B₁ (one HA) — the second carry out of weight 4 lands in weight 8 as P₃ directly. That observation (no full adder needed) is the insight markers want spelled out.

Worked problem
Write the logic expressions of a 2-bit multiplier (A₁A₀ × B₁B₀ = P₃P₂P₁P₀).
P₀ = A₀B₀; P₁ = (A₁B₀) ⊕ (A₀B₁) with carry C₁ = (A₁B₀)(A₀B₁); P₂ = C₁ ⊕ (A₁B₁) with P₃ = C₁ · (A₁B₁). Hardware: three AND pairs + two half adders; verified on all 16 combinations.
Worked problem
Design the 2-bit × 2-bit multiplier: derive every product bit, draw the circuit, and verify with 10 × 11.
Partial products as above; HA₁ adds the two weight-2 terms (P₁ sum, C₁ carry), HA₂ adds C₁ to the weight-4 term (P₂ sum, P₃ = carry). Circuit: 3 AND pairs (plus the P₀ AND) and 2 HAs. Check 10 × 11: 0·1 = 0 = P₀; HA₁(1, 0) → P₁ = 1, C₁ = 0; HA₂(0, 1) → P₂ = 1, P₃ = 0 → 0110 = 6 = 2 × 3 ✓. Worst case 11 × 11 → 1001 = 9 ✓.

16Unit-4 formula sheet (copy these lines)

ItemFormula / rule
State-table size2m+n rows (m FFs, n inputs); grouped form: 2m
FF characteristic eqsQ+ = S + R′Q · Q+ = D · Q+ = JQ′ + K′Q · Q+ = T ⊕ Q
Equivalence (reduction)same outputs + equivalent next states for every input → merge rows
FF count⌈log₂(states)⌉; one-hot: 1 FF per state
Excitation inputsD = Q+ · T = Q ⊕ Q+ · JK/SR from excitation table
110 Mealy (overlap)D₁ = xQ₂, D₂ = x, y = x′Q₁Q₂ (S0=00,S1=01,S2=11)
0111 MooreD₁ = xQ₂Q₃′, D₂ = xQ₁′Q₃, Q₃₂ = x′ + Q₂′Q₃, y = Q₁Q₂′Q₃′
Vending (15¢)D₁ = Q₁′(Q₂′D + Q₂N), D₂ = Q₁′Q₂′N, z = Q₁(N+D) + Q₁′Q₂D, c = Q₁Q₂′D
ConversionsS = JQ′, R = KQ · D = JQ′ + K′Q · D = T ⊕ Q · T = JQ′ + KQ
Hamming sizing2p ≥ p + k + 1; (7,4): P1 = D3⊕D5⊕D7, P2 = D3⊕D6⊕D7, P4 = D5⊕D6⊕D7
SyndromeC₄C₂C₁ = 0 clean; otherwise = position of the wrong bit
Ripple delayCₗ = 2n, sₗ₋₁ = 2n − 1, overflow = 2n + 1 gate delays
CLAPₗ = aₗ⊕bₗ, Gₗ = aₗbₗ, Cₗ₊₁ = Gₗ + PₗCₗ; C₄ ≈ 3, sums ≈ 4 gate delays
2-bit multiplierP₀ = A₀B₀; P₁/C₁ = HA(A₁B₀, A₀B₁); P₂/P₃ = HA(C₁, A₁B₁)