This is the foundational chapter of the book. It introduces logic variables, truth tables, and the three fundamental operations: AND, OR, and NOT. The chapter shows how to build logic networks from gates, covers Boolean algebra and all its key theorems (commutative, associative, distributive, DeMorgan's, absorption), and introduces the Venn diagram as a visualization tool. Synthesis techniques are presented for sum-of-products (SOP) and product-of-sums (POS) canonical forms, along with NAND-only and NOR-only implementations. Karnaugh maps are introduced for manual minimization of logic functions up to 5 variables, including don't-care conditions and multiple-output circuits. The chapter also gives a first introduction to Verilog HDL with structural, behavioral, and hierarchical coding styles.
The standard SOP procedure groups 1-cells on a K-map and writes a product term per group. To get POS (product-of-sums) instead, do the same thing but on the 0-cells — and flip the literal polarity rule:
Why polarities flip: a 0-cell corresponds to a maxterm, which is true for all input combinations except its own. A maxterm is the OR of complemented-where-1, uncomplemented-where-0 literals — the polarity opposite of a minterm. Grouping adjacent 0-cells lets some literals cancel, exactly as grouping adjacent 1-cells does for SOP.
Groups must be powers of 2 (1, 2, 4, 8, …) and rectangular on the K-map. A larger group cancels more literals, producing a simpler sum term. Three examples on a 4-variable K-map:
Pair — 2 cells, cancels 1 variable, leaves 3 literals.
Across the pair: $x_1=0, x_2=0, x_3=0$ stay constant; $x_4$ flips and cancels. Polarity flip: constant-0 stays uncomplemented → sum term $x_1 + x_2 + x_3$.
Quad — 2×2 block of 4 cells, cancels 2 variables, leaves 2 literals.
Constants: $x_1=0$ (both rows), $x_4=1$ (both columns); $x_2, x_3$ flip and cancel. Polarity flip: $x_1=0$ → $x_1$; $x_4=1$ → $\overline{x_4}$ → sum term $x_1 + \overline{x_4}$.
Octet — 2×4 block of 8 cells, cancels 3 variables, leaves 1 literal.
Only $x_1=0$ stays constant; $x_2, x_3, x_4$ all flip across the 8 cells. Sum term: $x_1$.
Summary — bigger groups, fewer literals:
| Group size $k$ | Variables canceled | Literals in sum term (4-var map) |
|---|---|---|
| 1 (single) | 0 | 4 |
| 2 (pair) | 1 | 3 |
| 4 (quad) | 2 | 2 |
| 8 (octet) | 3 | 1 |
Always group the largest legal block of 0-cells you can — each doubling of group size halves the number of remaining literals.
$f(A, B, C) = \sum m(0,1,2,5,6,7)$ — zeros at $m_3$ and $m_4$.
K-map (red cells = 0, the ones we group for POS):
Both 0-cells are isolated (no adjacent 0), so two single-cell groups. Convert each to a sum term:
| Group | A | B | C | Sum term |
|---|---|---|---|---|
| m₃ | 0 | 1 | 1 | $A + \overline{B} + \overline{C}$ |
| m₄ | 1 | 0 | 0 | $\overline{A} + B + C$ |
$f = (A + \overline{B} + \overline{C})(\overline{A} + B + C)$
| SOP | POS | |
|---|---|---|
| Group cells with value | 1 | 0 |
| Each group becomes | a product (AND) term | a sum (OR) term |
| Constant 1 in group → literal is | uncomplemented | complemented |
| Constant 0 in group → literal is | complemented | uncomplemented |
| Combine groups with | OR | AND |
| Cheapest when there are fewer | 1-cells | 0-cells |
Rule of thumb: count the 1s and 0s on the K-map. Whichever is fewer, group those — fewer cells means fewer / smaller groups, which means a cheaper expression. SOP and POS are the two complementary readings of the same map.
Both NAND and NOR are functionally complete — each can build NOT, AND, and OR by itself. Memorize these six recipes; every other gate (XOR, MUX, latch, …) follows by composition.
| Function | NAND-only construction | NOR-only construction |
|---|---|---|
| NOT $\overline{x}$ | $\mathrm{NAND}(x,\, x)$ — 1 gate | $\mathrm{NOR}(x,\, x)$ — 1 gate |
| AND $x \cdot y$ | $\mathrm{NAND}(\mathrm{NAND}(x,y),\, \mathrm{NAND}(x,y))$ — 2 gates (NAND + inverter) | $\mathrm{NOR}(\mathrm{NOR}(x,x),\, \mathrm{NOR}(y,y))$ — 3 gates (invert + invert + NOR) |
| OR $x + y$ | $\mathrm{NAND}(\mathrm{NAND}(x,x),\, \mathrm{NAND}(y,y))$ — 3 gates (invert + invert + NAND) | $\mathrm{NOR}(\mathrm{NOR}(x,y),\, \mathrm{NOR}(x,y))$ — 2 gates (NOR + inverter) |
Symmetry: NAND is "good at AND" (cheaper at 2 gates) and "expensive at OR" (3 gates). NOR is the dual — good at OR, expensive at AND. Both reach NOT in 1 gate. Choose the family that matches your function's dominant operation to minimize gate count.
Why both work: apply DeMorgan in two directions. From NAND: $\overline{xy} = \overline{x} + \overline{y}$ — so NAND with inverted inputs = OR. From NOR: $\overline{x+y} = \overline{x} \cdot \overline{y}$ — so NOR with inverted inputs = AND. The "invert each input then NAND/NOR" recipe is just DeMorgan applied directly.
2-level rule: any minimum-cost SOP maps to a 2-level NAND-NAND circuit (each AND becomes a NAND, the final OR also becomes a NAND). Any minimum-cost POS maps to a 2-level NOR-NOR circuit (each OR becomes a NOR, the final AND also becomes a NOR). Same wiring topology, just swap the gate type — that's the practical reason NAND/NOR are the standard building blocks of CMOS gate libraries.
w0, w1, select s, and output f.A Venn diagram represents Boolean variables as overlapping circles inside a rectangle (the universe). Each region corresponds to one minterm of the truth table: inside circle $x$ = "x is 1", outside = "x is 0". The intersection of two circles = AND; the union = OR; the area outside a circle = NOT.
Two-variable Venn (4 regions = 4 truth-table rows):
Three-variable Venn (8 regions = 8 truth-table rows):
Operators visually:
| Operation | Region |
|---|---|
| $x \cdot y$ (AND) | intersection of $x$ and $y$ |
| $x + y$ (OR) | union of $x$ and $y$ |
| $\overline{x}$ (NOT) | everything outside circle $x$ |
Use: shade LHS and RHS separately — if the shaded patterns match, the identity is proven.
Setup: a conveyor moves gumballs past three sensors:
A trap door rejects the gumball when output $f = 1$. Reject rule: reject if it is too large, OR (too small AND too light).
Figure 2.21a — conveyor schematic:
Figure 2.21b — truth table:
| $s_1$ | $s_2$ | $s_3$ | $f$ |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Example 2.7 derivation (the original textbook approach):
SOP from minterms: $f = \overline{s_1}\overline{s_2}s_3 + \overline{s_1}s_2 s_3 + s_1\overline{s_2}s_3 + s_1 s_2\overline{s_3} + s_1 s_2 s_3$
Replicate the $s_1 s_2 s_3$ term (rule 7b), then group:
$= \overline{s_1}s_3(\overline{s_2}+s_2) + s_1 s_3(\overline{s_2}+s_2) + s_1 s_2(\overline{s_3}+s_3) = \overline{s_1}s_3 + s_1 s_3 + s_1 s_2$
Combine the first two terms: $f = s_3 + s_1 s_2$
What problem 2.19 asks: show a different simplification path that ends at the same result. Repeat the term $s_1 s_2\overline{s_3}$, then factor by $\overline{s_3}$:
$f = s_3(\overline{s_1}\overline{s_2}+\overline{s_1}s_2+s_1\overline{s_2}+s_1 s_2) + s_1 s_2(\overline{s_3}+s_3) = s_3 \cdot 1 + s_1 s_2 = s_3 + s_1 s_2$
The bracketed sum spans every valuation of $(s_1, s_2)$, so it equals 1. Same result, different route — illustrating that algebraic minimization isn't unique.
Yes — NOR is functionally complete: every Boolean function can be built using only NOR gates. Three base recipes:
NOT — one NOR with both inputs shorted: $\mathrm{NOR}(x, x) = \overline{x+x} = \overline{x}$.
OR — two NORs (NOR followed by inverter): $x + y = \overline{\overline{x+y}} = \mathrm{NOR}(\mathrm{NOR}(x, y), \mathrm{NOR}(x, y))$.
AND — three NORs (two inverters + one NOR), via DeMorgan: $x \cdot y = \overline{\overline{x} + \overline{y}} = \mathrm{NOR}(\overline{x}, \overline{y})$.
Summary — gate counts:
| Function | NORs needed | Construction |
|---|---|---|
| NOT | 1 | $\mathrm{NOR}(x, x)$ |
| OR | 2 | NOR followed by inverter |
| AND | 3 | invert each input, then NOR |
| NAND | 4 | AND followed by inverter (3 + 1) |
| XOR | 5 | $x\oplus y = (x+y)(\overline{x}+\overline{y})$ — POS-to-NOR-NOR |
Once you have NOR, every other gate (and any function whatsoever) follows. The same is true for NAND alone — both are single-gate universals, which is why CMOS gate libraries are typically built around them.
Application to problem 2.24: $f = (\overline{x_1}+x_2)(x_2+\overline{x_3})$ — already in 2-level POS form, which maps directly to a 2-level NOR-NOR network:
Total: 5 NOR gates.
Setup. Two 4-variable functions $f_1$ and $f_2$ are to be implemented in a single combined circuit (shared gates where possible).
Figure 2.64a / 2.64b — K-maps:
$f_1$ K-map
| $f_2$ K-map
|
Example 2.16 — minimum SOP (with sharing)
$f_1 = \overline{x_1}\,\overline{x_3} + x_1 x_3 + \overline{x_2} x_3 x_4$
$f_2 = \overline{x_1}\,\overline{x_3} + x_1 x_3 + x_2 \overline{x_3} x_4$
The first two product terms are identical → those AND gates are shared in Figure 2.64c. Combined cost: 6 gates / 16 inputs = 22 (versus 28 for two separate circuits).
Example 2.18 — minimum POS (problem 2.29's task)
$f_1 = (x_1 + \overline{x_3})(\overline{x_1} + x_3)(\overline{x_1} + \overline{x_3} + x_4)$
$f_2 = (x_1 + \overline{x_3})(\overline{x_1} + x_3)(\overline{x_1} + \overline{x_3} + \overline{x_4})$
The first two sum terms are common (could be shared), but the K-maps reveal no 0-cell grouping that simultaneously appears in both functions — so beyond those two shared OR gates, no additional sum terms can be merged advantageously. Each function still needs three OR gates + one AND gate + 11 inputs ≈ 30 total (or ~26 if you share the two common sum-term ORs).
Conclusion: 22 (SOP, shared) < 26–30 (POS) — for these particular K-maps, the SOP form admits more sharing because the 1-cells cluster into product terms that overlap, while the 0-cells don't cluster compatibly. This is highly function-dependent — Example 2.17 (Figure 2.65, $f_3, f_4$) shows the opposite ordering can occur.
Note on Figure 2.65: that figure illustrates the same trade-off for a different pair $f_3, f_4$ where the textbook compares prime-implicant-only realizations against intentionally-shared non-prime implicants — see Example 2.17 / 2.19 (different problem in the study guide, not this one).
Setup. Two 4-variable functions $f_3$ and $f_4$ are to be implemented as a single combined circuit. Whereas Example 2.16 used only prime implicants and shared the obviously-common ones, Example 2.17 deliberately uses some non-prime implicants to expose more sharing opportunities.
Figure 2.65a / 2.65b — K-maps:
$f_3$ K-map (minterms 1,3,5,7,13,14,15)
| $f_4$ K-map
|
Example 2.17 — minimum SOP using only prime implicants:
$f_3 = \overline{x_1}x_4 + x_2 x_4 + x_1 x_2 x_3$
$f_4 = \overline{x_1}\overline{x_2}\overline{x_4} + x_1 \overline{x_2} \overline{x_3} + x_1\overline{x_4}$ (or equivalent — six AND gates total, no AND can be shared)
Combined cost with no sharing: 6 ANDs + 2 ORs + 21 inputs = 29.
Example 2.17 — better SOP using shared non-prime implicants:
$f_3 = \overline{x_1}x_2 x_4 + x_1 x_2 x_3 \overline{x_4} + \overline{x_1}x_4$
$f_4 = \overline{x_1}x_2 x_4 + x_1 x_2 x_3 \overline{x_4} + x_2\overline{x_4}$
Now the first two product terms are identical in both expressions and can share AND gates. Combined cost: 6 gates + 17 inputs = 23 — a 6-input saving over the prime-implicant realization.
Example 2.19 — minimum POS for the same pair (problem 2.30 asks this):
$f_3 = (x_3 + x_4)(x_2 + x_4)(x_1 + x_4)(\overline{x_1} + x_2)$
$f_4 = (x_3 + x_4)(x_2 + x_4)(x_1 + x_4)(\overline{x_1} + x_2 + \overline{x_4})$
The first three sum terms are identical in both functions — three shared OR gates costing six inputs. Plus one 2-input OR and one 4-input AND for $f_3$, and one 3-input OR and one 4-input AND for $f_4$. Combined cost: 5 ORs + 2 ANDs + 19 inputs = 26.
Comparison:
| Realization | Cost |
|---|---|
| SOP — prime-implicant only (Ex 2.17, baseline) | 29 |
| SOP — shared non-prime implicants (Ex 2.17, optimized) | 23 ✓ |
| POS — shared sum terms (Ex 2.19, this problem) | 26 |
Lesson: SOP with intentionally-non-minimum (shared) implicants beats POS for this pair. The choice of SOP vs POS, and prime-vs-shared implicants, depends on the K-map geometry — modern synthesis tools explore both.
assign statements to describe a circuit with inputs $x,y,z$ and outputs $f = (\overline{y \oplus z})\cdot z + (y \oplus z)\cdot x$ and $g = (y \oplus z)\oplus x$.modules for the multiplexer and the adder.