In short: Mark the input combinations that can never happen as X, let them act as 1 whenever that makes a K-map group bigger, and ignore them otherwise, which routinely cuts a BCD function from nine literals to five or even to a plain wire.
What a don't-care really is
A don't-care condition is an input combination for which the output value is irrelevant, either because the combination can never occur or because nobody reads the output when it does. The classic source is BCD. Four bits can encode sixteen codes, but a decimal digit needs only ten, so codes 1010 to 1111 (decimal 10 to 15) are invalid. A seven-segment decoder, a BCD adder or a digit comparator is never shown those codes, so the designer is free to assign them whatever output yields the cheapest logic.
On a K-map we write X in these cells. The key rule is that an X is a wildcard: it may be read as 1 to enlarge a group, or as 0 to be left alone, whichever is more convenient, and the choice can differ cell by cell.
Key fact: a group of size 2k removes k variables from its product term. Each doubling of a group saves one literal, so one extra X absorbed can delete a whole input from a gate.
The four-step procedure
- Fill the map with 1s, 0s and X for every cell, using the minterm numbering of the Gray-coded axes. If you need a refresher, see our guide to K-map simplification.
- Draw the largest possible rectangles (sizes 1, 2, 4, 8, 16) that cover every 1, treating X cells as 1s.
- Reject any group that contains only X cells. It would add a gate that implements nothing the specification asked for.
- Read each group as a product term. X cells you did not use are implicitly 0, and that is what the hardware will do.
Worked example 1: digit is 5 or more
Let f be 1 for BCD digits 5, 6, 7, 8, 9 and 0 for 0 to 4. This is the first stage of a rounding circuit or a decimal comparator. Without don't-cares the minimal cover is f = AB'C' + A'BD + A'BC: three terms and nine literals, because 8 and 9 sit alone in the bottom-left and 5, 6, 7 form two pairs.
With the X cells in play, the entire A = 1 half of the map (codes 8 to 15) becomes a group of eight and costs one literal. The 5-7 pair extends upward through 13 and 15 into B·D, and 6-7 extends through 14 and 15 into B·C. The result is f = A + BD + BC, five literals. You can sanity check it: digit 4 (0100) gives 0, digit 5 (0101) gives BD = 1, digit 9 (1001) gives A = 1. Codes 10 to 15 now output 1 mostly by accident, which is fine because they never appear.
| Version | Expression | Terms | Literals |
|---|---|---|---|
| No don't-cares | AB'C' + A'BD + A'BC | 3 | 9 |
| With X cells | A + BD + BC | 3 | 5 |
Worked example 2: odd digit detector
Now take f = 1 for digits 1, 3, 5, 7, 9. The real ones give f = A'D + B'C'D, which is two AND terms and an OR. Notice that every valid odd digit has D = 1 and every valid even digit has D = 0. Once the six unused codes are free, the 11, 13 and 15 cells join the group and the entire D = 1 column pair, eight cells, becomes one group. The answer is simply f = D.
Key fact: f = D is only correct under the assumption that inputs are valid BCD. Feed it 1011 and you will report an odd digit that does not exist. That is the price of the optimisation, so document it.
Pitfalls interviewers love
- Using X as 1 in one group and 0 in another. Legal, because the final circuit simply realises one fixed truth table for the X cells. Just make sure you can state what it is.
- Forgetting the wrap-around. The top and bottom rows, and the left and right columns, are adjacent. The BC group above only exists because 6, 7, 14, 15 wrap correctly through the Gray-code axis.
- Making X-only groups. They add hardware without covering any required 1.
- Product-of-sums. The same trick applies when grouping 0s: X cells join 0-groups to give maximal maxterms.
- Dishonest don't-cares. In a state machine, unused states are only don't-care if the machine can never reach them. After a glitch or power-up it can, so many teams force unused states back to idle.
Don't-cares in real tools
You will rarely draw a K-map for more than four or five variables, but the idea scales. Espresso-style two-level minimisers take an explicit don't-care set. In RTL, a case statement default that assigns x tells Synopsys Design Compiler, Cadence Genus and Vivado that unspecified inputs are free, and the logic optimiser quietly applies the same grouping you did by hand. Beware the mismatch: simulators propagate x as unknown while the netlist has committed to a real 0 or 1, so a formal equivalence check (Synopsys Formality, Cadence Conformal) is how teams catch the places where x-optimism hides a bug. Our seven-segment decoder walkthrough uses the same BCD don't-cares for all seven outputs, and teams that bring this skill to chip projects, for example through Avecas design services, routinely save area on decoders and control logic.
Key fact: for a BCD seven-segment decoder, don't-cares in codes 10 to 15 typically shrink the combined logic by a third or more compared with assigning those codes blank displays.
Practice and next steps
Try a few on paper. Design a detector for digits divisible by 3 (0, 3, 6, 9) with don't-cares, or a BCD-to-excess-3 converter, where each output bit is a four-variable function with six free cells. Compare your literal counts with and without X. The step-by-step lessons live in the CourseTron courses, and if you want guided interview-style drills in person, ChipXpert training runs live batches.
Ready to master combinational design? Join the CourseTron Digital Electronics course and practise K-maps, don't-cares and synthesis with worked problems.
FAQ
Can a don't-care be used in more than one group?
Yes. Groups may overlap freely, and an X may be covered by several groups. It costs nothing, and it often lets each group grow larger.
Do I have to cover every don't-care?
No. An X that no group needs is simply treated as 0 in the final circuit. Only the real 1s must be covered.
Are don't-cares safe in real hardware?
Only if the inputs truly never occur. If a glitch, power-up state or test pattern can reach an X code, the circuit will still output something, so verify the assumption or add a defined default.
Do synthesis tools use don't-cares?
Yes. Design Compiler, Genus and Vivado exploit unspecified cases such as default branches assigned x, but they can mismatch RTL simulation, so check with formal equivalence.