The Quine-McCluskey Method
In previous articles, we simplified Boolean functions by using graphical Karnaugh maps. This article explains algorithmic logic minimization when graphical methods are impractical. Automated synthesis tools must minimize Boolean functions that contain dozens of input variables. Manual Karnaugh maps cannot display functions with more than five or six variables. The Quine-McCluskey method, developed by Willard Quine and Edward McCluskey, provides an exact, tabular algorithm for logic minimization.
Limitations of Karnaugh Maps
Karnaugh maps work effectively for up to four input variables. A five-variable map requires two separate 4×4 grids. A six-variable map requires four separate 4×4 grids. For higher variable counts, identifying spatial adjacencies becomes difficult and error-prone. The Quine-McCluskey algorithm automates this minimization process without requiring visual inspection.
Method Overview
The Quine-McCluskey algorithm consists of two sequential phases:
- Phase 1: Determine All Prime Implicants. The algorithm compares binary minterms and merges pairs that differ in exactly one variable position. The process repeats iteratively until no further terms can merge. Terms that cannot merge into larger groups are designated as prime implicants.
- Phase 2: Select the Minimum Cover. A prime implicant table compares candidate prime implicants against all required minterms. The algorithm selects the smallest set of prime implicants that covers all minterms.
Phase 1: Procedure for Finding Prime Implicants
Follow these procedural steps to find all prime implicants:
- Group Minterms by Binary Weight: Count the number of 1s in the binary representation of each minterm. Place minterms with the same number of 1s into the same group. Two minterms can differ by exactly one bit only if their 1-counts differ by one.
- Compare Adjacent Groups: Compare each term in group $k$ with every term in group $k+1$. If two terms differ in exactly one bit position, combine them into a merged term. Place a hyphen ($-$) in the differing bit position. Place a check mark next to both source terms to indicate that they have been covered.
- Iterate on Merged Terms: Repeat the comparison process on the newly generated terms. Two terms can merge only if their hyphens align in identical bit positions and they differ in exactly one binary bit. Continue until no further merges occur.
- Collect Unchecked Terms: Every term without a check mark is a prime implicant.
Worked Example
Consider the 4-variable Boolean function:
$$F(A, B, C, D) = \sum m(0, 1, 2, 5, 6, 7, 8, 9, 10, 13, 14, 15)$$
Variable $A$ is the most significant bit, and $D$ is the least significant bit.
Step 1: Group by Number of 1s
Table 1 organizes the minterms into groups according to their binary weight:
| 1s Count | Minterms |
|---|---|
| 0 | 0 (0000) |
| 1 | 1 (0001), 2 (0010), 8 (1000) |
| 2 | 5 (0101), 6 (0110), 9 (1001), 10 (1010) |
| 3 | 7 (0111), 13 (1101), 14 (1110) |
| 4 | 15 (1111) |
Step 2: First Merge
Compare adjacent groups. Pairs that differ by one bit produce a merged 2-cell term (Table 2):
| Source Minterms | Merged Representation |
|---|---|
| 0, 1 | 000- |
| 0, 2 | 00-0 |
| 0, 8 | -000 |
| 1, 5 | 0-01 |
| 1, 9 | -001 |
| 2, 6 | 0-10 |
| 2, 10 | -010 |
| 8, 9 | 100- |
| 8, 10 | 10-0 |
| 5, 7 | 01-1 |
| 5, 13 | -101 |
| 6, 7 | 011- |
| 6, 14 | -110 |
| 9, 13 | 1-01 |
| 10, 14 | 1-10 |
| 7, 15 | -111 |
| 13, 15 | 11-1 |
| 14, 15 | 111- |
Every minterm combines into at least one merged term. Therefore, no single minterm is a prime implicant.
Step 3: Second Merge
Compare terms from Table 2. Two terms combine if their hyphens match and their binary values differ by one bit (Table 3):
| Combined Sources | Merged Term | Covered Minterms |
|---|---|---|
| 000- and 100- | -00- | 0, 1, 8, 9 |
| 00-0 and 10-0 | -0-0 | 0, 2, 8, 10 |
| 0-01 and 1-01 | –01 | 1, 5, 9, 13 |
| 0-10 and 1-10 | –10 | 2, 6, 10, 14 |
| 01-1 and 11-1 | -1-1 | 5, 7, 13, 15 |
| 011- and 111- | -11- | 6, 7, 14, 15 |
Duplicate combinations are removed. All 2-cell terms merge into these 4-cell terms. No further merges are possible because no two 4-cell terms share identical hyphen positions.
Step 4: Final Prime Implicants
Table 4 lists the resulting prime implicants:
| Label | Binary Term | Covered Minterms | Algebraic Implicant |
|---|---|---|---|
| $P_1$ | -00- | 0, 1, 8, 9 | $\overline{B},\overline{C}$ |
| $P_2$ | -0-0 | 0, 2, 8, 10 | $\overline{B},\overline{D}$ |
| $P_3$ | –01 | 1, 5, 9, 13 | $\overline{C}D$ |
| $P_4$ | –10 | 2, 6, 10, 14 | $C\overline{D}$ |
| $P_5$ | -1-1 | 5, 7, 13, 15 | $BD$ |
| $P_6$ | -11- | 6, 7, 14, 15 | $BC$ |
Phase 2: Prime Implicant Table
Construct a table with rows for prime implicants and columns for minterms (Table 5):
| Implicant | 0 | 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| $P_1$ ($\overline{B},\overline{C}$) | X | X | X | X | ||||||||
| $P_2$ ($\overline{B},\overline{D}$) | X | X | X | X | ||||||||
| $P_3$ ($\overline{C}D$) | X | X | X | X | ||||||||
| $P_4$ ($C\overline{D}$) | X | X | X | X | ||||||||
| $P_5$ ($BD$) | X | X | X | X | ||||||||
| $P_6$ ($BC$) | X | X | X | X |
Scan the columns for minterms with a single X. In Table 5, every minterm column contains exactly two Xs. No column has a single X. Therefore, this function has no essential prime implicants. The table forms a cyclic core that requires an algebraic selection method.
Petrick’s Method
When a prime implicant table contains no essential prime implicants, Petrick’s method determines the exact minimum cover. Express each minterm column as a sum of prime implicants that cover it:
- Minterm 0: $(P_1 + P_2)$
- Minterm 1: $(P_1 + P_3)$
- Minterm 2: $(P_2 + P_4)$
- Minterm 5: $(P_3 + P_5)$
- Minterm 6: $(P_4 + P_6)$
- Minterm 7: $(P_5 + P_6)$
The remaining columns repeat these identical cover pairs. Multiply all sum terms into a product-of-sums expression:
$$P = (P_1 + P_2)(P_1 + P_3)(P_2 + P_4)(P_3 + P_5)(P_4 + P_6)(P_5 + P_6)$$
Applying Boolean distributive laws and absorption identities yields two minimal product terms:
$$P = P_1 P_4 P_5 + P_2 P_3 P_6$$
Both solutions contain three prime implicants and six literals:
$$F_1 = \overline{B},\overline{C} + C\overline{D} + BD$$
$$F_2 = \overline{B},\overline{D} + \overline{C}D + BC$$
Figures 1 and 2 show both minimal covers on the corresponding Karnaugh maps.
Both solutions are electrically and logically equivalent.
Algorithmic Synthesis and the Espresso Heuristic
The Quine-McCluskey method guarantees an exact minimum cover. However, its worst-case computational complexity grows exponentially ($O(3^n / n)$). Finding exact solutions for circuits with 20 or more variables becomes computationally prohibitive.
Modern Electronic Design Automation (EDA) synthesis tools (such as Yosys and Synopsys Design Compiler) use heuristic minimizers such as Espresso. Espresso uses multidimensional cube structures instead of string comparisons. It applies three iterative heuristic operations:
- EXPAND: Expands logic cubes to eliminate literals and find prime implicants.
- REDUCE: Shrinks overlapping cubes to escape local minima.
- IRREDUNDANT COVER: Eliminates redundant cubes from the cover set.
Espresso scales efficiently to hundreds of variables, supports multiple-output logic networks, and natively handles don’t-care spaces.
Table 6 summarizes the trade-offs between logic minimization techniques:
| Technique | Optimal Variable Range | Strengths | Limitations |
|---|---|---|---|
| Karnaugh Map | 2 to 4 variables | Fast manual visualization | Error-prone above 4 variables |
| Quine-McCluskey | 4 to 8 variables | Exact algebraic minimum | Exponential time and memory growth |
| Espresso Algorithm | 10 to 100+ variables | Scales to large industrial designs | Heuristic; does not guarantee absolute mathematical minimum |
Practice Exercise
Apply the Quine-McCluskey method to simplify the function:
$$F(A, B, C, D) = \sum m(1, 3, 5, 7, 9, 11)$$
View Solution
Step 1: Group by 1s:
- Group 1: $m_1$ (0001)
- Group 2: $m_3$ (0011), $m_5$ (0101), $m_9$ (1001)
- Group 3: $m_7$ (0111), $m_{11}$ (1011)
Step 2: First Merge:
- (1, 3) $\to$ 00-1
- (1, 5) $\to$ 0-01
- (1, 9) $\to$ -001
- (3, 7) $\to$ 0-11
- (5, 7) $\to$ 01-1
- (3, 11) $\to$ -011
- (9, 11) $\to$ 10-1
All six minterms are checked.
Step 3: Second Merge:
- (00-1) and (10-1) merge to
-0-1(covers 1, 3, 9, 11). - (0-01) and (0-11) merge to
0--1(covers 1, 3, 5, 7).
All 2-cell terms merge into these two 4-cell terms.
Step 4: Prime Implicants:
- $P_1 = -0-1 \implies \overline{B}D$
- $P_2 = 0–1 \implies \overline{A}D$
Step 5: Prime Implicant Table:
- Minterms 5 and 7 are covered only by $P_2$ ($\overline{A}D$).
- Minterms 9 and 11 are covered only by $P_1$ ($\overline{B}D$).
- Both implicants are essential.
The final minimized expression is:
$$F = \overline{A}D + \overline{B}D = D(\overline{A} + \overline{B})$$
Figure 3 confirms this result on a Karnaugh map.
This completes Section 1.4 on logic minimization. In Section 1.5, we implement standard combinational logic blocks, including multiplexers, decoders, encoders, and comparators.