15.2 Boolean Algebra and Logic Circuits – Karnaugh Maps (K‑maps)
Learning Objective
Demonstrate a clear understanding of Karnaugh maps and use them to minimise Boolean expressions for both SOP and POS forms, producing efficient logic‑circuit designs (including half‑adders and full‑adders) as required by the Cambridge International AS & A Level Computer Science (9618) syllabus.
Syllabus Alignment – Quick‑Reference Map
| Syllabus Unit | Covered in these notes | Bridging notes / Further reading |
|---|
| 1–8 (Information representation, hardware, basic logic gates, truth tables) | ✔ Recap box (see below) | See “Foundations – AS‑level recap” |
| 9–12 (Algorithms, data structures, programming, software development) | ✘ Not a focus | Link‑in paragraph – “Why Boolean minimisation matters for algorithmic implementation” |
| 13.1–13.3 (User‑defined types, file organisation, floating‑point) | ✘ | Suggested reading: CS AS‑Level – Data Representation |
| 14 (Protocols, switching) | ✘ | Suggested reading: CS AS‑Level – Communication |
| 15.1 (RISC/CISC, parallelism, virtual machines) | ✘ | Suggested reading: CS A‑Level – Computer Architecture |
| 15.2 (Boolean algebra, K‑maps) – focus of this chapter | ✔ Full coverage (SOP, POS, don’t‑care, 2‑4‑5‑variable maps, circuit design) | – |
| 16–18 (OS, translation software, encryption, AI) | ✘ | Suggested reading: CS A‑Level – System Software & Security |
| 19–20 (Search, sort, recursion, exception handling) | ✘ | Suggested reading: CS A‑Level – Algorithms |
Foundations – AS‑level Recap (Units 1‑8)
- Binary numbers & truth tables – every Boolean function can be described by a truth table of 0’s and 1’s.
- Logic gates – AND, OR, NOT, NAND, NOR, XOR, XNOR. Their symbols and truth tables are the building blocks for combinational circuits.
- Combinational vs sequential circuits – K‑maps apply only to combinational (memory‑less) functions.
- Why minimisation matters – fewer literals → fewer gates → lower cost, power, and propagation delay.
Link‑in to Algorithmic Design (Units 9‑12)
When Boolean functions are implemented in hardware description languages (e.g., VHDL, Verilog) or compiled into micro‑code, a minimal expression reduces the number of instructions the compiler must generate. This directly influences algorithmic efficiency and the overall software development life‑cycle.
Why Use Karnaugh Maps?
- Visual, systematic method for minimising Boolean functions without lengthy algebraic manipulation.
- Groups of 1’s (for SOP) or 0’s (for POS) correspond to product‑terms or sum‑terms.
- Reduces the number of literals and gates → simpler, cheaper, faster circuits.
- Handles “don’t‑care” (X) conditions efficiently, often allowing larger groups.
Basic Concepts
- Cell layout – each cell represents a unique combination of variable states (binary code).
- Adjacency – cells that differ in only one variable are adjacent; the map wraps around on all edges (toroidal adjacency).
- Grouping rules – groups must contain 1, 2, 4, 8 … cells (powers of two) and be as large as possible; groups may wrap around edges.
- Don’t‑care cells (X) – may be treated as 1 or 0 to enable larger groups, provided the required output is unchanged.
K‑map Size Selection
| Number of variables | Map dimensions | Typical use at A‑Level |
|---|
| 2 | 2 × 2 | Introductory SOP/POS examples. |
| 3 | 2 × 4 | Most exam questions; quick hand‑solving. |
| 4 | 4 × 4 | Full‑scale circuit design (adders, multiplexers). |
| 5 | Two 4 × 4 maps (one for each value of the 5th variable) | Extended functions; treat the 5th variable as a “layer”. |
| 6 + | Multiple 4‑variable maps or computer‑assisted tools | Rare at A‑Level; usually tackled with Quine‑McCluskey. |
Step‑by‑Step Procedure (SOP)
Checklist before moving on:
- ✓ Truth table completed (including don’t‑care X’s).
- ✓ Correct K‑map size chosen.
- ✓ All 1’s placed using Gray‑code ordering.
- ✓ Largest possible groups (including wrap‑around) identified.
- ✓ Each group converted to a product term (variables that stay constant).
- ✓ All product terms combined with OR to give the minimal SOP.
- Write the truth table for the function (include X for don’t‑care).
- Select the appropriate K‑map size (see table above).
- Transfer the output values into the K‑map, preserving Gray‑code order for rows and columns.
- Identify the largest possible groups of 1’s. Use X cells if they enlarge a group.
- For each group, write the product term:
- Eliminate any variable that changes within the group.
- Keep a variable in true form if it is 1 throughout the group; otherwise use its complement (A′).
- Combine all product terms with logical OR ( + ) to obtain the minimal SOP.
Step‑by‑Step Procedure (POS)
Checklist for POS:
- ✓ Truth table completed; mark 0’s (maxterms).
- ✓ Choose the correct map size.
- ✓ Place 0’s (or treat 1’s as don’t‑care) in the map.
- ✓ Form the largest possible groups of 0’s (wrap‑around allowed).
- ✓ Write a sum term for each group:
- Keep a variable in true form if it is 0 throughout the group; otherwise use its complement.
- ✓ Combine all sum terms with logical AND ( · ) to obtain the minimal POS.
Worked Example 1 – 4‑Variable SOP
Function: F(A,B,C,D) – truth table given below.
| Dec | A | B | C | D | F |
|---|
| 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 2 | 0 | 0 | 1 | 0 | 1 |
| 3 | 0 | 0 | 1 | 1 | 0 |
| 4 | 0 | 1 | 0 | 0 | 1 |
| 5 | 0 | 1 | 0 | 1 | 1 |
| 6 | 0 | 1 | 1 | 0 | 0 |
| 7 | 0 | 1 | 1 | 1 | 0 |
| 8 | 1 | 0 | 0 | 0 | 1 |
| 9 | 1 | 0 | 0 | 1 | 0 |
| 10 | 1 | 0 | 1 | 0 | 1 |
| 11 | 1 | 0 | 1 | 1 | 0 |
| 12 | 1 | 1 | 0 | 0 | 0 |
| 13 | 1 | 1 | 0 | 1 | 1 |
| 14 | 1 | 1 | 1 | 0 | 0 |
| 15 | 1 | 1 | 1 | 1 | 0 |
Step 1 – K‑map layout (AB = rows, CD = columns, Gray code order)
| 00 | 01 | 11 | 10 |
|---|
| 00 | 0 | 1 | 0 | 1 |
|---|
| 01 | 1 | 1 | 0 | 0 |
|---|
| 11 | 0 | 1 | 0 | 0 |
|---|
| 10 | 1 | 0 | 1 | 1 |
|---|
Step 2 – Form the largest groups of 1’s
- Group 1 – four 1’s (minterms 2, 3, 6, 7) → product term
A′ C - Group 2 – four 1’s (minterms 1, 5, 9, 13) → product term
B′ D - Group 3 – two 1’s (minterms 8, 10) → product term
A D′
Step 3 – Minimal SOP
F = A′ C + B′ D + A D′
Worked Example 2 – Using Don’t‑Care Conditions
Assume the same function with don’t‑care conditions at minterms 3 and 12 (X). Including them may allow larger groups.
Updated K‑map (X shown in light grey)
| 00 | 01 | 11 | 10 |
|---|
| 00 | 0 | 1 | X | 1 |
|---|
| 01 | 1 | 1 | 0 | 0 |
|---|
| 11 | X | 1 | 0 | 0 |
|---|
| 10 | 1 | 0 | 1 | 1 |
|---|
New grouping
- Eight‑cell group (rows 00 & 01, columns 01 & 11) → product term
B′ - Four‑cell group (row 10, columns 00 & 10) → product term
A D′
Resulting minimal SOP
F = B′ + A D′
Using the don’t‑care cells reduced the expression from three product terms to two, saving one gate.
Worked Example 3 – POS Minimisation (3 Variables)
Function: G(A,B,C) = Π M(0,2,5,7) (i.e., G = 0 for minterms 0, 2, 5, 7).
Step 1 – Group the 0’s (including wrap‑around)
- Group A – four 0’s covering column C=0 → sum term
(C + A′) (C is 0 throughout, A varies → use A′). - Group B – two 0’s at minterms 2 and 6 → sum term
(B + C′) (B is 0 throughout, C varies → use C′).
Minimal POS
G = (C + A′)·(B + C′)
Worked Example 4 – Half‑Adder Design Using K‑maps
The half‑adder adds two single‑bit binary numbers (A and B). Its two outputs are:
Sum (XOR) – SOP minimisation
2‑variable K‑map (A = rows, B = columns)
Two 1’s are diagonally opposite; they cannot be grouped together, so each forms a 1‑cell group:
- Cell (A=0, B=1) → product term
A′ B - Cell (A=1, B=0) → product term
A B′
Minimal SOP for Sum
Sum = A′ B + A B′
Carry – SOP minimisation (trivial)
Only minterm 3 (A=1, B=1) is a 1, giving the product term A B.
Minimal SOP for Carry
Carry = A B
Resulting Half‑Adder Circuit
- Sum output: two‑input XOR gate (or the SOP expression above).
- Carry output: single AND gate.
Worked Example 5 – Full‑Adder Design (3 Variables) Using K‑maps
Inputs: A, B, Cin. Outputs: Sum, Cout.
Sum (A ⊕ B ⊕ Cin) – SOP
- Construct the 3‑variable truth table (8 rows).
- Place the 1’s (minterms 1, 2, 4, 7) on a 2 × 4 K‑map (AB = rows, C = columns).
- Group as two 4‑cell groups:
- Group 1 →
A′ B Cin - Group 2 →
A B′ Cin′
- Combine →
Sum = A′ B Cin + A B′ Cin′ + A B Cin′ + A′ B′ Cin, which simplifies to the well‑known XOR chain.
Cout (majority function) – SOP
- 1’s at minterms 3, 5, 6, 7.
- Group as a 4‑cell block (AB = 11) → product term
A B. - Group as a 2‑cell block (A = 1, Cin = 1) → product term
A Cin. - Group as a 2‑cell block (B = 1, Cin = 1) → product term
B Cin.
Minimal SOP for Cout
Cout = A B + A Cin + B Cin
Key Boolean Identities Used in Minimisation