Sub topic 14
The Quine-McCluskey Tabular Method
Prerequisites and purpose
This chapter assumes that you can convert between binary and decimal, read Boolean expressions, and use minterms. The Quine-McCluskey method is a systematic way to minimize Boolean functions. Unlike a Karnaugh map, it does not depend on drawing or visual grouping. It is useful when a function has many variables or when minimization must be automated.
The method has two main stages:
- Find all prime implicants by repeatedly combining minterms.
- Select a minimum set of prime implicants that covers every required minterm.
A dash (-) means that the corresponding variable has been eliminated.
Grouping and combining terms
Write every minterm as an n-bit binary number. Group the numbers by their count of 1s. Terms in adjacent groups may be combined if they differ in exactly one bit.
For example, 000 and 001 combine to form 00-. The first two bits remain fixed, while the last bit can be either 0 or 1.
Consider:
F(A,B,C) = Σm(0, 1, 2, 5, 6, 7)
| Number of 1s | Minterms |
|---|---|
| 0 | `000` |
| 1 | `001`, `010` |
| 2 | `101`, `110` |
| 3 | `111` |
Possible first combinations include:
000and001→00-000and010→0-0001and101→-01010and110→-10101and111→1-1110and111→11-
A term can be combined only with another term that has the same dash positions and differs in one remaining position. Continue combining until no further combination is possible.
The terms that cannot be combined in a later round are prime implicants. For this example, the prime implicants are:
00-, 0-0, -01, -10, 1-1, and 11-.
To convert a pattern into a product term, retain variables whose bits are fixed:
00-meansA'B'-10meansBC'1-1meansAC
The remaining work is to choose a cover. For example, 00-, -10, and 1-1 cover all six minterms, giving:
F = A'B' + BC' + AC
A programmable version
The following program performs the combining stage and prints the prime implicants.
def combine(a, b):
differences = [
i for i, (x, y) in enumerate(zip(a, b))
if x != y
]
if len(differences) != 1:
return None
i = differences[0]
if a[i] == '-' or b[i] == '-':
return None
return a[:i] + '-' + a[i + 1:]
def prime_implicants(minterms, variable_count):
terms = {
format(m, f"0{variable_count}b")
for m in minterms
}
primes = set()
while terms:
used = set()
next_terms = set()
for a in terms:
for b in terms:
merged = combine(a, b)
if merged is not None:
next_terms.add(merged)
used.update((a, b))
primes.update(terms - used)
terms = next_terms
return sorted(primes)
print(prime_implicants([0, 1, 2, 5, 6, 7], 3))The program prints the six prime implicants. A prime implicant chart, covered in the next stage of the method, identifies essential prime implicants and selects a minimum cover.
Exercise
For F(A,B,C) = Σm(1,3,5,7), what single prime implicant covers every minterm?
Show answer
The binary terms are 001, 011, 101, and 111, so the first two variables vary and the last variable remains 1. The prime implicant is --1, which represents C.