Sub topic 2
Simplifying Expressions Algebraically
This chapter assumes you can convert between binary and decimal, read truth tables, and recognize AND, OR, NOT, NAND, and NOR gates. You should also know the notation A' for NOT A, AB for A AND B, and A + B for A OR B.
Simplifying expressions algebraically
A simpler expression uses fewer gates and literals, which means a smaller, cheaper circuit. You can shorten an expression with these laws:
- Complement: X · X' = 0 and X + X' = 1
- Absorption: X + XY = X
- Distributive: X(Y + Z) = XY + XZ
For example, AB + AB' = A(B + B') = A(1) = A.
> Any algebraic step can be checked by building a truth table for both sides. If the outputs match on every row, the two expressions are equivalent.
Universal gates: NAND-only and NOR-only designs
NAND and NOR are universal gates. Each can build NOT, AND, and OR, so a circuit can use only one gate type.
def nand(a, b):
return int(not (a and b))
def NOT(a):
return nand(a, a)
def AND(a, b):
return NOT(nand(a, b))
def OR(a, b):
return nand(NOT(a), NOT(b))
for a in (0, 1):
for b in (0, 1):
assert NOT(a) == int(not a)
assert AND(a, b) == (a & b)
assert OR(a, b) == (a | b)
print("All NAND identities hold")Karnaugh map layout and Gray code
A Karnaugh map (K-map) arranges truth-table rows so that neighboring cells differ by exactly one variable. The column order follows Gray code: 00, 01, 11, 10. Ordinary binary order (00, 01, 10, 11) would break this adjacency.
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | m0 | m1 | m3 | m2 |
| 1 | m4 | m5 | m7 | m6 |
Grouping cells in a K-map
Group 1, 2, 4, or 8 cells that contain 1s. Each group must be a rectangle, and the map wraps around at its edges. Larger groups give simpler terms. A prime implicant is a group that cannot be enlarged. An essential prime implicant is a prime implicant that covers at least one minterm no other prime implicant covers. Essential prime implicants must appear in any minimal cover.
Consider F(A,B,C) = Σm(1,3,4,5,6). The prime implicants are A'C (cells m1, m3), AB' (cells m4, m5), and AC' (cells m4, m6).
Prime and essential prime implicants
For F = Σm(1,3,4,5,6), m3 is covered only by A'C, so A'C is essential. Similarly, m6 is covered only by AC', and m5 is covered only by AB'. All three are essential, so the minimal SOP form is F = A'C + AB' + AC'.
Exercise
For F(A,B,C) = Σm(1,3,4,5,6), which prime implicant is essential because it is the only one covering m3?
Show answer
A'C, because m3 (011) lies only in the group formed by m1 and m3.