Lesson 5 +35 XP

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.
Rowx y zMintermNameMaxtermName
00 0 0x'y'z'm0x + y + zM0
10 0 1x'y'zm1x + y + z'M1
20 1 0x'yz'm2x + y' + zM2
30 1 1x'yzm3x + y' + z'M3
41 0 0xy'z'm4x' + y + zM4
51 0 1xy'zm5x' + y + z'M5
61 1 0xyz'm6x' + y' + zM6
71 1 1xyzm7x' + 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 zF
0 0 00
0 0 11
0 1 00
0 1 10
1 0 01
1 0 11
1 1 01
1 1 11
F = ∑ m(1, 4, 5, 6, 7) = x'y'z + xy'z' + xy'z + xyz' + xyz
F = ∏ M(0, 2, 3) = (x + y + z)(x + y' + z)(x + y' + z')

Converting between the two forms: the index lists are complementary. Write the missing indices and switch Sigma to Pi:

F = ∑ m(1, 4, 5, 6, 7) = ∏ M(0, 2, 3) qquad F' = ∑ m(0, 2, 3) = ∏ M(1, 4, 5, 6, 7)
SolvedExample 1 · Expanding to a sum of minterms

Express F = A + B'C as a sum of minterms.

  1. The term A is missing B and C: A = A(B + B')(C + C') = ABC + ABC' + AB'C + AB'C'.
  2. The term B'C is missing A: B'C = AB'C + A'B'C.
  3. Combine, removing the duplicate AB'C: A'B'C + AB'C' + AB'C + ABC' + ABC.
AnswerF = ∑ m(1, 4, 5, 6, 7)
SolvedExample 2 · Expanding to a product of maxterms

Express F = xy + x'z as a product of maxterms.

  1. 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).
  2. x' + y = x' + y + zz' = (x' + y + z)(x' + y + z') = M4 M5.
  3. x + z = x + z + yy' = (x + y + z)(x + y' + z) = M0 M2.
  4. y + z = y + z + xx' = (x + y + z)(x' + y + z) = M0 M4.
  5. Remove duplicates: M0 M2 M4 M5.
AnswerF = ∏ M(0, 2, 4, 5), which is also ∑ m(1, 3, 6, 7)

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:

FunctionExpressionNameNote
F00Nullconstant 0
F1xyAND
F6xy' + x'yXORx oplus y, "x or y but not both"
F7x + yOR
F8(x + y)'NOR
F9xy + x'y'XNOR (equivalence)(x oplus y)'
F11x + y'Implication y ⇒ x
F14(xy)'NAND
F151Identityconstant 1

4. Digital Logic Gates

Logic gate symbols, expressions and truth tablesLogic gate symbols, expressions and truth tables

GateExpressionOutput 1 when2-input truth column (00, 01, 10, 11)
ANDF = xyall inputs 10 0 0 1
ORF = x + yany input 10 1 1 1
NOT (inverter)F = x'input 0
BufferF = xinput 1
NANDF = (xy)'any input 01 1 1 0
NORF = (x + y)'all inputs 01 0 0 0
XORF = x oplus yinputs differ (odd number of 1s)0 1 1 0
XNORF = (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 onlyNOT, AND and OR built from NAND gates only, and from NOR gates only

FunctionUsing NAND onlyUsing 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 neededNOT 1, AND 2, OR 3NOT 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-NANDF = AB + CD as AND-OR and as NAND-NAND

SolvedExample 3 · NAND-only implementation

Implement F = AB + CD + E using only NAND gates.

  1. Write F as a double complement: F = ((AB + CD + E)')'.
  2. Apply De Morgan to the inner complement: F = big((AB)' · (CD)' · E'big)'.
  3. Level 1: NAND(A, B) and NAND(C, D). The literal E enters level 2 as E' (one NAND used as inverter).
  4. Level 2: a 3-input NAND of (AB)', (CD)' and E'.
Answer4 NAND gates (two 2-input, one inverter, one 3-input)
SolvedExample 4 · NOR-only implementation

Implement F = (A + B)(C + D)E using only NOR gates.

  1. F = big((A + B)' + (C + D)' + E'big)' by De Morgan.
  2. Level 1: NOR(A, B) and NOR(C, D); E passes through a NOR inverter to give E'.
  3. Level 2: a 3-input NOR.
Answer4 NOR gates

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:

VERILOG
// 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
endmodule

Both circuits produce the same function, ∑ m(3, 7, 11, 12, 13, 14, 15):

OUTPUT
F = 1 at minterms: 3 7 11 12 13 14 15
mismatches between the two circuits: 0

6. 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).

ParameterMeaning
Fan-innumber of inputs a gate has
Fan-outnumber of gate inputs one output can drive reliably
Propagation delaytime from an input change to the output change (tpd)
Power dissipationpower used by the gate
Noise marginhow much noise voltage the input can tolerate without error
💡 Tip

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.
🎯 END-TERM EXAM PREP

📝 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)