In this lesson, you will learn how to use Karnaugh maps (K-maps) to transform complex, messy logic expressions into the simplest possible circuit designs.
The Problem with Boolean Algebra
So far, you’ve learned to simplify logic using Boolean theorems (like ). While powerful, manual algebraic simplification is prone to human error and difficult to visualize. A K-map is a graphical tool that allows us to simplify functions by looking for patterns in a grid.
Visualizing the K-Map
A K-map is a 2D grid where each cell represents a minterm (a unique combination of inputs). The secret sauce of the K-map is Gray Code ordering, where adjacent cells only ever differ by one bit.
Imagine a 2-variable function with inputs and . Instead of a truth table, we draw a grid:
B=0 B=1
A=0 | 0 | 1 |
A=1 | 1 | 1 |
The Art of Grouping
To minimize a function, we look for "1s" that are physically adjacent and group them into powers of two (groups of 1, 2, 4, or 8).
- Rule 1: You can only group 1s that are next to each other horizontally or vertically (not diagonally).
- Rule 2: The grid "wraps around" (the left edge is adjacent to the right edge).
- Rule 3: Make the groups as large as possible.
When you circle a group, you identify which variables remain constant across the entire group. If a variable changes its state (e.g., it is 0 in one cell and 1 in another within the same group), that variable is "eliminated."
For the grid above, we can create two groups:
- A horizontal group of two 1s in the bottom row (, while toggles ). This simplifies to just A.
- A vertical group of two 1s in the right column (, while toggles ). This simplifies to just B.
The simplified Sum-of-Products (SOP) expression is simply A + B. By circling those 1s, we bypassed pages of algebraic steps to find the most efficient path for our hardware.
Key Takeaway: K-maps turn Boolean simplification into a visual game of circling adjacent blocks of 1s to eliminate variables that change state.