Topic.2.3 Karnaugh Maps Learning Objectives: t the end of this topic you will be able to; Draw a Karnaugh map for a logic system with up to four inputs and use it to minimise the number of gates required;
Module ET Introduction to nalogue and Digital Systems. Karnaugh maps. ongratulations on reaching this point in the course, which will mean that you have successfully battled your way through some pretty tough oolean simplification techniques, which became very complex at times. In this unit we are going to show you another method of simplification, which you will hopefully find much quicker and less prone to error, as in many cases the simplest oolean expression is obtained immediately, without the need for any further manipulation using oolean algebra. So here we go! This method of simplification of requires the production of a diagram to represent the contents of a truth table, (or a map). Let us look at a very simple example for a two input logic gate. From our previous work you will realise that a two input gate can have four different possible settings. The truth table looks like. Q What type of logic gate is this?... n alternative way of presenting this data is as follows 2
Topic.2.3 Karnaugh Maps an you see how the logic state of Q has been transferred to the diagram? 3
Module ET Introduction to nalogue and Digital Systems. This diagram is in fact a Karnaugh map, each square or cell in the Karnaugh map corresponds to a cell in truth table, as shown below. Q Q Q Q 4
Topic.2.3 Karnaugh Maps Now you should be able to complete a Karnaugh map for any two input logic function, so let s put that to the test. Exercise omplete the following Truth Tables and Karnaugh maps for the logic gates named.. ND gate: Q 2. NOR gate: Q 3. ExOR gate Q 5
4. NND gate Module ET Introduction to nalogue and Digital Systems. Q 5. ExNOR gate Q n alternative way of looking at the cells in the Karnaugh map is shown below: Q........ This should give you a clue as to how we can read a Karnaugh map, since each cell has it s own oolean expression! 6
Topic.2.3 Karnaugh Maps So we can now fill in a Karnaugh map, but how do we read them to obtain a oolean expression? omplete the Karnaugh map for the following truth table. Q In this case, the truth table and the Karnaugh map do not match one of our standard logic gates, but we can extract the oolean equation straight from the cell in the Karnaugh map containing a logic, i.e.. So what, you might say, there doesn t seem to be a lot of point in what we are doing here, because we could have obtained this directly from the truth table, without having to draw the Karnaugh map. Let us have a look at another example. Q t first glance this might look like one of our standard logic gates, however it isn t. Now if we write down the oolean expression for each logic in the map we get the following:... This is not exactly the simplest of oolean equations and we could have obtained the same result from the truth table there still doesn t appear to be much of an advantage to the Karnaugh map. 7
Module ET Introduction to nalogue and Digital Systems. Let us look at that expression and simplify it using oolean lgebra to obtain the simplest solution.... Now look at the Karnaugh map again..(. ) If we think of the right hand side of the Karnaugh map and compare it to the map we introduced earlier showing the oolean terms for each cell we obtain the following:.... What this shows is that the oolean terms we have grouped together are:..(.. ) Using the Karnaugh map is a graphical method of finding the common factors in a oolean expression. If we look at the Karnaugh map we can see that the 8
Topic.2.3 Karnaugh Maps group of s we have identified corresponds to when input is a logic, which corresponds to the simplest term obtained via the oolean simplification. 9
Module ET Introduction to nalogue and Digital Systems. Now consider the following alternative grouping that could have been created..... gain this shows that the oolean terms we have grouped together are:. (. ) If we look at the Karnaugh map we can see that the group of s we have identified corresponds to when input is a logic, or, which corresponds to the simplest term obtained via the oolean simplification. If we put the two results together we obtain the simplest solution as In practice we would perform these two simplifications in one step as shown below: The advantage of a Karnaugh map is that we can quickly spot the common terms in a complicated expression. This advantage will be more obvious when we deal with 4 input expressions.
Topic.2.3 Karnaugh Maps The only thing we have to be sure of is that every logic in the map is included in at least one group.
Module ET Introduction to nalogue and Digital Systems. Example 2 : Try the following example: i. omplete the Karnaugh map. ii. Group the logic s together iii. Write down the oolean term for each group linked by the OR function +. iv. heck your answer by simplifying the expression obtained from the truth table using the rules of oolean lgebra. Q Simplest Expression from map =... oolean simplification from Truth Table............. Hopefully you are beginning to see the advantages of using a Karnaugh map, but for two input logic functions there is not a great deal of advantage to be gained. The true power of Karnaugh maps becomes much clearer when we look at three and four input logic systems, which is where we will go next. 2
Topic.2.3 Karnaugh Maps Three Input Logic Systems. three input logic system will have eight possible input combinations as shown below. Q We need a bigger Karnaugh map to accommodate the extra input details, and this is shown below: Things to note: i. the inputs and have been linked together on the top row of the Karnaugh map. ii. the sequence of combinations for., is not quite as you might expect. They do not increase numerically as they move across the table. This is deliberate, as it ensure that from one cell to the next only one variable changes. This is essential if the Karnaugh map is to be read correctly. 3
Module ET Introduction to nalogue and Digital Systems. The completion of the Karnaugh map is carried out in a similar way to that of the two input map. In the 2 diagrams below, letters have been used to help you identify how the various rows in the truth table correspond to the cells on a Karnaugh map: Q a b c d e f g h a b d c e f h g Example : Q We use the same rules as before to group the Logic s together as a group as shown below. 4
Topic.2.3 Karnaugh Maps Now write down the oolean expression for each group. The rule is that we ignore any variable that changes between groups. {Note: changes but not }. So the oolean Expression is {Note: changes but not.. }.. Now compare this to the oolean Simplification...........( )..( ).. Now consider the following example. Q In this case there are a large number of logic s in the Karnaugh map, we could group these into three groups of 2 as we have done previously. Using our normal rules we obtain the following oolean expression.... 5
Module ET Introduction to nalogue and Digital Systems. This does not look to be a very simple solution, and indeed we can use oolean lgebra to simplify this further as follows:. ( If we reconsider the simpler solution we have just obtained with the original Karnaugh map we can identify why we did not get the simple answer straight away.. ) The simplest oolean expression is. The Karnaugh map is: {Note: and change but not } {Note: and change but not } The Karnaugh map shows that the two terms in the simplest oolean expression refer to groups of 4 logic s in the map. This gives us another rule for working with Karnaugh maps Group the logic s into the largest group possible, i.e. groups of 2 or 4 adjacent cells. Exercise 3 Derive the simplest oolean expression for the logic function defined by the truth table. Q 6
Topic.2.3 Karnaugh Maps Simplest oolean expression =... 7
Module ET Introduction to nalogue and Digital Systems. efore we look at 4 input Karnaugh maps, there is one more special case we need to consider for three inputs. Let us assume that a logic circuit has produced the following Karnaugh map. t first glance it might appear that we would have to group these as two groups of 2, giving the oolean expression as:.. ut this can be simplified to just, which would indicate from our previous work that there should be a group of 4 logic s in this map, and indeed there is if we imagine the map rolled around so that the two ends meet. You will need to watch out for this in any examples you do, as it can often be forgotten, leading to a more complex oolean expression than needed. You should begin to see now how the larger the group of s we can produce the simpler our oolean expression becomes. This will become even more obvious as we consider the 4 input logic systems. 8
Topic.2.3 Karnaugh Maps Four input Logic Systems The four input logic system produces 6 possible combinations of the 4 inputs, and this will require a much larger truth table, and a further extension to the Karnaugh map, as shown below: Inputs Output D Q a b c d e f g h i j k l m n o p a b d c e f h g m n p o i j l k heck the Karnaugh map carefully to ensure you are happy with the location of each line of the truth table in the Karnaugh map. When you have done a few of these it will become a little easier, but in the early stages it is worth taking your time when transferring the information from the truth table to ensure you have not made an error. Once the data has been transferred we simply apply all of the rules we have discovered so far, namely Group all logic s into as big a group as possible, i.e. groups of 2, 4 or 8 adjacent cells. Ensure all logic s are included in at least one group 9
Module ET Introduction to nalogue and Digital Systems. Write down the oolean expression for each group, joined by +. Example: The Karnaugh map is as Inputs D Q Output foll ows : onsidering the Karnaugh map carefully there are three groups that can be formed as shown. Notice that one group of terms wraps around the map to give a small group of 2 Logic s. The following oolean expression results.... D. This expression was obtained in one step, consider the simplification via oolean algebra.. D. D.... D. D.... D. D.... D....( D 2. D. D). D. D.... D. D.... D.. D... D........( D D) D.... D..( ) D........ D.... D. D.....( ) D.... D. D...
Topic.2.3 Karnaugh Maps. D....( D D).. D.... D..( ). D..( ). D... Having seen both methods of solution, which one do you prefer, oolean or Karnaugh maps? silly question I would think, because it is only now that we can see the power of using the Karnaugh map. efore letting you loose with a few examples it is worth spending a few minutes looking for some special links that exist in the Karnaugh map for four inputs. You will remember that there was one special case for the three input where a group of 4 could be created by folding the map around that the two ends came together. similar situation occurs with the Karnaugh map for 4 inputs, only more frequently... 2
Module ET Introduction to nalogue and Digital Systems.. 22
Topic.2.3 Karnaugh Maps Now it s time for you to have a go at an example. Example 2: The following truth table contains the function of a logic circuit. Use the blank Karnaugh map provided to determine the simplest oolean expression to show how the output Q can be derived from inputs,, and D. Inputs Output D Q {Hint : you should be able to find three groups in the Karnaugh map when it is completed.} Simplest oolean expression is :... 23
Module ET Introduction to nalogue and Digital Systems. efore proceeding with some further examples, a word of caution. Karnaugh maps are a graphical way of grouping common terms together. The way in which the groups are formed will determine the resulting expression, and this may lead to different answers which are completely correct. To illustrate this consider the following example: ssume that a particular design has produced the following Karnaugh map. Now consider the same map showing two different ways of grouping the Logic s, together and the resulting oolean expressions. Q. D. D.. D. D. OR Q.. D.... D 24
Topic.2.3 Karnaugh Maps Looking at these two expressions you should realise that they are completely different, both have the same number of terms so neither is a better solution than the other, and they are both correct. In an examination you will gain marks for doing the following things: i. for correctly completing the Karnaugh map from a truth table or oolean expression. ii. identifying the largest groups of adjacent Logic s. iii. including every logic in the map in at least one group, or individually if there are no adjacent s. iv. then writing down a correct oolean expression for each of the groups you have shown in the Karnaugh map. You should bear this in mind when checking your answers to the following problems. If you have chosen a different grouping of the Logic s to that shown in the solutions, you may have a different but equally correct solution. If you are not sure, ask your tutor to check this for you. Now it s time for you to have a go at some problems. 25
Module ET Introduction to nalogue and Digital Systems. Exercise 4 Determine the simplest oolean expression for the following:. Q Simplest oolean expression =... 2. Inputs Output D Q 26
Topic.2.3 Karnaugh Maps Simplest oolean Expression =... 3. Q Simplest oolean expression =... 4. Inputs Output D Q 27
Module ET Introduction to nalogue and Digital Systems. Simplest oolean Expression =... 28
5. Topic.2.3 Karnaugh Maps Q Simplest oolean expression =... 6. Inputs Output D Q Simplest oolean Expression =... 29
Module ET Introduction to nalogue and Digital Systems. You are now in a position to complete a Karnaugh map for 2, 3 and 4 input logic functions, although 2 input maps are rarely required, as it is often just as easy to get the oolean expression from the truth table. However, what if we are not given the truth table but just a oolean expression to simplify? Well we could draw the truth table and fill it in from the oolean expression and then complete the Karnaugh map. This would be a long process and it would be better if we could move directly from the oolean expression to the Karnaugh map. This is not as difficult as it might sound as long as we remember some simple rules. For a 2 input function, i. any term that contains 2 variables = one cell in the Karnaugh map. ii. any term that contains variable = 2 cells in the Karnaugh map. For a 3 input function, i. any term that contains 3 variables = cell in the Karnaugh map. ii. any term that contains 2 variables = 2 cells in the Karnaugh map. iii. any term that contains variable = 4 cells in the Karnaugh map. For a 4 input function, i. any term that contains 4 variables = cell in the Karnaugh map. ii. any term that contains 3 variables = 2 cells in the Karnaugh map. iii. any term that contains 2 variables = 4 cells in the Karnaugh map. iv. any term that contains variable = 8 cells in the Karnaugh map. Let s have a look at a couple of examples. 3
Topic.2.3 Karnaugh Maps 3
Module ET Introduction to nalogue and Digital Systems. Example : Simplify the following oolean Expression. D. D. D.. D.. D. D. To solve this you need to start with a blank Karnaugh map, take each term individually and put a in the cell of the Karnaugh map that corresponds to the logic expression. Step :. D. (4 variables = cell in map) Step 2 :. D. (3 variables = 2 cells in map) 32
Step 3 : Topic.2.3 Karnaugh Maps. D (3 variables = 2 cells in map). Step 4 :. D. (4 variables = cell in map) Step 5 : D. (3 variables = 2 cells in map) Notice that this was already filled in. 33
Module ET Introduction to nalogue and Digital Systems. Step 6 :. D. (3 variables = 2 cells in map) Step 7 : Finally having completed all the Logic s, the rest of the map can be filled in with s, to leave the completed map. Step 8 : Form the largest groups of s to include every at least once.. D.. 34
Topic.2.3 Karnaugh Maps Example 2 : Simplify the following oolean Expression. ( ).. D.. In this example we have one of the inverted functions, in this case a NOR function. These are difficult to put directly into a Karnaugh map because we have to think of the inverse function. It is easier to use DeMorgan s theorem to change the expression slightly before completing the Karnaugh map. Step : Remove the inverted function from the original expression. ( ).. D.. (. ).. D..... D.. Now proceed to complete the Karnaugh map as before. Step 2 :. 35
Module ET Introduction to nalogue and Digital Systems. Step 3 :. Step 4 :.. D Step 5 :. 36
Topic.2.3 Karnaugh Maps Step 6 : omplete the Karnaugh map by adding s to the map. Step 7 : Group the s into as large a group as possible and write down a oolean expression for each group. Simplest oolean Expression =... D s is usually the case with these questions, seeing examples that have been completed for you is o.k. but the real understanding comes from trying some yourself, so here are some for you to try. Only Karnaugh map has been provided for each example, because you can complete this step by step as you consider each term in the oolean equation, there is no need to complete multiple Karnaugh maps as has been shown here for illustration purposes. 37
Module ET Introduction to nalogue and Digital Systems. Exercise 6 : Simplify the following oolean Expressions..... Simplest oolean expression =... 2..... Simplest oolean expression =... 3.... Simplest oolean expression =... 38
4.. D.. D.. D... D Topic.2.3 Karnaugh Maps Simplest oolean expression =... 5.. D.. D...... D {Remember to split the NND function}... Simplest oolean expression =... You have now completed this section of the course, and are armed with enough knowledge to answer any examination questions on this topic. The next section gives the solutions to all of the exercises in this topic and this is followed by some examination style questions for you to practice. 39
Module ET Introduction to nalogue and Digital Systems. Solutions to Student Exercises Exercise :. ND gate: Q 2. NOR gate: Q 3. ExOR gate Q 4
4. NND gate Topic.2.3 Karnaugh Maps Q 5. ExNOR gate Q Exercise 2: Q Simplest oolean expression = heck via oolean gives... (.. ) 4
Module ET Introduction to nalogue and Digital Systems. Exercise 3. Q Simplest oolean expression = Example 2 : (Page 8) oolean expression is :... 42
Exercise 4: Topic.2.3 Karnaugh Maps. Q Simplest oolean expression =... or.( ). 2. Inputs Output D Q 43
Module ET Introduction to nalogue and Digital Systems. Simplest oolean Expression = 3... Q Simplest oolean expression = 4. Inputs Output D Q 44
Topic.2.3 Karnaugh Maps Simplest oolean Expression = D... D. or.( D)... D 45
Module ET Introduction to nalogue and Digital Systems. 5. Q Simplest oolean expression =.. or 6. Inputs Output D Q 46
Topic.2.3 Karnaugh Maps Simplest oolean Expression =. D... D Exercise 6 :.... Simplest oolean expression =. 2..... Simplest oolean expression =. 3.... Simplest oolean expression =. or.( ) 47
Module ET Introduction to nalogue and Digital Systems. 4.. D.. D.. D... D Simplest oolean expression =. D D 5.. D.. D...... D {Remember to split the NND function}. D.. D.. D.. D.. D.. D. Simplest oolean expression = D The next section contains some past examination style questions for you to practice. 48
Topic.2.3 Karnaugh Maps Examination Style Questions.. Use the laws of oolean algebra or Karnaugh maps to simplify the following expressions. (i) Q... (ii) Q =... Q. D.. D. D.. D Q =... [2] [3] 2. Simplify the following expressions. (i) Q. 49 [2]
Module ET Introduction to nalogue and Digital Systems. Q =... 5
(ii) Q. Topic.2.3 Karnaugh Maps Q =... [2] 3. Use Karnaugh maps to simplify the following expressions as far as possible. (i) Q. Q =... [2] (ii) Q.... Q =... [3] 5
Module ET Introduction to nalogue and Digital Systems. 4. In designing a logic system, a student has produced the Karnaugh map shown below. Give the simplest oolean expression for the output Q of this logic system. Show any groups that you create in producing this expression on the Karnaugh map. [5]...... 5. a) omplete the Karnaugh map for the following expression: Q D..... D..... D... [2] b) Give the simplest oolean expression for the output Q of this logic system. Show and label any groups that you create in producing this expression on the map. Q =... [4] 52
Topic.2.3 Karnaugh Maps 53
Module ET Introduction to nalogue and Digital Systems. 6. Either using the laws of oolean algebra or a Karnaugh maps simplify the following expression as much as possible. Q. D. D. D. D. D. Q =... [5] 7. Use the laws of oolean algebra or Karnaugh maps to simplify the following expressions. (i) Q.. Q =... [3] 54
Topic.2.3 Karnaugh Maps 8. Use the laws of oolean algebra or Karnaugh maps to simplify the following expressions. (i) Q.... Q =... [2] (ii) Q D... D.. D.. D.. D.. Q =... [4] 9. Use the laws of oolean algebra or Karnaugh maps to simplify the following expressions. (i) Q...... [3] 55
Module ET Introduction to nalogue and Digital Systems. Q =... 56
. Karnaugh map is shown below. Topic.2.3 Karnaugh Maps Give the simplest oolean expression for the output Q of this logic system. Show on the Karnaugh map any groups that you have created in producing this expression. [5]....... The following truth table defines the logic conditions for a particular application. Inputs Output D Q 57
Module ET Introduction to nalogue and Digital Systems. (a) Write down without simplification the oolean expression for the output Q, in terms of the inputs,, and D....... [3] (b) omplete the Karnaugh map below for the same logic function using either the truth table or your logic expression from (a) [2] (c) Hence derive the simplest oolean expression for the logic function.... [2] (d) In the space below draw the logic circuit diagram to show how the output Q, could be obtained from inputs,, and D, using ND, OR, and NOT gates only. [4] Q D 58
Topic.2.3 Karnaugh Maps Self Evaluation Review Learning Objectives Draw a Karnaugh map for a logic system with up to four inputs and use it to minimise the number of gates required; My personal review of these objectives: Targets:. 2. 59