Karnaugh Maps: What Are They and Why Do We Use Them?
Karnaugh Maps: What Are They and Why do We Use Them?
Shannon LaMar
Athens State University
Abstract
What are Karnaugh maps and why do use them? Karnaugh maps are a valuable tool which allow us to take advantage of our natural pattern recognition abilities to quickly simplify a Boolean expression. This enables us to avoid lengthy calculations and saves time. Why do we want to simplify these expressions? Simplification of Boolean expressions allows us to build a cheaper, more reliable logic circuit that is easier to maintain and troubleshoot. Karnaugh maps also allow us to quickly identify race conditions that can lead to major issues if they are not caught. One caveat is that it the expression must have less than six variables (preferably no more than four) or the map quickly becomes crowded and confusing. In short, Karnaugh maps can be a valuable tool when used under the appropriate circumstances.
Karnaugh Maps: What Are They and Why do We Use Them?
Karnaugh maps, also know as K-maps, were developed by Maurice Karnaugh in 1953. Karnaugh improved on Edward Veitch’s diagrams developed in 1952. (Rosen, 2011) The Karnaugh maps are a graphical representation of a logic circuit (Bera, 1999) and provide a means to minimize Boolean functions. (Mano, 2013) An interesting aspect of the Karnaugh map is that it utilizes our ability to recognize patterns thereby decreasing the need to perform lengthy calculations and finding the most simple, or canonical, form of the function. (Karnaugh map, 2015) Typically problems with four variables would be the ideal maximum for Karnaugh maps but up to six is doable. Beyond that they get too complicated to be of use for recognizing patterns. (Computer hardware, 2010)
So what exactly is a Karnaugh map? It is a grid consisting of squares with each square corresponding to a minterm (minimal term) of the function being simplified. (Mano, 2013) The map is drawn as a 2-dimensional rectangle but is actually wrapping around from side to side and top to bottom, this is known as a torus. The squares are ordered in Gray code, also known as reflected binary code. In Gray code two successive values differ in only one binary digit, this guarantees that only one bit changes between each pair of adjoining squares. (Mano, 2013) The Boolean variables are transferred to the appropriate square and groups of adjacent 1’s are identified. The 1’s cannot be diagonally connected, they must be above, below, or next to each other. The groups must be rectangular and have an area that is a power of 2. For example 21, 22, 24 but 23 would not be a legal group. These groups should be as large as possible without containing any 0’s. They can also overlap (as seen in Figure 1). (Bera, 1999) As mentioned before, with Karnaugh maps the edges wrap around, (Karnaugh map, 2015) in a four variable map as seen in Figure 1, for example, it would be possible for the 0, 2, 8, and 10 squares to be connected to each other.
Once the appropriate groups have been found the minterms can be determined by seeing which variables stay the same in each group. As seen in Figure 1, in the 14, 14, 11, 10 grouping, AC stay the same. In the 8, 9, 11, 10 grouping AB’ stay the same and in the 4, 12 grouping BC’D’ stay the same. This map simplifies the f(A,B,C,D) = A’BC’D’ + ABC’D + AB’C’D’ + AB’C’D + ABCD + ABCD’ + AB’CD + AB’CD’ to AC + AB’ + BC’D’. It is possible to find two or more solutions; the simplest expression is not always unique. When that occurs any of the solutions can be used. (Mano, 2013)
Why do we want to simplify Boolean equations? Well for one, a more simple equations allows for building a logic circuit that is more simple and therefore be cheaper to produce, more reliable, and easier to troubleshoot when something does go wrong. (Bera, 1999) Karnaugh maps are also useful for detecting race conditions. Race conditions occur when the output is dependent on timing or sequence of uncontrollable events, these are difficult to avoid in Boolean equations. For example, in a 2-input AND gate with A on one input and A’ on the other input, technically they should never be true at the same time. However if a change in A takes longer to get to the second input than the first it is possible for both inputs to briefly be true. Using a Karnaugh map can help detect and remove this race condition before it becomes a problem. (Race condition, 2015) However, Karnaugh maps are not without limitations. As mentioned previously more than six variables make the map overly complicated and difficult to read. At that point the Quine-McCluskey algorithm is used. (Computer hardware, 2010) When used under the appropriate circumstances, Karnaugh maps are extremely useful and allow us to avoid unnecessary, complicated calculations while leading to the formation of cheaper and more reliable logic circuits.