Loading lessons...
Canonical Forms (Minterms & Maxterms), Logic Gates & Universal Gates
Canonical Forms (Minterms & Maxterms), Logic Gates & Universal Gates
A Boolean function can be written in many ways, but it has exactly one truth table. Canonical forms turn that truth table directly into an expression: the sum of its minterms or the product of its maxterms. This lesson also introduces the logic gates that build these expressions, and shows why NAND and NOR are called universal gates.
1. Minterms and Maxterms
For n variables there are 2n input combinations. For each combination we define:
- a minterm mi: the AND of all n variables, each complemented if its bit is 0. It equals 1 for that one combination only.
- a maxterm Mi: the OR of all n variables, each complemented if its bit is 1. It equals 0 for that one combination only.
| Row | x y z | Minterm | Name | Maxterm | Name |
|---|---|---|---|---|---|
| 0 | 0 0 0 | x'y'z' | m0 | x + y + z | M0 |
| 1 | 0 0 1 | x'y'z | m1 | x + y + z' | M1 |
| 2 | 0 1 0 | x'yz' | m2 | x + y' + z | M2 |
| 3 | 0 1 1 | x'yz | m3 | x + y' + z' | M3 |
| 4 | 1 0 0 | xy'z' | m4 | x' + y + z | M4 |
| 5 | 1 0 1 | xy'z | m5 | x' + y + z' | M5 |
| 6 | 1 1 0 | xyz' | m6 | x' + y' + z | M6 |
| 7 | 1 1 1 | xyz | m7 | x' + y' + z' | M7 |
Each maxterm is the complement of the minterm with the same index: Mi = mi'. For example m3' = (x'yz)' = x + y' + z' = M3.
2. Sum of Minterms and Product of Maxterms
Any function can be written as:
- Sum of minterms (canonical SOP): OR together the minterms of the rows where F = 1.
- Product of maxterms (canonical POS): AND together the maxterms of the rows where F = 0.
| x y z | F |
|---|---|
| 0 0 0 | 0 |
| 0 0 1 | 1 |
| 0 1 0 | 0 |
| 0 1 1 | 0 |
| 1 0 0 | 1 |
| 1 0 1 | 1 |
| 1 1 0 | 1 |
| 1 1 1 | 1 |
Converting between the two forms: the index lists are complementary. Write the missing indices and switch Sigma to Pi:
Express F = A + B'C as a sum of minterms.
- The term A is missing B and C: A = A(B + B')(C + C') = ABC + ABC' + AB'C + AB'C'.
- The term B'C is missing A: B'C = AB'C + A'B'C.
- Combine, removing the duplicate AB'C: A'B'C + AB'C' + AB'C + ABC' + ABC.
Express F = xy + x'z as a product of maxterms.
- Use the distributive law a + bc = (a + b)(a + c): F = (xy + x')(xy + z) = (x + x')(y + x')(x + z)(y + z) = (x' + y)(x + z)(y + z).
- x' + y = x' + y + zz' = (x' + y + z)(x' + y + z') = M4 M5.
- x + z = x + z + yy' = (x + y + z)(x + y' + z) = M0 M2.
- y + z = y + z + xx' = (x + y + z)(x' + y + z) = M0 M4.
- Remove duplicates: M0 M2 M4 M5.
Standard (non-canonical) forms
In a canonical form every term contains all variables. In practice we use simpler standard forms:
- SOP (sum of products): F = y' + xy + x'yz', terms may miss variables; built as AND gates feeding an OR gate.
- POS (product of sums): F = x(y' + z)(x' + y + z'); built as OR gates feeding an AND gate.
Both are two-level circuits: a signal passes through at most two gates (ignoring inverters on the inputs), so they are fast.
3. All Sixteen Functions of Two Variables
With two inputs there are 24 = 16 possible truth tables, so 16 functions. The important ones:
| Function | Expression | Name | Note |
|---|---|---|---|
| F0 | 0 | Null | constant 0 |
| F1 | xy | AND | |
| F6 | xy' + x'y | XOR | x oplus y, "x or y but not both" |
| F7 | x + y | OR | |
| F8 | (x + y)' | NOR | |
| F9 | xy + x'y' | XNOR (equivalence) | (x oplus y)' |
| F11 | x + y' | Implication y ⇒ x | |
| F14 | (xy)' | NAND | |
| F15 | 1 | Identity | constant 1 |
4. Digital Logic Gates
Logic gate symbols, expressions and truth tables
| Gate | Expression | Output 1 when | 2-input truth column (00, 01, 10, 11) |
|---|---|---|---|
| AND | F = xy | all inputs 1 | 0 0 0 1 |
| OR | F = x + y | any input 1 | 0 1 1 1 |
| NOT (inverter) | F = x' | input 0 | |
| Buffer | F = x | input 1 | |
| NAND | F = (xy)' | any input 0 | 1 1 1 0 |
| NOR | F = (x + y)' | all inputs 0 | 1 0 0 0 |
| XOR | F = x oplus y | inputs differ (odd number of 1s) | 0 1 1 0 |
| XNOR | F = (x oplus y)' | inputs equal (even number of 1s) | 1 0 0 1 |
Multi-input gates. AND and OR extend to any number of inputs because they are associative. NAND and NOR are not associative: (x uparrow y) uparrow z ≠ x uparrow (y uparrow z), so a 3-input NAND is defined as (xyz)', not as two cascaded 2-input NANDs. A multi-input XOR is 1 when an odd number of inputs are 1 (it is an odd function), which is why XOR gates build parity circuits.
Useful XOR identities: x oplus 0 = x, x oplus 1 = x', x oplus x = 0, x oplus x' = 1, x oplus y' = x' oplus y = (x oplus y)'.
Positive and negative logic
In positive logic the higher voltage (H) means 1. In negative logic H means 0. The same physical gate changes name: a positive-logic AND gate is a negative-logic OR gate, and a positive-logic NAND is a negative-logic NOR. This is De Morgan's theorem in hardware.
5. Universal Gates: NAND and NOR
A gate is universal if NOT, AND and OR (and therefore every Boolean function) can be built from it alone. NAND and NOR are both universal. Chips are cheaper to make with one gate type, and in CMOS a NAND or NOR gate is faster and smaller than an AND or OR gate.
NOT, AND and OR built from NAND gates only, and from NOR gates only
| Function | Using NAND only | Using NOR only |
|---|---|---|
| NOT x' | (x · x)': tie the inputs | (x + x)': tie the inputs |
| AND xy | ((xy)')': NAND then NAND-as-NOT | (x' + y')': invert inputs, then NOR |
| OR x + y | (x'y')': invert inputs, then NAND | ((x + y)')': NOR then NOR-as-NOT |
| Gates needed | NOT 1, AND 2, OR 3 | NOT 1, AND 3, OR 2 |
Two-level NAND-NAND and NOR-NOR implementations
- An SOP expression maps to NAND-NAND: replace every AND and the final OR with NAND gates. By De Morgan, ((AB)'(CD)')' = AB + CD.
- A POS expression maps to NOR-NOR: replace every OR and the final AND with NOR gates: ((A + B)' + (C + D)')' = (A + B)(C + D).
- A single literal that goes straight to the second level must be complemented (it passes through no first-level gate).
F = AB + CD as AND-OR and as NAND-NAND
Implement F = AB + CD + E using only NAND gates.
- Write F as a double complement: F = ((AB + CD + E)')'.
- Apply De Morgan to the inner complement: F = big((AB)' · (CD)' · E'big)'.
- Level 1: NAND(A, B) and NAND(C, D). The literal E enters level 2 as E' (one NAND used as inverter).
- Level 2: a 3-input NAND of (AB)', (CD)' and E'.
Implement F = (A + B)(C + D)E using only NOR gates.
- F = big((A + B)' + (C + D)' + E'big)' by De Morgan.
- Level 1: NOR(A, B) and NOR(C, D); E passes through a NOR inverter to give E'.
- Level 2: a 3-input NOR.
The same circuit in Verilog gate primitives
Verilog has built-in gate primitives (and, or, not, nand, nor, xor, xnor). The first port is the output. The testbench below builds F = AB + CD both as AND-OR and as NAND-NAND, and checks them against each other on all 16 inputs:
// F = AB + CD built two ways: AND-OR and NAND-NAND (gate primitives)
module f_and_or (
input a, b, c, d,
output f
);
wire t1, t2;
and g1 (t1, a, b);
and g2 (t2, c, d);
or g3 (f, t1, t2);
endmodule
module f_nand_nand (
input a, b, c, d,
output f
);
wire t1, t2;
nand g1 (t1, a, b);
nand g2 (t2, c, d);
nand g3 (f, t1, t2);
endmodule
module tb;
reg a, b, c, d;
wire f1, f2;
integer i, bad;
f_and_or u1 (a, b, c, d, f1);
f_nand_nand u2 (a, b, c, d, f2);
initial begin
bad = 0;
$write("F = 1 at minterms:");
for (i = 0; i < 16; i = i + 1) begin
{a, b, c, d} = i;
#1;
if (f1 !== f2) bad = bad + 1;
if (f1) $write(" %0d", i);
end
$display("");
$display("mismatches between the two circuits: %0d", bad);
end
endmoduleBoth circuits produce the same function, ∑ m(3, 7, 11, 12, 13, 14, 15):
F = 1 at minterms: 3 7 11 12 13 14 15
mismatches between the two circuits: 06. Logic Families and Gate Parameters
Gates are sold as integrated circuits (ICs) such as the 7400 (four 2-input NAND gates). The main logic families are TTL (transistor-transistor logic, 74xx series), ECL (emitter-coupled logic, fastest, high power) and CMOS (lowest power, used in almost all modern chips).
| Parameter | Meaning |
|---|---|
| Fan-in | number of inputs a gate has |
| Fan-out | number of gate inputs one output can drive reliably |
| Propagation delay | time from an input change to the output change (tpd) |
| Power dissipation | power used by the gate |
| Noise margin | how much noise voltage the input can tolerate without error |
Key points to remember
- Minterm mi: 1 at row i only (complement where the bit is 0). Maxterm Mi: 0 at row i only (complement where the bit is 1). Mi = mi'.
- F = Sigma m(rows where F = 1) = Pi M(rows where F = 0); the index lists are complementary.
- Expand a missing variable v with (v + v') in SOP, or vv' in POS.
- NAND and NOR are universal. SOP becomes NAND-NAND; POS becomes NOR-NOR.
- XOR is 1 for an odd number of 1s; NAND and NOR are not associative.
📝 IPU End-Term Exam Corner (5-10 Marks)
- Q1. Define minterm and maxterm. Express F = A + B'C in sum of minterms and product of maxterms. (5 Marks)
- Write: the 3-variable minterm/maxterm table, the expansion with (B + B')(C + C'), and the complementary index list Pi M(0, 2, 3).
- Q2. Why are NAND and NOR called universal gates? Realize NOT, AND and OR using (a) only NAND (b) only NOR. (10 Marks)
- Q3. Implement F = AB + CD + E using NAND gates only. (5 Marks)
- Q4. Express F = xy + x'z as a product of maxterms. (5 Marks)
- Q5. Draw the symbols and truth tables of XOR and XNOR gates. Show that a 3-input XOR is 1 for an odd number of 1s. (5 Marks)