Motivation
Sometimes certain input combinations never occur in a given application, or the designer does not care about the output value for those combinations. These are called don’t-care conditions. When simplifying a Boolean function, don’t-cares can be treated as either 0 or 1, whichever yields the simplest expression. This extra flexibility often leads to more minimal circuits.
Don’t-cares are denoted by X on a Karnaugh map.
Example: BCD to 7-Segment Decoder
Binary Coded Decimal (BCD) represents decimal digits 0-9 using 4 bits (0000 to 1001). The six combinations 1010 through 1111 (decimal 10-15) never occur in valid BCD input. In a BCD to 7-segment decoder, the outputs for these six input combinations are don’t-cares: we do not care what the display shows because the input will never be presented.
This means we have 6 don’t-care conditions (cells m10 through m15) on a 4-variable K-map for each output segment. By choosing to treat some don’t-cares as 1s, we can form larger groups and simplify the output expression significantly.
K-Map with Don’t-Cares
Don’t-cares are marked as X on the K-map. The grouping strategy is:
- Treat an X as 1 if it helps form a larger group (leading to fewer literals).
- Treat an X as 0 (ignore it) if including it would not enlarge any group.
In other words: use don’t-cares opportunistically to maximise group sizes, but do not include them if they do not help.
Worked Example
Simplify f=aˉ⋅bˉ⋅d+aˉ⋅c⋅d+a⋅c⋅d with don’t-care conditions: aˉ⋅bˉ⋅cˉ⋅dˉ, aˉ⋅bˉ⋅c⋅d, aˉ⋅b⋅cˉ⋅d.
First, identify all the terms and don’t-cares as minterm indices.
f minterms:
- aˉ⋅bˉ⋅d: a=0,b=0,d=1 → aˉbˉd covers aˉbˉcˉd (m1) and aˉbˉcd (m3). m1 = 0001, m3 = 0011.
- aˉ⋅c⋅d: a=0,c=1,d=1 → aˉcd covers aˉbˉcd (m3) and aˉbcd (m7).
- a⋅c⋅d: a=1,c=1,d=1 → acd covers abˉcd (m11) and abcd (m15).
So f minterms (1s): m1,m3,m7,m11,m15.
Don’t-cares:
- aˉ⋅bˉ⋅cˉ⋅dˉ: m0 (0000)
- aˉ⋅bˉ⋅c⋅d: m3 (0011) — note this is already a minterm of f, so it does not add a new don’t-care
- aˉ⋅b⋅cˉ⋅d: m5 (0101)
K-map (4 variables, a,b,c,d):
ab∖cd0001111000X011X11111110
Grouping without using don’t-cares: the 1s at m1,m3,m7,m11,m15 would require multiple small groups.
Grouping using don’t-cares: Column cd=11 contains 1s at all four rows (m3,m7,m11,m15), forming a group of 4. Constant: c=1,d=1; a and b vary. Term: c⋅d. This covers four of the five 1s.
The remaining 1 at m1 (0001) can pair with the don’t-care at m0 (0000) to form a group of 2: constant a=0,b=0,c=0; d varies. Term: aˉ⋅bˉ⋅cˉ. Alternatively, m1 could pair with the don’t-care at m5 (0101) for a vertical group: constant b=0,c=0,d=1; a varies. Term: bˉ⋅cˉ⋅d.
Both options yield valid simplified expressions with the same gate cost (1 AND-2 + 1 AND-3 + 1 OR-2):
f=c⋅d+aˉ⋅bˉ⋅cˉ
f=c⋅d+bˉ⋅cˉ⋅d
Alternative: Use more don’t-cares for even larger group
What if we treat both m0 and m5 as 1s? Then m0 (0000) and m1 (0001) give aˉbˉcˉ. And m5 and m7 give aˉbd, which is another term. But remember, all we need is a covering set: a minimum set of prime implicants that covers ALL the 1s. The don’t-cares DON’T need to be covered; they are optional. The two solutions above both cover all 1s (the column group covers m3,m7,m11,m15; the second group covers m1). Done.
Another Worked Example: BCD Counter Decoder
Consider a BCD to decimal decoder with 4 inputs (a,b,c,d) and 10 outputs (y0 through y9). Input combinations 1010 to 1111 are don’t-cares. Let us design the output y9, which is TRUE only when the BCD input is 9 (binary 1001).
Truth table for y9:
| a | b | c | d | y9 |
|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | X |
| 1 | 0 | 1 | 1 | X |
| 1 | 1 | 0 | 0 | X |
| 1 | 1 | 0 | 1 | X |
| 1 | 1 | 1 | 0 | X |
| 1 | 1 | 1 | 1 | X |
Without don’t-cares: y9=a⋅bˉ⋅cˉ⋅d (a single minterm, 4 literals).
With don’t-cares: Plot on K-map.
ab∖cd000111100000X00100X11100XX1000XX
The 1 is at m9 (1001): ab=10, cd=01.
The Xs are at m10 through m15: rows ab=10 (cols 10,11) and ab=11 (all four cols).
Without don’t-cares, y9=a⋅bˉ⋅cˉ⋅d (4 literals).
With don’t-cares, m9 (1001) pairs with m11 (1011, X) horizontally: constant a=1,b=0,d=1; c varies. Term: a⋅bˉ⋅d (3 literals). But we can do better: m9, m11, m13 (1101, X), and m15 (1111, X) form a 2×2 rectangle (rows 10 and 11, columns 01 and 11). Constant: a=1,d=1; b and c vary. Term: a⋅d (2 literals).
Check: a⋅d is 1 when a=1 and d=1. This covers m9 (1001), m11 (1011), m13 (1101), and m15 (1111). The latter three are all don’t-cares, so this is valid.
y9=a⋅d
This is a dramatic simplification: from 4 literals down to 2, made possible by treating the don’t-cares as 1s to form a larger group.
Important Definitions
When discussing K-map simplification with don’t-cares:
Prime Implicant: A product term that cannot be combined with any other term to eliminate a variable. On a K-map, a prime implicant corresponds to a maximal group of adjacent 1s (and optionally Xs) that cannot be enlarged while remaining rectangular. A group is not a prime implicant if it can be expanded to a larger valid group.
Essential Prime Implicant: A prime implicant that covers at least one minterm (a 1, not a don’t-care) that is NOT covered by any other prime implicant. Essential prime implicants MUST be included in the final expression.
Covering Set: A minimum set of prime implicants that includes all essential prime implicants plus any non-essential prime implicants needed to cover the remaining uncovered 1s. The covering set gives the minimal SOP expression.
K-Map Example Illustrating Definitions
Consider the K-map below for a 4-variable function. Let 1s be at: m4,m5,m6,m8,m9,m10,m13. Don’t-cares: m0,m7,m15.
ab∖cd0001111000X110111111XX1011
Prime implicants:
-
PI1: Row ab=01 (all four cells: m4,m5,m7,m6). m7 is X, the rest are 1s. Group of 4: aˉ⋅b.
-
PI2: Column cd=01, rows 01 and 11 (m5,m13). Rows 01 and 11 are adjacent in Gray code. Constant: b=1,c=0,d=1; a varies. Term: b⋅cˉ⋅d.
-
PI3: Row ab=10 has 1s at m8,m9,m10 but a gap at m11 (empty), so no group of 4. Two groups of 2: m8 and m9 (horizontal, columns 00 and 01) → a⋅bˉ⋅cˉ; m8 and m10 (horizontal wrap, columns 00 and 10) → a⋅bˉ⋅dˉ.
-
PI4: m13 (1101) and m15 (1111) in row ab=11, columns 01 and 11 (adjacent in Gray code). m13 is 1, m15 is X. Horizontal group of 2: constant a=1,b=1,d=1; c varies. Term: a⋅b⋅d.
Prime implicants found:
- aˉ⋅b (covers m4,m5,m6)
- b⋅cˉ⋅d (covers m5,m13 — rows 01 and 11 are adjacent in Gray code, so the vertical group in column cd=01 is valid)
- a⋅bˉ⋅cˉ (covers m8,m9)
- a⋅bˉ⋅dˉ (covers m8,m10)
- a⋅b⋅d (covers m13,m15)
Essential prime implicants: Look at each 1-minterm and see how many PIs cover it:
- m4: covered only by aˉ⋅b → essential.
- m5: covered by aˉ⋅b and b⋅cˉ⋅d.
- m6: covered only by aˉ⋅b → essential (already covered).
- m8: covered by a⋅bˉ⋅cˉ and a⋅bˉ⋅dˉ.
- m9: covered only by a⋅bˉ⋅cˉ → essential.
- m10: covered only by a⋅bˉ⋅dˉ → essential.
- m13: covered by b⋅cˉ⋅d and a⋅b⋅d.
Essential PIs: aˉ⋅b, a⋅bˉ⋅cˉ, a⋅bˉ⋅dˉ.
These cover: aˉ⋅b covers m4,m5,m6. a⋅bˉ⋅cˉ covers m8,m9. a⋅bˉ⋅dˉ covers m8,m10.
All 1s covered? m4 ✓, m5 ✓, m6 ✓, m8 ✓ (by both second and third), m9 ✓, m10 ✓, m13 ✗ (NOT covered!).
m13 is not covered by any essential PI. We need to add a non-essential PI to cover it. Options: b⋅cˉ⋅d or a⋅b⋅d. The former requires 3 literals, the latter 3 literals. We can pick either (both same cost). Adding a⋅b⋅d gives:
f=aˉ⋅b+a⋅bˉ⋅cˉ+a⋅bˉ⋅dˉ+a⋅b⋅d
Or adding b⋅cˉ⋅d gives:
f=aˉ⋅b+a⋅bˉ⋅cˉ+a⋅bˉ⋅dˉ+b⋅cˉ⋅d
Both are valid minimal covers. The first covers m13 and also the don’t-care m15; the second covers m13 and also m5 (which is already covered by aˉ⋅b, so the overlap doesn’t matter).
The minimality does not depend on covering don’t-cares. What matters is covering all 1s with the fewest prime implicants (or fewest literals, depending on the cost metric).
Summary
- Don’t-care conditions arise when certain input combinations can never occur in a specific application.
- On a K-map, don’t-cares are marked with X.
- In grouping, treat X as 1 if it helps form a larger group; ignore it otherwise.
- Don’t-cares do NOT need to be covered by the final expression; only the actual 1s must be covered.
- The definitions of prime implicants, essential prime implicants, and covering sets remain the same, but don’t-cares can participate in forming prime implicants.
- Don’t-cares often enable dramatic simplifications, as seen in the BCD examples.