Tabular Minimisation, Hazards, and Designing Sequential Circuits (Mealy, Moore, Counters)

Digital Logic names three things the first two chapters used but never taught as methods: the tabular technique of minimisation, the design of sequential circuits, and — implicit in 'design' — the timing flaw called a hazard. The Karnaugh map is a picture of the same idea as the Quine–McCluskey tabular method: merge minterms that differ in one bit, repeat until nothing merges (those survivors are the prime implicants), then choose a smallest set of primes that covers every required minterm. The map stops being usable above four or five variables; the table is an algorithm and so it is what a program does. A hazard is a spurious pulse in a combinational output when one input changes — it is the cost of a cover that leaves two adjacent 1s in different product terms, and adding the consensus term removes it. Sequential design is a pipeline of decisions: a state diagram, a state table, a minimised state set, an assignment of bits to states and excitation equations for the chosen flip-flop, with Mealy (output depends on state and input) and Moore (output on state alone) as the two output styles. Every result here was checked by program: the tabular method below recovers 6 prime implicants for a ten-minterm function and the minimal cover has 3 terms with 7 literals; the Mealy '101' detector needs 3 states and the Moore one 4, both tested against a reference on 16000 input bits; a mod-6 counter needs only T₀ = 1, T₁ = Q₂′Q₀, T₂ = Q₀(Q₁ + Q₂).
Overview

The Quine–McCluskey Tabular Method

2 min read · 2 parts

Procedure. (1) List every minterm (and every don't-care) in binary and group by the number of 1s. (2) Compare each group with the next one up; two terms that differ in exactly one bit merge into a term with a dash in that position, and both are ticked as used. (3) Repeat on the merged terms until no pair merges. Every term that was never ticked is a prime implicant (PI). (4) Draw the PI chart: rows are PIs, columns are the required minterms (don't-cares are not columns, they only helped merging). (5) A column with a single × marks an essential PI; take all of them, then cover what is left with the fewest further PIs (Petrick's method if choices remain). Worked function: f(A,B,C,D) = Σm(0, 1, 2, 5, 6, 7, 8, 9, 10, 14). The first column groups by weight: 0 ones: 0000 · 1 ones: 0001, 0010, 1000 · 2 ones: 0101, 0110, 1001, 1010 · 3 ones: 0111, 1110. The merging ends with 6 primes: A'C'D (1,5); A'BD (5,7); A'BC (6,7); B'C' (0,1,8,9); B'D' (0,2,8,10); CD' (2,6,10,14). The essential ones are B'C', CD', and a minimal cover is f = B'C' + CD' + A'BD (3 terms, 7 literals), checked against the truth table for all 16 inputs.

Don't-cares. Include them when forming the table (they let more terms merge into bigger groups) but leave them out of the chart's columns. Example: f = Σm(1, 3, 7, 11, 15) + d(0, 2, 5) reduces to CD + A'B'. Cost. The number of prime implicants of an n-variable function can reach 3ⁿ/n, so the method is exponential in the worst case — fine for a computer at tens of variables, hopeless by hand beyond five or six, where Espresso-style heuristics replace it. The K-map and the table give the same primes; the K-map's grouping rule (largest rectangles of 1s, wrapping round the edges) is the table's merging done visually. For a product-of-sums answer, minimise the complement (or the 0s) and invert.

StepActionResult
1Group minterms by count of 1scolumns of weight 0…n
2Merge terms differing in one bitdashes appear
3Repeat; unticked terms are primesprime implicants
4Chart primes × required mintermsessential primes found
5Cover the rest with fewest primesminimal SOP

Procedure. (1) List every minterm (and every don't-care) in binary and group by the number of 1s. (2) Compare each group with the next one up; two terms that differ in exactly one bit merge…

Hazards: Static, Dynamic and the Consensus Term

1 min read · 2 parts

A static-1 hazard is a momentary 0 on an output that should stay at 1 when a single input changes; a static-0 hazard is a momentary 1 on an output that should stay 0; a dynamic hazard is several transitions where one is intended, and needs three or more levels of logic. They are caused by unequal path delays: for an instant one product term has switched off before the other has switched on. In an SOP circuit the cause is two adjacent 1s on the K-map that are covered by different product terms with no term covering both. Example: F = AB′ + BC. With A = C = 1 and B changing, F is 1 before and after, but the two minterms 101 and 111 are covered by AB′ and BC respectively (the program lists the uncovered adjacent pair: 101–111). Adding the consensus term AC covers both, so F = AB′ + BC + AC has no static-1 hazard and the function is unchanged (verified for all 8 inputs). The rule: to be free of static-1 hazards (single input change), every pair of adjacent 1s must lie inside some product term; a product-of-sums circuit has the dual problem, static-0 hazards, cured by adding a redundant sum term.

🎯 The paradox: the minimal circuit is the hazardous one
Minimisation removes exactly the redundant consensus terms that guard against glitches. That is why asynchronous and clock-generation logic is deliberately built with the non-minimal, hazard-free cover, while synchronous logic can ignore hazards entirely — a glitch that settles before the next clock edge is never sampled.
Three kinds of hazard
HazardsCaused by unequal path delays
  • Static-1Momentary 0 where output stays 1
  • Static-0Momentary 1 where output stays 0
  • DynamicSeveral transitions where one is intended

A static-1 hazard is a momentary 0 on an output that should stay at 1 when a single input changes; a static-0 hazard is a momentary 1 on an output that should stay 0; a dynamic hazard is…

Mealy and Moore Machines, and State Minimisation

2 min read · 3 parts

A Moore machine's output is a function of the state only, so it is attached to the state circle and changes only at a clock edge. A Mealy machine's output is a function of state and current input, attached to the transition arrow, so it can react within the same cycle and — because the input is asynchronous to the clock — can glitch or change mid-cycle. Any Mealy machine can be converted to a Moore machine, usually at the cost of more states (at most a multiplication by the number of distinct outputs). Take the overlapping '101' detector (output 1 when the last three inputs are 1, 0, 1). Mealy: 3 states — S0 (no progress), S1 (seen 1), S2 (seen 10); in S2 an input 1 gives output 1 and goes to S1 because the final 1 can start a new match. Moore: 4 states — the extra state S3 ('seen 101') carries the 1. The program ran both against a direct check of the last three bits on 16000 random input bits with no mismatch. The number of flip-flops is ⌈log₂(states)⌉: 2 for either machine.

Present stateNext state (x = 0 / x = 1)Mealy output (x = 0 / x = 1)
S0S0 / S10 / 0
S1S2 / S10 / 0
S2S0 / S10 / 1

State minimisation. Two states are equivalent if no input sequence can tell them apart (same outputs, equivalent successors). The partition method starts with states grouped by identical outputs and refines the groups by successor groups until stable; the surviving blocks are the minimal machine. Fewer states can mean fewer flip-flops and always means less next-state logic. For an incompletely specified machine (don't-care entries) minimisation uses compatibility instead, and is harder because compatibility is not transitive.

Moore vs Mealy
Moore
  • Output from state only
  • Attached to the state circle
  • Changes only at a clock edge
Mealy
  • Output from state and input
  • Attached to the transition arrow
  • Reacts in the same cycle; can glitch
State minimisation by partition
  1. Group states by identical outputs
  2. Refine groups by successor groups
  3. Repeat until stable
  4. Surviving blocks: minimal machine

A Moore machine's output is a function of the state only, so it is attached to the state circle and changes only at a clock edge. A Mealy machine's output is a function of state and current…

Excitation Tables and Designing a Counter

2 min read · 1 part

For each flip-flop choose the inputs that produce the wanted transition Q → Q⁺ (the excitation table): D: D = Q⁺. T: T = Q ⊕ Q⁺. JK: 0→0 gives J = 0, K = x; 0→1 gives J = 1, K = x; 1→0 gives J = x, K = 1; 1→1 gives J = x, K = 0 — the many don't-cares are why JK designs often need less logic than D. SR: 0→0: S = 0, R = x; 0→1: S = 1, R = 0; 1→0: S = 0, R = 1; 1→1: S = x, R = 0, with S = R = 1 forbidden. Design a synchronous mod-6 counter (0, 1, 2, 3, 4, 5, 0, …) with T flip-flops. Three bits Q₂Q₁Q₀, unused states 6 and 7 as don't-cares. Bit 0 toggles on every clock: T₀ = 1. Bit 1 changes on 1→2, 3→4 and nowhere else, so it toggles from states 1 and 3 (001, 011) and must not toggle from 5 (101) — with don't-cares, T₁ = Q₂′Q₀. Bit 2 changes on 3→4 and 5→0, so it toggles from 3 (011) and 5 (101): T₂ = Q₀(Q₁ + Q₂), using the don't-care at 7. A program stepped all six states through these equations and confirmed the sequence 0 → 1 → 2 → 3 → 4 → 5 → 0.

Flip-flopExcitation for Q → Q⁺Typical use
DD = Q⁺registers, state machines
TT = Q ⊕ Q⁺counters
JK0→1: J=1,K=x; 1→0: J=x,K=1most don't-cares, least logic
⚠️ Unused states are not free
Treating unused states as don't-cares shrinks the logic, but you must then check where the circuit goes if it powers up in one (here 6 or 7): from 6 (110) the equations give T₂ = 0, T₁ = 0, T₀ = 1 → 7, and from 7 (111) T₂ = 1, T₁ = 0, T₀ = 1 → 010 = 2, so it self-corrects into the valid cycle. A design that does not self-correct (a lock-up state) needs one more term, or a reset.

For each flip-flop choose the inputs that produce the wanted transition Q → Q⁺ (the excitation table): D: D = Q⁺. T: T = Q ⊕ Q⁺. JK: 0→0 gives J = 0, K = x; 0→1 gives J = 1, K = x; 1→0…

Key takeaways

  • Quine–McCluskey: group minterms by number of 1s, merge pairs differing in one bit, unticked terms are prime implicants; take essential primes from the chart, then cover the rest; don't-cares help merging but are not chart columns.
  • A static-1 hazard exists when two adjacent 1s are not inside a common product term; the consensus term (e.g. AC for AB′ + BC) removes it. The minimal SOP is the one that can glitch.
  • Moore output depends on state only; Mealy on state and input, usually with fewer states (3 against 4 for the overlapping 101 detector); flip-flops = ⌈log₂ states⌉.
  • Excitation: D = Q⁺; T = Q ⊕ Q⁺; JK has 0→1: J=1,K=x and 1→0: J=x,K=1. A mod-6 counter with T flip-flops needs T₀ = 1, T₁ = Q₂′Q₀, T₂ = Q₀(Q₁ + Q₂).
  • Unused states used as don't-cares must be checked for lock-up; here 6 and 7 both return to the valid cycle on the next clock.

Practice questions (24)

Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.

  1. In the Quine–McCluskey method, which terms are prime implicants?

    1. all original minterms
    2. only terms covering a single minterm
    3. terms that could not be merged further (never ticked)
    4. only terms with the fewest 1s
    Show answer

    Answer: C — terms that could not be merged further (never ticked)

    A term that merges with another is covered by the bigger term, so only the terms left unticked after all merging are prime. Some may be a single minterm, but most are merged groups.
  2. Two minterms can be combined in one step of the tabular method if they:

    1. differ in two bit positions
    2. are both don't-cares
    3. differ in exactly one bit position
    4. have the same number of 1s
    Show answer

    Answer: C — differ in exactly one bit position

    Merging is the algebraic step xy + xy′ = x: terms must differ in a single variable. Terms with the same number of 1s differ in at least two bits and are never compared, which is why grouping by weight helps.
  3. How many prime implicants does f(A,B,C,D) = Σm(0, 1, 2, 5, 6, 7, 8, 9, 10, 14) have?

    Numerical answer — type the value.

    Show answer

    Answer: 6

    Running the tabular procedure to completion leaves 6 unticked terms: A'C'D (1,5); A'BD (5,7); A'BC (6,7); B'C' (0,1,8,9); B'D' (0,2,8,10); CD' (2,6,10,14). A minimal cover uses 3 of them.
Show the other 21 questions
  1. A static-1 hazard in a two-level AND–OR circuit arises when:

    1. two adjacent 1s on the K-map are covered by different product terms and no single term covers both
    2. the circuit uses NAND gates only
    3. the output has more than one minterm
    4. two adjacent 0s are covered by different sum terms
    Show answer

    Answer: A — two adjacent 1s on the K-map are covered by different product terms and no single term covers both

    When the input moves between those two minterms, one product term falls before the other rises, leaving a brief 0. Adding the consensus term covering both removes the hazard. The adjacent-0s version is the static-0 hazard of a POS circuit.
  2. The consensus term of AB′ + BC is:

    1. AB
    2. B'C
    3. A'C
    4. AC
    Show answer

    Answer: D — AC

    The consensus of two terms that contain a variable in opposite forms (here B in BC and B′ in AB′) is the product of their remaining literals, A·C. Adding AC does not change the function (AB′ + BC + AC = AB′ + BC) but covers the adjacent 1s 101 and 111.
  3. Which statement distinguishes a Moore machine from a Mealy machine?

    1. Moore outputs depend on state and input
    2. Moore outputs depend only on the present state
    3. Moore machines always need fewer states
    4. Moore machines have no state register
    Show answer

    Answer: B — Moore outputs depend only on the present state

    Moore output = f(state); Mealy output = f(state, input). The Mealy form usually needs fewer states (3 against 4 for the overlapping 101 detector) but its output can change between clock edges.
  4. A Moore sequence detector for the overlapping pattern 101 needs how many states?

    1. 3
    2. 5
    3. 4
    4. 2
    Show answer

    Answer: C — 4

    States: no progress, seen 1, seen 10, seen 101 (the output state). The Mealy version drops the last because the output can sit on the transition. Four states need two flip-flops, as three do.
  5. In a synchronous mod-6 counter (0 to 5) with T flip-flops, with states 6 and 7 as don't-cares, the toggle input T₁ is:

    1. Q₂Q₀
    2. 1
    3. Q₂′Q₀
    4. Q₁ ⊕ Q₀
    Show answer

    Answer: C — Q₂′Q₀

    Bit 1 toggles on 1→2 and 3→4 only (from states 001 and 011), and must not toggle from 101. So T₁ = 1 for Q₀ = 1 with Q₂ = 0, i.e. T₁ = Q₂′Q₀. Bit 0 toggles always (T₀ = 1).
  6. A static-0 hazard is a condition in which:

    1. the output stays 0 forever
    2. the output should stay 1 but momentarily glitches to 0
    3. the output changes from 0 to 1 more slowly than expected
    4. the output should stay 0 but momentarily glitches to 1
    Show answer

    Answer: D — the output should stay 0 but momentarily glitches to 1

    A static-0 hazard is a brief 0 → 1 → 0 spike when the steady output should remain 0. The glitch to 0 on a steady 1 is the static-1 hazard, the tempting reversal.
  7. The minimum number of flip-flops required to implement a finite state machine with 9 states is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 4

    We need ⌈log₂ 9⌉ = 4 flip-flops, since 3 give only 8 states. Choosing 9 uses one flip-flop per state, which is one-hot, not minimal.
  8. An essential prime implicant is one that:

    1. contains no don’t-care minterms
    2. can be left out of every minimal cover
    3. covers at least one minterm that no other prime implicant covers
    4. covers the largest number of minterms
    Show answer

    Answer: C — covers at least one minterm that no other prime implicant covers

    If a minterm is covered by only one prime implicant, that implicant must appear in every cover. Merely being the largest does not make it essential.
  9. In the tabular (Quine–McCluskey) method the minterms are first grouped by the number of 1s in their binary form. Minterm 13 of a 4-variable function belongs to the group with _____ ones.

    Numerical answer — type the value.

    Show answer

    Answer: 3

    13 = 1101₂ contains three 1s, so it lies in group 3. Adding the index 1 of the digit gives the wrong count of 4.
  10. A static-1 hazard in a two-level AND–OR realisation is removed by:

    1. removing the largest prime implicant
    2. adding the redundant (consensus) prime implicant that bridges the adjacent 1-cells
    3. lowering the clock frequency
    4. replacing all gates by XOR gates
    Show answer

    Answer: B — adding the redundant (consensus) prime implicant that bridges the adjacent 1-cells

    The glitch occurs when two adjacent 1-cells are covered by different terms; a bridging redundant term keeps the output high. Slowing the clock does nothing for a purely combinational glitch.
  11. In state-table minimisation, two states are equivalent if for every input sequence they:

    1. have the same number of incoming arrows
    2. produce identical output sequences
    3. have identical state codes
    4. reach the same final state
    Show answer

    Answer: B — produce identical output sequences

    Equivalence is about indistinguishable output behaviour. Reaching the same final state is sufficient but not necessary, and codes are assigned only after minimisation.
  12. In the tabular method, the minterms 0100 and 0110 combine to give the implicant:

    1. 0−10
    2. 010−
    3. −100
    4. 01−0
    Show answer

    Answer: D — 01−0

    They differ only in the third bit, which is replaced by a dash: 01−0, i.e. A′B D′. The dash in the second position (0−10) would join 0010 and 0110 instead.
  13. A 3-variable function is f(A,B,C) = Σm(0, 1, 2, 5, 6, 7). The number of prime implicants is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 6

    The six 1-cells form a cycle on the K-map, and every adjacent pair is a prime implicant (A′B′, A′C′, B′C, AC, AB, BC′): 6 in all, none essential. Taking only 3 gives the size of a minimal cover.
  14. The minimum number of states in a Mealy machine that detects the overlapping sequence 1101 on a serial input is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 4

    A Mealy detector needs one state per proper prefix remembered (empty, 1, 11, 110): 4 states, because the output is raised on the transition that completes 1101. A Moore machine would need 5.
  15. The function f = AB + A′C is realised in two-level AND–OR form. With B = C = 1 and A changing from 1 to 0, the circuit can show:

    1. no hazard, because f stays 1 in a single product term
    2. a dynamic hazard
    3. a static-0 hazard
    4. a static-1 hazard
    Show answer

    Answer: D — a static-1 hazard

    Both before and after, f = 1, but AB drops as A′C rises, so a brief gap gives a 1 → 0 → 1 glitch; adding the term BC bridges it. There is no static-0 hazard because f stays 1 at both ends.
  16. In the excitation table of a JK flip-flop, the transition Q = 1 → Q⁺ = 0 requires:

    1. J = 0, K = 0
    2. J = 1, K = 1 only
    3. J = X (don’t care), K = 1
    4. J = 1, K = X
    Show answer

    Answer: C — J = X (don’t care), K = 1

    Resetting needs K = 1 with J free (K = 1 with J = 0 resets, with J = 1 toggles to 0). J = 1, K = X is the 0 → 1 transition.
  17. Four states of a machine are to be given distinct 2-bit codes (00, 01, 10, 11). The number of different one-to-one state assignments is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 24

    Assign 4 codes to 4 states in 4! = 24 ways (only 3 are distinct after relabelling flip-flops and complementing bits). Taking 4² = 16 would allow repeated codes.
  18. For f(A,B,C,D) = Σm(0, 2, 3, 4, 5, 7, 8, 10, 11, 13, 15), the number of essential prime implicants is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 2

    The six prime implicants are BD, B′D′, CD, B′C, A′C′D′ and A′BC′. Minterm 13 is covered only by BD and minterm 8 only by B′D′, so exactly 2 are essential. Counting all 6 treats every prime implicant as essential.
  19. A Mealy machine has states A–E with (next state / output) entries: A: 0→B/0, 1→C/0; B: 0→A/0, 1→D/1; C: 0→A/0, 1→E/1; D: 0→B/0, 1→C/0; E: 0→B/0, 1→C/0. The minimum number of states of an equivalent machine is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 2

    A, D and E have identical rows, so they merge. B and C have equal outputs and differ only in going to D versus E, which are now equivalent, so B ≡ C as well: 2 states. Stopping after the first merge gives 3, which misses the implied equivalence.
  20. A circuit realises f(A,B,C,D) = AB + A′C + BC′D in two-level AND–OR form. The number of pairs of adjacent input combinations (differing in one variable, both with f = 1) that are NOT covered by a single product term, and so can show a static-1 hazard, is _____.

    Numerical answer — type the value.

    Show answer

    Answer: 3

    Checking all single-bit-change pairs of 1-cells: (0101, 0111), (0110, 1110) and (0111, 1111) are not inside any one product, so 3 hazard pairs; they are bridged by A′BD, BCD′ and BC. Counting only the pair that changes A would give 2.
  21. Which of the following statements are correct? (More than one may be correct.)

    1. A two-level SOP circuit using all prime implicants has no static-1 hazard for single-input changes
    2. A two-level AND–OR circuit can show a static-0 hazard for a single-input change
    3. The output of a Moore machine depends only on the present state
    4. State minimisation never increases the number of states
    Show answer

    Answer: A — A two-level SOP circuit using all prime implicants has no static-1 hazard for single-input changes; C — The output of a Moore machine depends only on the present state; D — State minimisation never increases the number of states

    Using all prime implicants gives each adjacent pair of 1-cells a common term, and Moore outputs are functions of the state alone; minimisation only merges states. A two-level SOP has no static-0 hazard for single-input changes, because a product term cannot be 1 in both ends unless it stays 1 throughout, so the second statement is false.