Once a function is plotted on a K-map, the work of simplification is to draw the largest possible groups. Each group stands for one product term, and fewer larger groups give a shorter expression.
Rules for Grouping
Adjacent 1s are circled in groups. The size of every group must be a power of two: 1, 2, 4, 8 or 16. The groups should be as large as possible, and every 1 must be in at least one group. Groups may overlap and may wrap around the edges. A group of two cells removes one variable, a group of four removes two, and a group of eight removes three.
Definition: Prime implicant. A product term obtained from the largest possible group of adjacent 1s on a K-map, which cannot be combined with any other group to form a larger one.
Reading a Group
For each group, a variable that stays the same across all cells is kept, in complemented form if it is 0. A variable that changes is dropped. The terms of all groups are added to give the sum of products (SOP) form.
Example 1.5: Simplifying a four-variable function
Problem: Simplify F(A, B, C, D) = Σm(0, 1, 2, 5, 8, 9, 10).
Solution:
- Plot the function on the four-variable map.
- The four corner cells m0, m2, m8 and m10 form one group. B and D are 0 in all of them, so the term is B'D'.
- The cells m0, m1, m8 and m9 form a second group, in which B and C are 0. The term is B'C'.
- The cells m1 and m5 form a third group, in which A, C are 0 and D is 1. The term is A'C'D.
Result: F = B'D' + B'C' + A'C'D.
def f(a, b, c, d):
n = 8*a + 4*b + 2*c + d
return n in (0, 1, 2, 5, 8, 9, 10)
def g(a, b, c, d):
return ((not b and not d) or (not b and not c)
or (not a and not c and d))
r = (0, 1)
print(all(f(a, b, c, d) == bool(g(a, b, c, d))
for a in r for b in r for c in r for d in r))
Output
True
Don't Care Conditions
Some input combinations never occur, or their output does not matter. These are don't care conditions, written X on the map. A don't care cell may be treated as 1 if that makes a group larger, and ignored otherwise.
Example 1.6: Using don't care cells
Problem: Simplify F(A, B, C, D) = Σm(1, 3, 7, 11, 15) with don't cares d(0, 2, 5).
Solution:
- Cells m1, m3, m7, m11 and m15 must be covered.
- Treating don't cares m0 and m2 as 1 gives the group m0, m1, m2, m3, which is A'B'.
- The cells m3, m7, m11 and m15 form the group CD.
- Cell m5 is not needed, so it is left as 0.
Result: F = A'B' + CD.
Product of Sums
Instead of grouping 1s, the 0s may be grouped. Each group of 0s gives a sum term in which a variable that is 0 is written plain and a variable that is 1 is complemented. The product of these terms is the product of sums (POS) form. For F = Σm(1, 3, 4, 5, 7) the zeros are m0, m2 and m6. The group m0, m2 gives (A + C) and the group m2, m6 gives (B' + C), so F = (A + C)(B' + C). Table 1.6 compares the two forms.
Table 1.6: Comparison of SOP and POS
| Aspect | SOP | POS |
|---|---|---|
| Groups | Cells containing 1 | Cells containing 0 |
| Each group gives | A product term | A sum term |
| Terms are combined by | OR | AND |
| Built from | AND gates feeding an OR gate | OR gates feeding an AND gate |
Common mistakes
- Making groups of three, five or six cells. Group sizes are powers of two.
- Leaving a 1 outside every group.
- Treating all don't care cells as 1. They are used only when they enlarge a group.
Key takeaways
- Group size must be 1, 2, 4, 8 or 16.
- Larger groups give shorter terms.
- Don't care cells may be used as 1 or 0, whichever helps.
- Grouping 1s gives SOP; grouping 0s gives POS.
Practice questions
- How many variables does a group of eight cells eliminate?
- What is a don't care condition?
- Which form results from grouping the zeros of a map?
Answers to the practice questions
- Three.
- An input combination that never occurs or whose output does not matter, marked X on the map.
- The product of sums (POS) form.
Sources
- Official BCA syllabus Computer Architecture, course code 25BCA401DS02, Unit I
