Click cells to enter 0, 1, or X (don't-care). Groups auto-detect, SOP expression simplifies instantly, and Verilog assign is generated for you.
A Karnaugh map (K-map) is a visual tool for minimizing Boolean logic expressions. Instead of applying complex algebraic laws, you simply group adjacent 1s on a grid — the grouping rules ensure maximum simplification automatically.
K-maps are essential in digital logic design: they determine the minimum number of gates needed to implement a truth table, directly reducing chip area and power consumption.
Groups must have 1, 2, 4, 8, or 16 cells — always a power of 2. Larger groups = simpler expression.
Groups must be rectangular (including wrapping). L-shapes, diagonals, and T-shapes are NOT valid.
Groups can wrap around edges and corners of the map. Corner cells are adjacent to each other diagonally.
Always find the largest possible group first. Every 1 must be covered. Don't-cares can be included to enlarge groups.
Truth table: F(A,B,C) = Σm(1,3,5,7) — minterm 1,3,5,7 all equal 1. What is the simplified expression?
| Row | A | B | C | F | Group |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | — |
| 1 | 0 | 0 | 1 | 1 | Group A |
| 2 | 0 | 1 | 0 | 0 | — |
| 3 | 0 | 1 | 1 | 1 | Group A |
| 4 | 1 | 0 | 0 | 0 | — |
| 5 | 1 | 0 | 1 | 1 | Group A |
| 6 | 1 | 1 | 0 | 0 | — |
| 7 | 1 | 1 | 1 | 1 | Group A |
All 4 ones are in cells where C=1. One group of 4 → only C survives → F = C
Insight: When 1s appear in all cells where one variable is 1 (regardless of others), that variable alone determines the output. The K-map makes this obvious visually — the entire right column of a 3-var map is C=1.
Each group in the SOP K-map becomes one AND term. The terms are ORed together to form the complete expression.
// K-map result: F = A'B + CD' // Group 1 (green): A'B → cells where A=0, B=1 // Group 2 (blue): CD' → cells where C=1, D=0 assign F = (~A & B) | (C & ~D); // With don't cares: F = Σm(1,3,5,7) + d(2,6) // Simplified: F = C (single variable after using don't-cares) assign F_dc = C; // 4-variable example: F = Σm(0,1,2,3,8,9,10,11) // K-map gives: F = A' (top two rows) assign F_4v = ~A;
A Karnaugh map (K-map) is a visual method for simplifying Boolean algebra expressions. It arranges truth table values in a grid where adjacent cells differ by only one variable, making it easy to identify groups of 1s that represent simplified terms. K-maps eliminate the need for complex algebraic manipulation.
Groups must contain 1, 2, 4, 8, or 16 cells (powers of 2). All cells must be 1s (or don't-cares). Groups must be rectangular and can wrap around edges. Always make groups as large as possible to maximize simplification.
SOP (Sum of Products) groups the 1s — each group produces an AND term, all terms ORed. POS (Product of Sums) groups the 0s — each group produces an OR term, all terms ANDed. SOP maps directly to AND-OR logic (NAND-NAND in real gates).
Don't cares (X) are input combinations that either never occur or whose output doesn't matter. You can treat them as 0 or 1 — whichever allows forming larger groups and producing a simpler expression.
Each SOP group becomes an AND term in a Verilog assign. For example, F = AB' + CD becomes: assign F = (A & ~B) | (C & D); The K-map result maps directly to combinational logic.
K-maps are practical up to 4 variables (16 cells). For more than 4–5 variables, the Quine-McCluskey algorithm or EDA synthesis tools (like Synopsys DC) are preferred for Boolean minimization.