Karnaugh Maps
Objectives
We would like to :
- Learn how to use Karnaugh maps to reduce small boolean expressions.
Notes
- This is from Carpineli chapter 2.3
- Karnaugh maps were introduced in the 1950s as a way to simplify boolean expressions.
- They are a visual trick that allows you to perform this task.
- They are useful for expressions with 4 or fewer variables.
- They can be extended higher, but there are other techniques for more variables.
- You need to start with a truth table.
- From this construct the karnaugh or k-map
- This is a rectangular grid
- 2x2, 2x4, 4x4
- After this, we start adding another grid 2X 4x 4, ...
- Across the top put the values of up to two variables in gray code.
- Across the side put the values of up to two variables in gray code.
- Fill in the corresponding values from the truth table.
- Next look for the largest collections of adjacent 1s
- With periodic boundary conditions, or the top and bottom and the left and right are connected.
- "Rectangle" these.
- The dimensions of the rectangles need to be powers of 2: 1x1, 1x2, 2x2, 1x4, 2x4 ...
- Try to find maximum sized "circles"
- Finally read the expressions by the constant variables in the areas circled.
- Read the maximum sized boxes first
- Make sure that all ones are accounted for.
- The gray code will assure that any dimension has at least on variable that does not change
- The product of these form a term in the expression.
- The smallest will be a minterm.
- Let's try a two input expression
-
- We buld the k-map
-
- We have two grouping here
-
- Note here, b is constant: 0 (a is either 0 or 1), so this would produce the term b
-
- Note here, a is constant: 1 (b is either 0 or 1), so this would produce the term a.
- This yields an expression f(a,b) = a + b
- Note, this is just M1, which we could have read directly.
- K-maps are more useful with three input functions
- We can always read any two input functions almost directly.
- Let's try a three input function
-
a | b | c | f(a,b,c) |
0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 |
0 | 1 | 0 | 1 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 0 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
- The K-Map
-
- Note the use of gray code in the column labels.
- In this case, we have two terms
-
- The yellow cells yield a·c
- The blue cells yield ab
- f(a,b,c) = ab + a·c
- A second example:
- F(a,b,c) = m0 + m2 + m3 + m 4 + m6
-
a | b | c | f(a,b,c) |
0 | 0 |
0 | 1 |
0 | 0 |
1 | 0 |
0 | 1 |
0 | 1 |
0 | 1 |
1 | 1 |
1 | 0 |
0 | 1 |
1 | 0 |
1 | 0 |
1 | 1 |
0 | 1 |
1 | 1 |
1 | 0 |
-
- There are two "rectangles" in this map
-
- The yellow cells represent c
- The red text represents a b
- So the final expression is a b + c