In Boolean algebra, any Boolean function can be expressed in the canonical disjunctive normal form (CDNF),[1] minterm canonical form, or Sum of Products (SoP or SOP) as a disjunction (OR) of minterms. The De Morgan dual is the canonical conjunctive normal form (CCNF), maxterm canonical form, or Product of Sums (PoS or POS) which is a conjunction (AND) of maxterms. These forms can be useful for the simplification of Boolean functions, which is of great importance in the optimization of Boolean formulas in general and digital circuits in particular.
Other canonical forms include the complete sum of prime implicants or Blake canonical form (and its dual), and the algebraic normal form (also called Zhegalkin or Reed–Muller).
For a boolean function of
n
{x1,...,xn}
n
There are 2n minterms of n variables, since a variable in the minterm expression can be in either its direct or its complemented form—two choices per variable. Minterms are often numbered by a binary encoding of the complementation pattern of the variables, where the variables are written in a standard order, usually alphabetical. This convention assigns the value 1 to the direct form (
xi
x'i
n2 | |
\sum\limits | |
i=1 |
i-1\operatorname{value}(xi)
abc'
m6
Given the truth table of a logical function, it is possible to write the function as a "sum of products" or "sum of minterms". This is a special form of disjunctive normal form. For example, if given the truth table for the arithmetic sum bit u of one bit position's logic of an adder circuit, as a function of x and y from the addends and the carry in, ci:
ci | x | y | u(ci,x,y) | |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
0 | 0 | 1 | 1 | |
0 | 1 | 0 | 1 | |
0 | 1 | 1 | 0 | |
1 | 0 | 0 | 1 | |
1 | 0 | 1 | 0 | |
1 | 1 | 0 | 0 | |
1 | 1 | 1 | 1 |
Observing that the rows that have an output of 1 are the 2nd, 3rd, 5th, and 8th, we can write u as a sum of minterms
m1,m2,m4,
m7
u(ci,x,y)=m1+m2+m4+m7=(ci',x',y)+(ci',x,y')+(ci,x',y')+(ci,x,y)
For a boolean function of variables
{x1,...,xn}
There are again 2n maxterms of variables, since a variable in the maxterm expression can also be in either its direct or its complemented form—two choices per variable. The numbering is chosen so that the complement of a minterm is the respective maxterm. That is, each maxterm is assigned an index based on the opposite conventional binary encoding used for minterms. The maxterm convention assigns the value 0 to the direct form
(xi)
(x'i)
a'+b'+c
(a'+b'+c)'
abc'=m6
If one is given a truth table of a logical function, it is possible to write the function as a "product of sums" or "product of maxterms". This is a special form of conjunctive normal form. For example, if given the truth table for the carry-out bit co of one bit position's logic of an adder circuit, as a function of x and y from the addends and the carry in, ci:
ci | x | y | co(ci,x,y) | |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
0 | 0 | 1 | 0 | |
0 | 1 | 0 | 0 | |
0 | 1 | 1 | 1 | |
1 | 0 | 0 | 0 | |
1 | 0 | 1 | 1 | |
1 | 1 | 0 | 1 | |
1 | 1 | 1 | 1 |
Observing that the rows that have an output of 0 are the 1st, 2nd, 3rd, and 5th, we can write co as a product of maxterms
M0,M1,M2
M4
co(ci,x,y)=M0M1M2M4=(ci+x+y)(ci+x+y')(ci+x'+y)(ci'+x+y)
It is often the case that the canonical minterm form is equivalent to a smaller SoP form. This smaller form would still consist of a sum of product terms, but have fewer product terms and/or product terms that contain fewer variables. For example, the following 3-variable function:
a | b | c | f(a,b,c) | |
---|---|---|---|---|
0 | 0 | 0 | 0 | |
0 | 0 | 1 | 0 | |
0 | 1 | 0 | 0 | |
0 | 1 | 1 | 1 | |
1 | 0 | 0 | 0 | |
1 | 0 | 1 | 0 | |
1 | 1 | 0 | 0 | |
1 | 1 | 1 | 1 |
has the canonical minterm representation
f=a'bc+abc
f=bc
bc=a'bc+abc
While this example was simplified by applying normal algebraic methods [<math>f = (a' + a) b c</math>], in less obvious cases a convenient method for finding minimal PoS/SoP forms of a function with up to four variables is using a Karnaugh map. The Quine–McCluskey algorithm can solve slightly larger problems. The field of logic optimization developed from the problem of finding optimal implementations of Boolean functions, such as minimal PoS and SoP forms.
The sample truth tables for minterms and maxterms above are sufficient to establish the canonical form for a single bit position in the addition of binary numbers, but are not sufficient to design the digital logic unless your inventory of gates includes AND and OR. Where performance is an issue (as in the Apollo Guidance Computer), the available parts are more likely to be NAND and NOR because of the complementing action inherent in transistor logic. The values are defined as voltage states, one near ground and one near the DC supply voltage Vcc, e.g. +5 VDC. If the higher voltage is defined as the 1 "true" value, a NOR gate is the simplest possible useful logical element.
Specifically, a 3-input NOR gate may consist of 3 bipolar junction transistors with their emitters all grounded, their collectors tied together and linked to Vcc through a load impedance. Each base is connected to an input signal, and the common collector point presents the output signal. Any input that is a 1 (high voltage) to its base shorts its transistor's emitter to its collector, causing current to flow through the load impedance, which brings the collector voltage (the output) very near to ground. That result is independent of the other inputs. Only when all 3 input signals are 0 (low voltage) do the emitter-collector impedances of all 3 transistors remain very high. Then very little current flows, and the voltage-divider effect with the load impedance imposes on the collector point a high voltage very near to Vcc.
The complementing property of these gate circuits may seem like a drawback when trying to implement a function in canonical form, but there is a compensating bonus: such a gate with only one input implements the complementing function, which is required frequently in digital logic.
This example assumes the Apollo parts inventory: 3-input NOR gates only, but the discussion is simplified by supposing that 4-input NOR gates are also available (in Apollo, those were compounded out of pairs of 3-input NORs).
A set of 8 NOR gates, if their inputs are all combinations of the direct and complement forms of the 3 input variables ci, x, and y, always produce minterms, never maxterms—that is, of the 8 gates required to process all combinations of 3 input variables, only one has the output value 1. That's because a NOR gate, despite its name, could better be viewed (using De Morgan's law) as the AND of the complements of its input signals.
The reason this is not a problem is the duality of minterms and maxterms, i.e. each maxterm is the complement of the like-indexed minterm, and vice versa.
In the minterm example above, we wrote
u(ci,x,y)=m1+m2+m4+m7
u(ci,x,y)=AND(M0,M3,M5,M6)=NOR(m0,m3,m5,m6).
ci | x | y | M0 | M3 | M5 | M6 | AND | u(ci,x,y) | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | |
0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | |
0 | 1 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | |
1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | |
1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | |
1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
ci | x | y | m0 | m3 | m5 | m6 | NOR | u(ci,x,y) | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | |
0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | |
1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | |
1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
co(ci,x,y)=M0M1M2M4
co(ci,x,y)=AND(M0,M1,M2,M4)=NOR(m0,m1,m2,m4).
ci | x | y | M0 | M1 | M2 | M4 | AND | co(ci,x,y) | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | |
0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | |
0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | |
0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | |
1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | |
1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
ci | x | y | m0 | m1 | m2 | m4 | NOR | co(ci,x,y) | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | |
0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | |
0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | |
1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | |
1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | |
1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 1 |
One might suppose that the work of designing an adder stage is now complete, but we haven't addressed the fact that all 3 of the input variables have to appear in both their direct and complement forms. There's no difficulty about the addends x and y in this respect, because they are static throughout the addition and thus are normally held in latch circuits that routinely have both direct and complement outputs. (The simplest latch circuit made of NOR gates is a pair of gates cross-coupled to make a flip-flop: the output of each is wired as one of the inputs to the other.) There is also no need to create the complement form of the sum u. However, the carry out of one bit position must be passed as the carry into the next bit position in both direct and complement forms. The most straightforward way to do this is to pass co through a 1-input NOR gate and label the output co′, but that would add a gate delay in the worst possible place, slowing down the rippling of carries from right to left. An additional 4-input NOR gate building the canonical form of co′ (out of the opposite minterms as co) solves this problem.
co'(ci,x,y)=AND(M3,M5,M6,M7)=NOR(m3,m5,m6,m7).
ci | x | y | M3 | M5 | M6 | M7 | AND | co'(ci,x,y) | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | |
0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |
0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | |
0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | |
1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | |
1 | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | |
1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | |
1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |
ci | x | y | m3 | m5 | m6 | m7 | NOR | co'(ci,x,y) | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | |
0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | |
1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | |
1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | |
1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | |
1 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 |
m7
Now we could have implemented those functions exactly according to their SoP and PoS canonical forms, by turning NOR gates into the functions specified. A NOR gate is made into an OR gate by passing its output through a 1-input NOR gate; and it is made into an AND gate by passing each of its inputs through a 1-input NOR gate. However, this approach not only increases the number of gates used, but also doubles the number of gate delays processing the signals, cutting the processing speed in half. Consequently, whenever performance is vital, going beyond canonical forms and doing the Boolean algebra to make the unenhanced NOR gates do the job is well worthwhile.
We have now seen how the minterm/maxterm tools can be used to design an adder stage in canonical form with the addition of some Boolean algebra, costing just 2 gate delays for each of the outputs. That's the "top-down" way to design the digital circuit for this function, but is it the best way? The discussion has focused on identifying "fastest" as "best," and the augmented canonical form meets that criterion flawlessly, but sometimes other factors predominate. The designer may have a primary goal of minimizing the number of gates, and/or of minimizing the fanouts of signals to other gates since big fanouts reduce resilience to a degraded power supply or other environmental factors. In such a case, a designer may develop the canonical-form design as a baseline, then try a bottom-up development, and finally compare the results.
The bottom-up development involves noticing that u = ci XOR (x XOR y), where XOR means eXclusive OR [true when either input is true but not when both are true], and that co = ci x + x y + y ci. One such development takes twelve NOR gates in all: six 2-input gates and two 1-input gates to produce u in 5 gate delays, plus three 2-input gates and one 3-input gate to produce co′ in 2 gate delays. The canonical baseline took eight 3-input NOR gates plus three 4-input NOR gates to produce u, co and co′ in 2 gate delays. If the circuit inventory actually includes 4-input NOR gates, the top-down canonical design looks like a winner in both gate count and speed. But if (contrary to our convenient supposition) the circuits are actually 3-input NOR gates, of which two are required for each 4-input NOR function, then the canonical design takes 14 gates compared to 12 for the bottom-up approach, but still produces the sum digit u considerably faster. The fanout comparison is tabulated as:
Variables | Top-down | Bottom-up | |
---|---|---|---|
x | 4 | 1 | |
x' | 4 | 3 | |
y | 4 | 1 | |
y' | 4 | 3 | |
ci | 4 | 1 | |
ci' | 4 | 3 | |
M or m | 4@1,4@2 | N/A | |
x XOR y | N/A | 2 | |
Misc | N/A | 5@1 | |
Max | 4 | 3 |
We'll leave the exact circuitry of the bottom-up design of which all these statements are true as an exercise for the interested reader, assisted by one more algebraic formula: u = ci(x XOR y) + ci′(x XOR y)′]′. Decoupling the carry propagation from the sum formation in this way is what elevates the performance of a carry-lookahead adder over that of a ripple carry adder.
One application of Boolean algebra is digital circuit design, with one goal to minimize the number of gates and another to minimize the settling time.
There are sixteen possible functions of two variables, but in digital logic hardware, the simplest gate circuits implement only four of them: conjunction (AND), disjunction (inclusive OR), and the respective complements of those (NAND and NOR).
Most gate circuits accept more than 2 input variables; for example, the spaceborne Apollo Guidance Computer, which pioneered the application of integrated circuits in the 1960s, was built with only one type of gate, a 3-input NOR, whose output is true only when all 3 inputs are false.[3] [4]