Prof. Dr. Thorsten Jungmann (last updated 2026-10-25)

1 Which loops are really needed? – Prime implicants

1.1 Implicants and prime implicants

In DET-03, 4.2, you drew loops around neighbouring ones in the Karnaugh map, each as large as possible. Today, you learn what LaMeres means by a prime implicant and which loops a minimal expression really needs. Both belong to step 4 of the synthesis, the minimization (DET-03, 1.1); the next two chapters of this lesson stay with this step. Our example is the display of your smartphone, with two rules that you know from DET-02. During a call, the display switches off as soon as the proximity sensor next to the earpiece is covered, and it stays on while the sensor is free, so that you can see it when you talk over the loudspeaker (DET-02, 2.1). Outside a call, it switches on if you press the power button or lift the phone (DET-02, 3.3). The display, the example of this chapter, has four inputs and one output:

  • : a call is active
  • : the proximity sensor is covered
  • : the power button is pressed
  • : the phone is lifted
  • : the display is on

In DET-02, 6.1, the display needed the button or the lift during a call as well; here, the sensor alone decides during a call. In the rows of the truth table with , the display is on if or ; in the rows with , it is on if .

Row
000000
100011
200101
300111
401000
501011
601101
701111
810001
910011
1010101
1110111
1211000
1311010
1411100
1511110

In rows 12 to 15, your ear covers the sensor during a call, and the display stays dark even if your cheek presses the button. The function has ten ones:

where:

  • is the output ‘display on’, 0 or 1
  • , , and are the inputs ‘call active’, ‘proximity sensor covered’, ‘power button pressed’ and ‘phone lifted’, each 0 or 1
  • stands for the minterms, followed by the numbers of their rows

In the map (figure), each loop stands for a product term that is 1 in the cells of the loop and 0 everywhere else. Since all these cells contain a one, is 1 whenever the term is 1: the term implies the function and is an implicant (German: Implikant) of it [17, p. 18], [12, p. 54]. Each single one is an implicant, and so is each loop of ones. An implicant that no larger implicant contains – a loop that cannot be enlarged – is a prime implicant (German: Primimplikant) [12, p. 55], [5, p. 130]. Your rule ‘each loop as large as possible’ therefore yields exactly the prime implicants. The display has five of them:

  • : no call, phone lifted (minterms 1, 3, 5 and 7)
  • : no call, button pressed (minterms 2, 3, 6 and 7)
  • : call, sensor free (minterms 8, 9, 10 and 11)
  • : sensor free, phone lifted (minterms 1, 3, 9 and 11)
  • : sensor free, button pressed (minterms 2, 3, 10 and 11)

Read the last one: if the sensor is free and you press the button, the display is on – with or without a call. That is true, but section 1.2 shows that the minimal expression does not need it.

Karnaugh map of the display with all five prime implicants as loops: A bar D, A bar C, A B bar, B bar D and B bar C
Karnaugh map of the display with all five prime implicants as loops: A bar D, A bar C, A B bar, B bar D and B bar C

1.2 Essential and redundant prime implicants

Not every prime implicant is needed. Look for ones that only a single prime implicant covers: the one of minterm 5 – no call, sensor covered, button not pressed, phone lifted – lies only in , the one of minterm 6 only in , and the one of minterm 8 only in . Without these three prime implicants, these ones would be missing. A prime implicant that covers a one that no other prime implicant covers is an essential prime implicant (German: Kernprimimplikant) [5, p. 138], [12, p. 55]. It appears in every minimal expression [12, p. 55].

The three essential prime implicants of the display together cover all ten ones. In the figure, they are drawn with solid lines, and the three ones that only a single prime implicant covers are shaded. The ones of – minterms 1, 3, 9 and 11 – already lie in and , and those of – minterms 2, 3, 10 and 11 – in and . A prime implicant whose ones the essential prime implicants cover completely is superfluous [12, p. 55]: a redundant prime implicant (German: absolut eliminierbarer Primimplikant) [17, p. 41], [12, p. 55]. It can be left out; the figure draws the two redundant prime implicants with dashed lines. What remains is the minimal disjunctive normal form (DNF, German: minimale disjunktive Normalform) [12, p. 53] of the display:

where:

  • is the output ‘display on’, 0 or 1
  • , , and are the inputs ‘call active’, ‘proximity sensor covered’, ‘power button pressed’ and ‘phone lifted’, each 0 or 1

Read: the display is on if, outside a call, the button is pressed or the phone is lifted, or if, during a call, the sensor is free – the description of section 1.1 in three product terms. Counted as in DET-03, 3.1, the circuit needs three AND gates with two inputs each and an OR gate with three inputs, plus inverters for and . The canonical DNF would need ten AND gates with four inputs each and an OR gate with ten inputs.

Karnaugh map of the display with the three prime implicants of the minimal form as solid loops, the redundant prime implicants B bar D and B bar C as dashed loops and the three cells covered by only one loop shaded
Karnaugh map of the display with the three prime implicants of the minimal form as solid loops, the redundant prime implicants B bar D and B bar C as dashed loops and the three cells covered by only one loop shaded

LaMeres calls the minimal DNF the minimal sum, and the OR of all prime implicants the complete sum [5, p. 138]; for the display, the complete sum has five product terms. Keep the two redundant prime implicants in mind: in chapter 4, they will be needed after all.

1.3 When there is a choice

For the display, the essential prime implicants cover every one, and there is exactly one minimal DNF. That is not always so. If some ones remain that no essential prime implicant covers, a selection of the other prime implicants has to cover them, with as few as possible [12, pp. 56, 62]. Fricke shows this with a function of four inputs [12, pp. 53–56]:

where:

  • is the output, 0 or 1
  • , , and are the inputs, each 0 or 1, with as the variable of the highest weight
  • stands for the minterms, followed by the numbers of their rows

Its map (figure) has five prime implicants. Three of them are essential and are drawn with solid lines: with the four cells 0, 2, 8 and 10, because only it covers 0, 2 and 10; with 5 and 13, because only it covers 5; and with 13 and 15, because only it covers 15. Together, they leave the one of minterm 12 uncovered. Two prime implicants contain it, both drawn with dashed lines: with 12 and 13, and with 8 and 12, which are neighbours across the left and the right edge of the map. Either of them completes the minimal DNF, and the two forms are of the same size, with four product terms each [12, p. 56]:

where:

  • is the output, 0 or 1
  • , , and are the inputs, each 0 or 1

Karnaugh map with the essential prime implicants B bar D bar, B C bar D and A B D as solid loops and the two alternatives A B C bar and A C bar D bar as dashed loops
Karnaugh map with the essential prime implicants B bar D bar, B C bar D and A B D as solid loops and the two alternatives A B C bar and A C bar D bar as dashed loops

So a function can have more than one minimal DNF; LaMeres, too, notes that there may be several minimal sums, all with the same number of operations [5, p. 138]. The canonical DNF, in contrast, is unique (DET-03, 2.5):

FormProduct termsUnique?
Canonical DNFthe minterms of all ones, each with every variableyes
Minimal DNFthe essential prime implicants and, if needed, a selection of the othersnot always

The choice also sharpens a rule from DET-03, 4.2: a loop whose ones all lie in other loops is not needed. Here, each of the two loops and fulfils this condition, because the other one covers cell 12. You may leave out one of them, but not both – cell 12 would then remain uncovered.

Erratum in the textbook by LaMeres

LaMeres [5, pp. 138, 145] states that the minimal sum consists of the essential prime implicants alone. This holds only if they cover all ones. In the example above, they leave minterm 12 uncovered, and one of the other prime implicants has to complete the minimal form [12, p. 56].

2 Recipe for a computer – The Quine–McCluskey algorithm

2.1 From the map to the table

The map relies on your eye: you see neighbours and large loops at a glance. A computer does not see a picture; it needs rules that it can follow one after another. The Quine–McCluskey algorithm (German: Quine-McCluskey-Verfahren) puts the map into tables [17, pp. 115–116] and is therefore suited to implementation on a computer [12, p. 60], [18, p. 136]. Like the map, it relies on the uniting theorem of DET-03, 3.2: two product terms that differ in only one variable unite into one without this variable [12, p. 60]. The algorithm works in two parts: part 1 finds all prime implicants, and part 2 selects the fewest of them that cover all ones [18, p. 136]. Both parts work with tables: part 1 builds one table after another, and part 2 adds one more table, which section 2.3 introduces [12, pp. 60–61].

The algorithm writes each minterm as its code: a 1 for a variable that appears as it is, a 0 for a negated variable and a dash for a variable that has dropped out [12, p. 60]. Minterm 3 of the display, , is written 0011; the product term is written 0‑‑1.

Then it sorts the minterms into groups by the number of their ones [12, p. 60]. Two codes that differ in exactly one position always lie in consecutive groups, because one of them has exactly one 1 more than the other. The algorithm therefore compares only terms of consecutive groups, and this saves many comparisons [17, p. 118]. For the ten ones of the display from section 1.1, this gives the first table, with three groups:

GroupMinterm
110001
120010
181000
230011
250101
260110
291001
2101010
370111
3111011

Minterm 1 of group 1, for example, only needs to be compared with the five minterms of group 2, not with the two of group 3: a code with three ones cannot differ from 0001 in only one position.

Quine and McCluskey

Quine described the method in 1952, and McCluskey extended it in 1956 [19]. Donzellini and his co-authors count it among the earliest algorithms that minimize Boolean expressions [17, p. 115].

2.2 Part 1: finding all prime implicants

Part 1 builds one table after another, starting from the first table. To form the next table, the algorithm compares each term of a group with each term of the next group. If two terms differ in exactly one position, it writes the united term into the next table, with a dash in this position and the numbers of both minterms, and ticks both terms in the previous table [12, pp. 60–61]. Minterm 1 (0001) and minterm 3 (0011), for example, differ only in and unite into 00-1, the term . For the display, the second table holds 14 pairs:

GroupMinterms
11, 300-1
11, 50-01
11, 9-001
12, 3001-
12, 60-10
12, 10-010
18, 9100-
18, 1010-0
23, 70-11
23, 11-011
25, 701-1
26, 7011-
29, 1110-1
210, 11101-

Every minterm has found at least one partner, so none of them is a prime implicant. For the third table, the algorithm applies the same rule to the pairs: two terms unite if their dashes stand in the same position and they differ in exactly one other position [12, p. 61]. 00-1 (1, 3) and 01-1 (5, 7) unite into 0‑‑1 (1, 3, 5, 7), the term . The same term also comes from 0-01 (1, 5) and 0-11 (3, 7); a term that appears more than once is kept only once [12, p. 61], [17, p. 119]:

MintermsTerm
1, 3, 5, 70--1
1, 3, 9, 11-0-1
2, 3, 6, 70-1-
2, 3, 10, 11-01-
8, 9, 10, 1110--

All 14 pairs are now ticked. The code of each of the five terms that cover four minterms has exactly one 1, so all five fall into the same group; there is no next group, and part 1 ends, because no terms can be united any more [12, p. 61]. Every term without a tick is a prime implicant [12, p. 61]. Here, these are the five terms of the third table – exactly the five loops of section 1.1. The algorithm has found them without a picture, in three tables: ten minterms, 14 pairs and five terms that cover four minterms each.

2.3 Part 2: selecting with the prime implicant chart

Part 2 selects the prime implicants for the minimal expression. For this, they are entered in one more table, the prime implicant chart (German: Primimplikantentafel) [12, p. 61], [19]: one row for each prime implicant, one column for each minterm, and a mark wherever the prime implicant contains the minterm [12, p. 62]. For the display:

Prime implicant123567891011
●●●●
●●●●
●●●●
●●●●
●●●●

A column with a single mark belongs to a minterm that only one prime implicant covers; this prime implicant is essential [12, p. 62], [17, p. 119]. In the chart of the display, the columns 5, 6 and 8 have a single mark each: , and are essential. Their rows have marks in all ten columns, so every minterm is covered. The rows of and are not needed, and the algorithm ends with the minimal disjunctive normal form (DNF) of section 1.2, – the same result as the map, found without looking at a picture.

If minterms remain uncovered after the essential prime implicants, the algorithm selects as few of the other prime implicants as possible to cover them [12, p. 62]. In the example of section 1.3, the column of minterm 12 remains, and two rows can cover it; the chart then shows the choice between the two minimal forms [12, pp. 62–63].

3 Six signals for a heat pump – Functions with many inputs

3.1 When the map becomes too large

Now to our heat pump and the third guiding question: six signals decide whether it may start. In our example system, the energy supplier can block the heat pump; as long as the block lasts, the heat pump must not start (DET-02, 3.1) [13], and only frost protection is ensured: frost protection may start the heat pump even during a block. Above an outside temperature of 19 °C, the controller switches to summer mode, in which the heating is off and the heat pump only heats the hot water. Below the bivalence temperature of −7 °C, a second heat generator heats alone, and the heat pump only starts for the hot water and for frost protection.

In simplified form, the controller therefore follows this rule: frost protection may always start the heat pump. Without a block, a hot-water demand starts it in every season, and a heating demand starts it outside summer mode and above the bivalence temperature. The six inputs and the output are:

  • : the heating demands heat
  • : the hot water demands heat
  • : summer mode is on
  • : the energy supplier blocks the heat pump
  • : the outside temperature is below the bivalence temperature
  • : frost protection is active
  • : the heat pump may start

With six inputs, the truth table has rows, and the map has 64 cells. A map for six inputs consists of four maps for four inputs, and a cell has neighbours not only next to it but also in the other maps [17, pp. 40–41]; Fricke draws it with 8 × 8 cells [12, p. 58]. The figure shows our heat pump in this form: each of the four maps stands for one combination of and , and inside each map, the inputs , , and are arranged like , , and in the map of the display.

Some combinations never occur: the outside temperature cannot be above 19 °C and below −7 °C at the same time. In the 16 rows with and , the output is therefore a don’t care, as in DET-03, 4.4, marked X in the map. Of the other 48 rows, 31 demand a 1 and 17 a 0.

Karnaugh map of the heat pump with six inputs, made of four maps for the combinations of A and B, with ones, zeros and an X wherever C and E are both one
Karnaugh map of the heat pump with six inputs, made of four maps for the combinations of A and B, with ones, zeros and an X wherever C and E are both one

Finding the largest loops among 64 cells by eye, also across the borders of the four maps, is error-prone. Reichardt considers the map well suited to the human eye for up to five inputs [18, p. 136], and maps with more than six variables are rarely used, because they become very unclear [12, p. 57]. Donzellini and his co-authors draw the line even earlier: for more than four variables, they leave the minimization to algorithms on a computer [17, p. 115].

3.2 The algorithm with many inputs

The algorithm does not care how many inputs there are: its two parts stay the same, only the tables grow. Don’t cares count as ones while terms are united, so that the united terms become as large as possible, and they get no column in the prime implicant chart, because they need not be covered [17, p. 120]. For the heat pump, a computer program carries out the algorithm. Part 1 needs six tables:

TableTermsMinterms per termPrime implicants found
1471–
21192–
31164
4548–
51216 and
6132

In the first table, the 31 ones and the 16 don’t cares are 47 minterms in six groups. Each further table unites terms into terms that cover twice as many minterms, until the sixth table holds a single term with 32 minterms. Four prime implicants have no partner: , , and . The term contains only don’t cares, the combinations that never occur, and has nothing to cover in the chart. The other three are essential, and the minimal disjunctive normal form (DNF) has three product terms:

where:

  • is the output ‘heat pump may start’, 0 or 1
  • and are the inputs ‘heating demands heat’ and ‘hot water demands heat’, each 0 or 1
  • and are the inputs ‘summer mode on’ and ‘energy supplier blocks the heat pump’, each 0 or 1
  • and are the inputs ‘below the bivalence temperature’ and ‘frost protection active’, each 0 or 1

Read: the heat pump may start if frost protection is active, or if the hot water demands heat without a block, or if the heating demands heat without a block, outside summer mode and above the bivalence temperature. Two AND gates, an OR gate with three inputs and three inverters replace a canonical DNF with 31 AND gates of six inputs each. Here, the don’t cares keep the result short: and may include the combinations that never occur. With a 0 in these cells, the minimal DNF would need five product terms. The don’t cares also add the prime implicant , which the chart leaves out.

The effort, however, grows quickly. With every further input, the number of rows doubles, and the effort of the algorithm grows exponentially with the number of inputs [18, p. 137], [19]. According to Reichardt, it can realistically be computed for 15 to 20 inputs at most [18, p. 137]. Part 2 can grow as well: if prime implicants remain after the essential ones, trying every selection means cases, although the algorithm has ways that usually need far fewer [17, pp. 120–121].

3.3 Logic minimization software: exact and heuristic

For large functions, even the exact algorithm reaches its limits. For two-level minimization (German: zweistufige Minimierung), the search for a minimal DNF or a minimal conjunctive normal form (CNF), Reichardt names two algorithms for the computer: the Quine–McCluskey algorithm, which is exact, and the Espresso heuristic logic minimizer, Espresso for short, which is heuristic [18, pp. 136–137]. A heuristic method (German: heuristisches Verfahren) works with simplifying assumptions: as a rule, it reaches the same result as the exact algorithm, but in individual cases, the solution that it finds is slightly off the optimum [18, p. 137]. Because its effort is much lower, Espresso in its version II has become established for two-level minimization [18, p. 137].

You met such software in DET-03, 6.3: a synthesis tool (German: Synthesewerkzeug), the software that turns VHDL code into a circuit, looks for an inexpensive circuit itself, and according to LaMeres, computer automation is often the best way to minimize large expressions [5, p. 126]. So the answer to the first guiding question is yes – a computer can minimize a circuit for you: exactly with the Quine–McCluskey algorithm as long as the number of inputs allows it, and with heuristics beyond that. It is still worth understanding what the computer does: chapter 4 of this lesson shows a case in which the minimal circuit is not the best one.

4 Dark for a few nanoseconds – Hazards

4.1 Static and dynamic hazards

So far, our circuits have switched without delay. In DET-02, 3.5, however, you saw that a real gate needs a few nanoseconds to follow its inputs, its propagation delay, and in DET-02, 6.3, that the delays add up along each path through a circuit. Different paths therefore have different delays, and while the inputs change, the output can show short, unwanted pulses. The check against the description, step 6 of the synthesis (DET-03, 5.2), compared truth tables, that is, the values after all changes have settled; it does not see these pulses. These pulses are the hazards [5, p. 142] that I announced in DET-01, 5.2; LaMeres also calls them glitches [5, p. 142].

Hazards are named after what the output should do (figure) [5, p. 143], [12, p. 68]:

  • A static 1 hazard (German: statischer 1-Hazard): the output should stay 1, but drops to 0 for a moment.
  • A static 0 hazard (German: statischer 0-Hazard): the output should stay 0, but rises to 1 for a moment.
  • A dynamic hazard (German: dynamischer Hazard): the output should change once, from 0 to 1 or from 1 to 0, but changes several times before it reaches its final value.

Three timing diagrams of an output Y: a static 1 hazard with a short drop to 0, a static 0 hazard with a short rise to 1 and a dynamic hazard that changes three times instead of once
Three timing diagrams of an output Y: a static 1 hazard with a short drop to 0, a static 0 hazard with a short rise to 1 and a dynamic hazard that changes three times instead of once

A hazard comes from a race (German: Wettlauf) [9, p. 130]: either several inputs change at the same moment, and their changes arrive one after another, or a single input reaches a gate on two paths with different delays [9, p. 130]. Fricke treats the two cases separately [12, pp. 66–68]. A hazard caused by the change of a single input depends on the structure of the circuit [18, p. 134] and is called a logic hazard (German: Strukturhazard) [12, p. 66], [20]. A hazard caused by the change of several inputs is a function hazard (German: Funktionshazard) [12, p. 67], [20]. LaMeres does not distinguish the two kinds [5, pp. 142–144]. Sections 4.2 and 4.3 deal with the logic hazard, section 4.4 with the function hazard.

4.2 One input, two paths

Back to the display of chapter 1, built as a two-level circuit from its minimal disjunctive normal form (DNF), (figure): two inverters form and , three AND gates form the product terms, and an OR gate combines them into . The thick lines mark the two paths on which the input reaches the OR gate.

Logic circuit of the display with two inverters, three AND gates for A bar C, A bar D and A B bar and an OR gate, in which the two paths of A to the OR gate are drawn thick
Logic circuit of the display with two inverters, three AND gates for A bar C, A bar D and A B bar and an OR gate, in which the two paths of A to the OR gate are drawn thick

You end a call while you hold the phone in front of you: changes from 1 to 0, while , and . Before, the display is on because the sensor is free during the call, ; afterwards, it is on because the phone is lifted, . The output should stay 1.

Suppose, as in DET-02, 6.3, that each gate has a propagation delay of 9 ns, the typical value of the NAND gates of the 74HC00 [11]. Follow the change through the circuit (timing diagram):

  1. At , falls from 1 to 0.
  2. After 9 ns, the output of the AND gate for has followed and is 0.
  3. comes from an inverter and rises only after 9 ns; the AND gate for needs another 9 ns, so its output rises after 18 ns.
  4. Between 9 ns and 18 ns, all three inputs of the OR gate are 0. With its own delay, the output is 0 from 18 ns to 27 ns.

Timing diagram of the end of a call with the signals A, A bar, A B bar, A bar D and Y, in which Y drops to 0 between 18 ns and 27 ns
Timing diagram of the end of a call with the signals A, A bar, A B bar, A bar D and Y, in which Y drops to 0 between 18 ns and 27 ns

For 9 ns, the display signal drops to 0 although it should stay 1: a static 1 hazard. Its cause is the inverter. The input reaches the OR gate on the two thick paths of the circuit, directly through and through the inverter and , and the second path is slower. Lou and Yang call such a contest between paths a race [9, p. 130]; LaMeres [5, p. 142] and Fricke [12, p. 66] show the same effect with other examples. When the call starts, rises: becomes 1 after 9 ns, before becomes 0 after 18 ns, and there is no dip.

In the map (figure), the change of leads from the cell of minterm 9 to the neighbouring cell of minterm 1. Both cells contain a one, but in the minimal DNF they belong to different loops, and , and no loop of the minimal DNF contains both. This is the mark of a logic hazard in a two-level circuit of AND gates and an OR gate: two neighbouring ones that do not lie in a common loop [17, p. 68], [12, p. 67].

Karnaugh map of the display with the three loops of the minimal form and an arrow from the cell of minterm 9 to the cell of minterm 1, which lie in different loops
Karnaugh map of the display with the three loops of the minimal form and an arrow from the cell of minterm 9 to the cell of minterm 1, which lie in different loops

Nobody would see a dip of 9 ns on the display. Whether such a dip does harm depends on what the signal drives; chapter 5 returns to this question. In the simulator, a delay element enlarges the delay of the inverter on purpose, so that you can watch the dip: switch from 1 to 0 with and , and goes dark for a moment. Without such a delay element, the dip lasts only 5 µs in the simulation.

Simulation of the display circuit in its minimal form, in which the output Y is 1 with A and D at 1 and B and C at 0, with a delay element behind the inverter of A
Simulation of the display circuit in its minimal form, in which the output Y is 1 with A and D at 1 and B and C at 0, with a delay element behind the inverter of A

Open in the simulator

4.3 Hazard analysis: the redundant prime implicant returns

A hazard analysis (German: Hazard-Analyse) finds such places and removes them before they do harm. For logic hazards in a two-level circuit, Reichardt recommends the following procedure [18, p. 135]:

  1. Set up the minimal disjunctive normal form (DNF) or conjunctive normal form (CNF).
  2. Determine for each prime implicant used whether the change of a single input leads from it to a second, completely separate prime implicant.
  3. Add redundant prime implicants that unite the prime implicants found in point 2.

For point 2, it helps to look for a variable that appears as it is in one product term and negated in another [12, p. 67], [9, p. 131]. If the other variables are set so that both terms reduce to this variable, the expression becomes : always 1 in theory, but in practice possibly 0 for a moment [9, pp. 130–131]. In the minimal DNF of the display, only appears in both forms: negated in and , as it is in . Two changes of therefore lead between separate prime implicants:

  • from to , if and – the redundant prime implicant unites them;
  • from to , if and – the redundant prime implicant unites them.

These are exactly the two redundant prime implicants that we left out in section 1.2. Added to the minimal DNF, they make the display circuit free of logic hazards:

where:

  • is the output ‘display on’, 0 or 1
  • , , and are the inputs ‘call active’, ‘proximity sensor covered’, ‘power button pressed’ and ‘phone lifted’, each 0 or 1

While changes with and , the term does not depend on and stays 1; it holds the output at 1, however the delays turn out. LaMeres removes hazards in the same way, with the complete sum of all prime implicants [5, p. 143]; Donzellini and his co-authors show it with a multiplexer [17, pp. 67–69]. In the simulator, switch from 1 to 0 again with and : now stays 1.

Simulation of the hazard-free display circuit with five AND gates, including the redundant prime implicants B bar C and B bar D, in which Y is 1 with A and D at 1 and B and C at 0, with the delay element still in place
Simulation of the hazard-free display circuit with five AND gates, including the redundant prime implicants B bar C and B bar D, in which Y is 1 with A and D at 1 and B and C at 0, with the delay element still in place

Open in the simulator

The price is two more AND gates, and the circuit is no longer minimal [17, p. 69]. One more caveat: the synthesis tools for programmable devices usually optimize redundant prime implicants away again [18, p. 135]. There, hazard-free signals are produced with flip-flops [18, p. 135], which you will meet in DET-06.

4.4 Two inputs at once: the function hazard

The redundant prime implicant helps when a single input changes. If several inputs change at the same moment, a hazard can arise that no additional term removes. Fricke shows this with a Karnaugh map in which two inputs change together. The inputs then take one of two ways through the map, depending on which of them acts first: on one way, the output stays 1; on the other, the way passes through a cell with a 0, and a hazard appears [12, pp. 67–68].

You know an example from counting in binary (DET-01, 6.3). A counter with the three bits , and , with as the bit of the highest weight, goes from 3 to 4, that is, from 011 to 100: all three bits change. Suppose a gate is to report that the count has reached 6 or more, . At 3 and at 4, . But the three bits never change at exactly the same moment. If becomes 1 before becomes 0, the gate sees 111 or 110 for a moment, and delivers a short 1 (figure): a static 0 hazard.

Timing diagram of a counter going from 3 to 4, in which A rises before B and C fall and the AND of A and B shows a short pulse, a static 0 hazard
Timing diagram of a counter going from 3 to 4, in which A rises before B and C fall and the AND of A and B shows a short pulse, a static 0 hazard

Why can no additional term remove this pulse? The combinations that the gate passes through on its way, 111 and 110, are combinations for which the function itself demands . An additional product term can only add ones; it cannot remove a one that the function demands. Whether the pulse appears depends on the order in which the bits arrive. No additional term can remove such a hazard; there is no logical solution for it [20]. It is avoided by reading the output only when all changes have settled, or by making sure that the inputs never change at the same time [20]. Circuits that read their signals only at moments given by a clock can therefore generally tolerate hazards [17, p. 70]. You will meet the clock in DET-06 and such counters in DET-08.

5 Counted although it never happened – Combinational logic circuits and sequential circuits

5.1 Without memory and with memory

The circuits that you have designed so far, such as the ringtone of DET-03 or the display and the release logic of this lesson, have one thing in common: their output depends only on the values of their inputs at the same moment. Such a circuit is a combinational logic circuit (German: Schaltnetz) [12, p. 53], [5, p. 211]. The combination of its inputs alone fixes the value of its output [17, p. 19], and a truth table describes it completely: the same combination of inputs always gives the same output.

A sequential circuit (German: Schaltwerk) behaves differently: its output depends not only on the instantaneous values of its inputs, but also on past ones [5, p. 211], [12, p. 71]. A sequential circuit can therefore store information [12, p. 71]. Fricke describes its structure (figure): a combinational logic circuit with at least one output fed back to its inputs, with a delay in this feedback (German: Rückkopplung); the values that are fed back form the state (German: Zustand) of the circuit [12, p. 71].

Block diagram of a sequential circuit: a combinational logic circuit whose inputs and outputs are shown, with one output fed back through a delay to an input as the state
Block diagram of a sequential circuit: a combinational logic circuit whose inputs and outputs are shown, with one output fed back through a delay to an input as the state

You meet both types every day. In your smartphone, the logic that switches the display of chapter 1 and the logic of the ringtone of DET-03 are combinational logic circuits: whether the display is on and whether the phone rings follow from the inputs of the moment. The notice of a missed call, in contrast, stays until you have looked at it, and a step counter remembers every step so far – both are sequential circuits. The heat pump contains both as well. In the simplified rule of chapter 3, whether its compressor may start depends only on the six signals at this moment, a task for a combinational logic circuit; the same holds for the collective fault of DET-02, 3.4, which is 1 as long as any fault bit is 1. The number of compressor starts – 8 003 in DET-01, 9.1 – depends on everything that has happened before; a counter that counts the starts is a sequential circuit, and so is a fault message that stays stored until someone acknowledges it.

Combinational logic circuitSequential circuit
Output depends onthe present inputs onlythe present and the past inputs
Informationnot storedstored as its state
Structuregates without feedbackcombinational logic circuit with feedback
Smartphonedisplay logic, ringtone logicnotice of a missed call, step counter
Heat pumprelease logic, collective faultcounter of the compressor starts, fault message

The storage elements of sequential circuits, latches and flip-flops, follow in DET-06, counters in DET-08 and finite state machines in DET-09.

5.2 When a short pulse leaves a mark

A hazard lasts a few nanoseconds and then disappears. If the output drives something slow, it does no harm: nobody sees 9 ns on the display, and a relay, which needs milliseconds to switch, does not react to it at all. According to Lou and Yang, a spurious pulse in a combinational logic circuit usually does no serious harm, because it disappears quickly; it becomes dangerous when it reaches a sequential circuit such as a flip-flop and changes its state [9, p. 132]. Donzellini and his co-authors, too, consider it necessary to eliminate hazards only where they do harm, typically in sequential circuits without a clock [17, p. 70].

Our heat pump shows what this means. Suppose its counter counted every change of the release signal from 0 to 1 as a compressor start. A static 1 hazard at the release – a dip from 1 to 0 and back to 1 – would then be counted as a start that never happened, and the counter would show one start too many from then on. In our release logic of chapter 3, each signal appears only as it is or only negated, so the change of a single input cannot cause a logic hazard there [12, p. 67], [9, p. 131]. But if, for example, without a block and without a heating demand, the hot-water demand ended at the very moment when frost protection began, a function hazard could cause exactly such a dip.

The robot vacuum of the second guiding question suffers from the same kind of error. If a short pulse reaches the reset input of its Wi-Fi module, the module restarts and has to rebuild its connection to the router: the connection drops, even in the middle of the night, when the robot stands still in its dock.

A robot vacuum with a small blue light stands in its charging dock against the wall of a dark living room at night, near a sofa, while pale stripes of moonlight fall on the wooden floor
Image by Qwen-Image 2.1

Where a short pulse can reach an input that reacts at any moment, such as an input of a sequential circuit without a clock or a clock signal itself, logic hazards must be avoided [18, p. 135]. In sequential circuits with a clock, which read their signals only at fixed moments, hazards can be tolerated [17, p. 70].

6 What have you learnt? – Summary and answers to the guiding questions

6.1 The building blocks of knowledge

  • Prime implicants: An implicant is a product term that implies the function; a prime implicant is an implicant that cannot be enlarged. Essential prime implicants cover a one that no other prime implicant covers and belong to every minimal disjunctive normal form (DNF); redundant ones can be left out. If ones remain, a selection of the other prime implicants completes the minimal DNF, which is then not always unique.
  • Quine–McCluskey algorithm: It writes the minterms as codes and sorts them into groups by the number of their ones. In part 1, it unites terms of consecutive groups that differ in one position, table by table, until the prime implicants remain; in part 2, the prime implicant chart selects the essential ones and, if needed, a few more. Its effort grows exponentially with the number of inputs; for large functions, software uses heuristic methods such as the Espresso heuristic logic minimizer.
  • Hazard analysis: Different delays let the output stumble while the inputs change: static 1 hazards, static 0 hazards and dynamic hazards. In a two-level circuit, a logic hazard, caused by the change of a single input, shows up as two neighbouring ones in different loops, and a redundant prime implicant removes it. A function hazard, caused by several inputs that change at once, cannot be removed by an additional term.
  • Combinational logic circuits and sequential circuits: The output of a combinational logic circuit depends only on its present inputs; a sequential circuit also depends on past inputs and stores information. A hazard does harm above all where a sequential circuit takes it in.

With these building blocks, you minimize a function by table instead of by eye, and you find out whether the minimal circuit also switches cleanly while its inputs change.

6.2 Answers to the guiding questions

Can a computer minimize a circuit for you – and how does it go about it?
Yes. The Quine–McCluskey algorithm needs no picture, only fixed rules: it writes the minterms as codes, unites terms that differ in one position, table by table, until the prime implicants remain, and then selects the fewest of them that cover all ones in the prime implicant chart. For the display, it finds the same three product terms as the Karnaugh map. Because its effort grows exponentially with the number of inputs, minimization software uses heuristic methods such as the Espresso heuristic logic minimizer for large functions.

Why does a cheap robot vacuum drop its Wi-Fi connection in the middle of the night?
Because of a hazard. When signals change, different delays can produce a short pulse that should not be there. If such a pulse reaches a circuit that remembers, such as the reset of the Wi-Fi module, the module restarts and has to reconnect. A circuit avoids this by removing its logic hazards with redundant prime implicants or by reading its signals only at fixed moments.

Six signals decide whether a heat pump may start: what do you do when a Karnaugh map becomes too large?
You leave the work to the algorithm. With six inputs, the map has 64 cells and is hard to read without mistakes. The algorithm treats the combinations that never occur as don’t cares, unites the 31 ones and the 16 don’t cares in six tables and leaves three essential prime implicants: . Here, as for even more inputs, a computer program does the work.


Where do I look things up? – Sources and references

All sources that I cite in this script with a number in square brackets, such as [5], are listed on the page References. There you will also find the books that I recommend for looking things up, the image licences and a note on the use of AI.


Exercises for this lesson

Exercise DET-04.01 – Prime implicants
Exercise DET-04.02 – Quine–McCluskey algorithm
Exercise DET-04.03 – Functions with many inputs
Exercise DET-04.04 – Hazards
Exercise DET-04.05 – Combinational or sequential
Exercise DET-04.06 – Vibration for an incoming call
Exercise DET-04.07 – Hot-water charging in comfort and eco times


Slides for this lesson

The slides of this lesson as PDF: Slides DET-04


⏭️ Continue with: DET-05 Codes and code converters 🔗