Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 57 ¡ Simplification

Don't-Cares and Hazards

Use don't-care conditions to shrink K-map results, derive product-of-sums forms, and learn static and dynamic hazards, glitches and the redundant terms that fix them.

Two real-world details separate textbook logic from working hardware. First, some input combinations never occur, so the circuit's output for them is irrelevant, and you can use that freedom to build a smaller circuit. Second, a circuit that is correct on paper can still produce brief wrong pulses while it switches, and those pulses can cause real failures.

This lesson covers both: don't-care conditions (and how to get a product-of-sums answer from a K-map), and hazards, the glitches caused by unequal delays. Each comes with Python you can run.

Don't-care conditions

A don't-care is an input combination for which you do not care what the output is. Usually it is a combination that can never happen, or one where the output is ignored. In a truth table or K-map it is written X (or d). Each X may be treated as a 0 or a 1, whichever makes the simplification better.

The classic example is a function that works on a BCD digit. A BCD digit uses four bits but only the values 0 to 9, so the six patterns 1010 to 1111 are never valid. Suppose we want F = 1 when the digit is 5 or more:

  • Ones: 5, 6, 7, 8, 9
  • Zeros: 0, 1, 2, 3, 4
  • Don't-cares: 10, 11, 12, 13, 14, 15

Using don't-cares

Mark them X Inputs that never happen, or outputs nobody reads.
Use as 1 Include an X in a group when it makes the group larger.
Ignore otherwise Leave an X uncovered when it does not help.

An X never forces you to add a group by itself.

1 / 2

Grouping with the X cells treated as ones, the largest groups are: all rows with A = 1 (cells 8 to 15, covering ones 8 and 9 and don't-cares 10 to 15), the cells with B = 1 and C = 1 (6, 7, 14, 15), and the cells with B = 1 and D = 1 (5, 7, 13, 15). That gives F = A + BC + BD, three terms and five literals. Without don't-cares the same function needs a much bigger expression.

The program below finds the minimal cover for you. It builds all cubes (a product term where None means "variable dropped"), accepts a cube if it covers only ones and don't-cares, and then searches for the cheapest set of cubes that covers every required 1. Don't-cares need not be covered. It compares the answer with and without them, and verifies the result only on the cares, because the don't-cares can be anything.

Python Minimizing with don't-cares

Press Run (or Ctrl + Enter) to see the result here.

Program input ¡ what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

With don't-cares the result is A + BC + BD using 5 literals; without them the same function needs three three-literal terms (9 literals). The last line shows the outputs the design chose for inputs 10 to 15: those are the "free" choices, and they do not matter because those inputs never occur.

A don't-care is a promise that the input never happens. If a faulty sensor can really send the pattern 1111, the circuit will do something arbitrary. Only use X for combinations that are truly impossible or truly ignored, and consider safe-default behaviour for the rest in safety-critical designs.

Product of sums from a K-map

So far we grouped the ones, which gives a sum of products. To get a product of sums, group the zeros instead:

  1. Group the 0 cells (and don't-cares if they help) with the usual rules. This is a sum of products for the complement F′.
  2. Complement the result with De Morgan's theorems (see De Morgan's Theorems and Bubble Pushing): each product term becomes a sum term, in which every literal is complemented.

For the BCD example, the zeros are 0 to 4. The largest groups are A′B′ (cells 0 to 3) and A′C′D′ (cells 0 and 4). Neither can grow, because cell 8 is a required 1. So F′ = A′B′ + A′C′D′. Complementing: F = (A + B)(A + C + D).

The next program derives the POS form automatically by minimizing the zeros, and checks it against the SOP form on every care input.

Python POS from the zeros

Press Run (or Ctrl + Enter) to see the result here.

Program input ¡ what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The two forms are different circuits that agree on every input that matters. Here they also happen to agree on the don't-care inputs (the last line prints an empty list), but in general they may differ there, and nobody cares. Trying both forms is worthwhile, because one may be smaller than the other.

Hazards: glitches while switching

Real gates take time to respond, and different paths take different times. When one input changes, two copies of that signal may reach a gate at slightly different moments, and the output can briefly show a value that neither the old nor the new steady state requires. This unwanted pulse is a glitch, and a circuit that can produce one has a hazard.

There are three kinds:

  • Static-1 hazard: the output should stay at 1, but dips to 0 briefly.
  • Static-0 hazard: the output should stay at 0, but spikes to 1 briefly.
  • Dynamic hazard: the output should change once (0 to 1 or 1 to 0) but changes three times (for example 0, 1, 0, 1). It needs three or more paths from the changing input and appears in multi-level circuits.

Take F = AB + A′C with B = 1 and C = 1. F should be 1 both for A = 1 (AB is 1) and for A = 0 (A′C is 1). On a K-map the two terms are separate groups in cells 7 (ABC = 111) and 3 (ABC = 011); the cells are adjacent, but no single group covers both. When A falls, the term AB turns off before the inverter has produced A′ to turn A′C on. Between the two events nothing holds the output at 1.

Python A glitch as a timing plot

Press Run (or Ctrl + Enter) to see the result here.

Program input ¡ what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

In the plain circuit, F drops to 0 for exactly one time step (t = 7), while the fixed circuit stays at 1 throughout. The plot shows the cause: AB falls at t = 6, but A′C does not rise until t = 7, because the signal had to travel through the inverter first.

Removing a static-1 hazard

The cure is the consensus term: add a redundant product term that covers the pair of adjacent cells, so one gate holds the output at 1 across the transition. For F = AB + A′C the consensus term is BC:

F = AB + A′C + BC

The BC term is logically redundant (it never changes the function), but it stays at 1 whenever B = C = 1, regardless of A, so the output cannot dip. This is a deliberate exception to the "remove redundant terms" rule from Karnaugh Maps. On a K-map, you add a group that overlaps both of the original groups at the boundary where they touch.

Static-0 hazards in product-of-sums circuits are handled the same way, by adding a redundant sum term. Dynamic hazards disappear once all static hazards are removed from a two-level circuit.

Many designs ignore glitches on purpose. In a synchronous circuit, outputs only matter at the moment the clock samples them, so a glitch that settles well before the next clock edge does no harm. Hazards matter most for asynchronous circuits, clock and reset lines, and signals that drive latches or pulse-sensitive inputs. Timing and settling are the subject of Timing, Clock Skew and Metastability.

Check your understanding

Quick check ¡ 5 questions

of 5 answered You scored / 5 ¡ perfect!

  1. 1. What does an X in a K-map cell mean?

    A don't-care can be treated as 1 when it enlarges a group and ignored otherwise.
  2. 2. To obtain a product-of-sums expression from a K-map, which cells do you group?

    Grouping zeros gives F' as a sum of products. Complementing it turns each product term into a sum term and gives F as a product of sums.
  3. 3. What is a static-1 hazard?

    It is a glitch on an output that should have remained at 1, caused by unequal path delays.
  4. 4. Which term removes the static-1 hazard of F = AB + A'C?

    BC is the consensus of the two terms. It stays 1 whenever B = C = 1, bridging the moment when AB turns off and A'C turns on.
  5. 5. Why are hazards usually harmless in a synchronous circuit?

    If the clock period is longer than the worst-case settling time, the glitch is over before the value is captured.

Summary

  • A don't-care (X) is an input combination whose output is irrelevant; treat it as 1 or 0, whichever makes groups larger.
  • Don't-cares can shrink results a lot (F = A + BC + BD for "BCD digit is 5 or more").
  • For a product of sums, group the zeros to get F′ as a sum of products, then complement with De Morgan.
  • Hazards are brief glitches caused by unequal delays: static-1, static-0 and dynamic.
  • A redundant consensus term, such as BC in AB + A′C, removes a static-1 hazard, and synchronous design hides most glitches.

Next: The Quine-McCluskey Method.