Jim Stiles holds a BS in Electrical Engineering & is a licensed Professional Engineer. Jim has worked in electronic circuit design, test & SW development for over 20 years.
In this lesson we are going to learn how to use Karnaugh Maps to simplify Boolean logic. The resulting Boolean equation represents a minimized function suitable for implementation.
You've come up with a brilliant idea that solves a problem you have been working on for weeks. You have identified a detailed series of logical operations that will result in the perfect solution. The only problem is that it is pretty complicated, and you need a clever way to simplify things. What you need is a Karnaugh Map.
Karnaugh or K-Maps are used to simplify and minimize the number of logical operations required to implement a Boolean function. The implementation of the function may be in the form of digital electronic hardware or software statements.
A Boolean function is an algebraic expression with variables that represent the binary values 0 and 1. Some useful Boolean identities and laws are listed below.
2 Variable Truth Table and K-Map
A logical specification is often created using a truth table. A truth table is a list of the inputs (A, B) on the left and the corresponding output (F) on the right. See Figure 1 showing a 2 variable truth table and corresponding K-Map.
Figure 1: Variable Truth Table & K-Map
A K-Map creates a new representation of the truth table using Gray code ordering, ensuring that only one bit changes for any adjacent cell. It is a logical adjacency that makes Boolean simplification possible.
Each cell of the K-Map represents an input state (A, B). The value of each cell represents the output function (F). In order to find the minimum logic function, it is necessary to identify matching adjacent cells. Once these matches are found, an expression can be written. See Figure 2 showing how to group and determine the function F for the K-Map outlined in Figure 1.
Figure 2: 2 Variable K-Map Loop & Find Function F
Note : This lesson will be using the sum of products (SOP) form for expressions. This is achieved by minimizing the logical 1s in the K-Maps. It is also possible to use the product of sums (POS) form by minimizing the logical 0s.
3 Variable Truth Table and K-Map
Below is an example of a 3 variable K-Map. Notice that the cells are ordered in the K-Map to ensure only one bit changes on any adjacent cell. From left to right instead of 0, 1, 2, 3, 4, 5 ,6, 7, the cell ordering is 0, 1, 2, 3, 6, 7, 4, 5.
Figure 3: Variable Truth Table & K-Map
Over 83,000 lessons in all major subjects
Get access risk-free for 30 days,
just create an account.
Here is an example of a 4 variable K-Map. Again, notice the ordering of the cells in the K-Map to ensure only one bit changes on adjacent cells. Also, notice that the map wraps in a circular manner. The fact that cell 8 is adjacent to cell 10 is used to loop out the last 3 variable term as shown in Figures 4 & 5.
Figure 4: 4 Variable Truth Table
Figure 5: 4 Variable K-Map
Logic Simplification Through Logic Adjacency
Let's take a closer look at logic simplification and see why adjacency is the key to this process. A brute force method to accomplish this would be to write the complete function out and attempt to minimize it algebraically. This is error-prone and is time-consuming. Using a K-Map we can achieve the same results by inspection as outlined in Figure 6.
Figure 6: How Logic Simplification Works
Higher Order K-Maps
K-Maps with a higher order than 4 variables are sometimes discussed in textbooks but are not practical for hand calculations. One alternative approach is to employ the map entered variable (MEV) technique. This technique maps Boolean variables into the K-Map allowing a reduction in size.
The best approach for higher-order K-Maps is to use a software tool that implements a minimization algorithm, such as the Quine-McClusky or Espresso method. There are numerous resources online for web-based and stand-alone software solvers.
A Boolean function is an algebraic expression with variables that represent the binary values 0 and 1.
Karnaugh or K-Maps are used to simplify and minimize the number of logical operations required to implement a Boolean function. The simplified equation represents the minimum logic required to implement the function. K-Maps are a great way to simplify Boolean logic with 4 variables or less.
Did you know… We have over 220 college
courses that prepare you to earn
credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the
first two years of college and save thousands off your degree. Anyone can earn
credit-by-exam regardless of age or education level.