Topic 1.2.3 – Karnaugh maps Learning Objectives: At 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; 1 Module ET1 Introduction to Analogue and Digital Systems. Karnaugh maps. Congratulations on reaching this point in the course, which will mean that you have successfully battled your way through some pretty tough Boolean 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 Boolean expression is obtained immediately, without the need for any further manipulation using Boolean 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. Inputs B 0 0 1 1 A 0 1 0 1 Output Q 0 1 1 1 What type of logic gate is this ? .................................................... An alternative way of presenting this data is as follows A B 0 1 0 0 1 1 1 1 Can you see how the logic state of Q has been transferred to the diagram ? 2 Topic 1.2.3 – Karnaugh maps 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. Inputs B 0 0 1 1 A 0 1 0 1 Inputs B 0 0 1 1 A 0 1 0 1 Inputs B 0 0 1 1 A 0 1 0 1 Inputs B 0 0 1 1 A 0 1 0 1 Output Q A B 0 1 0 1 0 1 0 1 0 1 Output Q A B 0 1 Output Q A B 0 1 Output Q A B 0 1 Now you should be able to complete a Karnaugh map for any two input logic function, so let’s put that to the test. 3 Module ET1 Introduction to Analogue and Digital Systems. Exercise 1 – Complete the following Truth Tables and Karnaugh maps for the logic gates named. 1. AND gate: Inputs B 0 0 1 1 2. A 0 1 0 1 B 0 0 1 1 A 0 1 0 1 B 0 1 0 1 0 1 0 1 Output Q A B 0 1 ExOR gate Inputs B 0 0 1 1 4 A NOR gate: Inputs 3. Output Q A 0 1 0 1 Output Q A B 0 1 Topic 1.2.3 – Karnaugh maps 4. NAND gate Inputs B 0 0 1 1 5. A 0 1 0 1 Output Q A B 0 1 0 1 0 1 ExNOR gate Inputs B 0 0 1 1 A 0 1 0 1 Output Q A B 0 1 An alternative way of looking at the cells in the Karnaugh map is shown below: Inputs B 0 0 1 1 A 0 1 0 1 Output Q A B 0 1 A.B A.B A.B 0 A.B A.B 1 A.B A.B A.B This should give you a clue as to how we can read a Karnaugh map, since each cell has it’s own Boolean expression! 5 Module ET1 Introduction to Analogue and Digital Systems. So we can now fill in a Karnaugh map, but how do we read them to obtain a Boolean expression? Complete the Karnaugh map for the following truth table. Inputs B 0 0 1 1 A 0 1 0 1 Output Q 0 1 0 0 A B 0 1 0 1 In this case, the truth table and the Karnaugh map do not match one of our standard logic gates, but we can extract the Boolean equation straight from the cell in the Karnaugh map containing a logic 1, i.e. A.B 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. Inputs B 0 0 1 1 A 0 1 0 1 Output Q 1 1 0 1 A B 0 1 0 1 1 1 0 1 At first glance this might look like one of our standard logic gates, however it isn’t. Now if we write down the Boolean expression for each logic 1 in the map we get the following: A.B A.B A.B This is not exactly the simplest of Boolean 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. 6 Topic 1.2.3 – Karnaugh maps Let us look at that expression and simplify it using Boolean Algebra to obtain the simplest solution. A.B A.B A.B A.B A.(B B) A.B A BA Now look at the Karnaugh map again A B 0 1 0 1 1 1 0 1 If we think of the right hand side of the Karnaugh map and compare it to the map we introduced earlier showing the Boolean terms for each cell we obtain the following: A A B B 0 1 0 1 0 1 1 0 A.B A.B 1 0 1 1 A.B A.B What this shows is that the Boolean terms we have grouped together are: A.B A.B A.(B B) A.1 A Using the Karnaugh map is a graphical method of finding the common factors in a Boolean expression. If we look at the Karnaugh map we can see that the group of 1’s we have identified corresponds to when input A is a logic 1, which corresponds to the simplest term obtained via the Boolean simplification. 7 Module ET1 Introduction to Analogue and Digital Systems. Now consider the following alternative grouping that could have been created. A A B B 0 1 0 1 0 1 1 0 A.B A.B 1 0 1 1 A.B A.B Again this shows that the Boolean terms we have grouped together are: A.B A.B B.( A A ) B.1 B If we look at the Karnaugh map we can see that the group of 1’s we have identified corresponds to when input B is a logic 0, or B , which corresponds to the simplest term obtained via the Boolean simplification. If we put the two results together we obtain the simplest solution as A B In practice we would perform these two simplifications in one step as shown below: B A B 0 1 0 1 1 1 0 1 A 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. The only thing we have to be sure of is that every logic 1 in the map is included in at least one group. 8 Topic 1.2.3 – Karnaugh maps Example 2 : Try the following example: i. ii. iii. iv. Complete the Karnaugh map. Group the logic 1’s together Write down the Boolean term for each group linked by the OR function ‘+’. Check your answer by simplifying the expression obtained from the truth table using the rules of Boolean Algebra. Inputs B 0 0 1 1 A 0 1 0 1 Output Q 1 0 1 1 A B 0 1 0 1 Simplest Expression from map = ....................................................... Boolean 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. 9 Module ET1 Introduction to Analogue and Digital Systems. Three Input Logic Systems. A three input logic system will have eight possible input combinations as shown below. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 A 0 1 0 1 0 1 0 1 Output Q We need a bigger Karnaugh map to accommodate the extra input details, and this is shown below: BA C 00 01 11 10 0 1 Things to note: i. the inputs A and B have been linked together on the top row of the Karnaugh map. ii. the sequence of combinations for A.B , 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. 10 Topic 1.2.3 – Karnaugh maps 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: C 0 0 0 0 1 1 1 1 Inputs B 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 Output Q a b c d e f g h A 0 1 0 1 0 1 0 1 Output Q 1 1 1 0 0 0 1 0 BA C 00 01 11 10 0 a b d c 1 e f h g Example : C 0 0 0 0 1 1 1 1 Inputs B 0 0 1 1 0 0 1 1 BA C 00 01 11 10 0 1 1 0 1 1 0 0 0 1 We use the same rules as before to group the Logic 1’s together as a group as shown below. Now write down the Boolean expression for BA each group. The rule is that we ignore any C 00 01 11 10 variable that changes between groups. 0 1 1 0 1 B.A {Note: C changes but not B.A } 1 0 0 0 1 C.B {Note: A changes but not C.B } So the Boolean Expression is B.C A.B . 11 Module ET1 Introduction to Analogue and Digital Systems. Now compare this to the Boolean Simplification. A.B.C A.B.C A.B.C A.B.C B.C.( A A) A.B.(C C) B.C A.B Now consider the following example. C 0 0 0 0 1 1 1 1 Inputs B 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 Output Q 1 1 1 1 0 0 1 1 BA C 00 01 11 10 0 1 1 1 1 1 0 0 1 1 In this case there are a large number of logic 1’s in the Karnaugh map, we could group these into three groups of 2 as we have done previously. BA C 00 01 11 10 0 1 1 1 1 1 0 0 1 1 Using our normal rules we obtain the following Boolean expression. B.C A.B A.B This does not look to be a very simple solution, and indeed we can use Boolean Algebra to simplify this further as follows: B.C A.B A.B B.C B.( A A) B.C B CB 12 Topic 1.2.3 – Karnaugh maps 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 Boolean expression is C B . The Karnaugh map is: C {Note: A and B change but not C } BA 00 01 11 10 C 0 1 1 1 1 1 0 0 1 1 B {Note: A and C change but not B } The Karnaugh map shows that the two terms in the simplest Boolean expression refer to groups of 4 logic 1’s in the map. This gives us another rule for working with Karnaugh maps – Group the logic 1’s into the largest group possible, i.e. groups of 2 or 4 adjacent cells. Exercise 3 – Derive the simplest Boolean expression for the logic function defined by the truth table. C 0 0 0 0 1 1 1 1 Inputs B 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 Output Q 0 1 0 1 1 1 0 1 BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................................... 13 Module ET1 Introduction to Analogue and Digital Systems. Before 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. BA C 00 01 11 10 0 1 0 0 1 1 1 0 0 1 At first glance it might appear that we would have to group these as two groups of 2, giving the Boolean expression as: A.B A.B But this can be simplified to just A , which would indicate from our previous work that there should be a group of 4 logic 1’s in this map, and indeed there is if we imagine the map rolled around so that the two ends meet. BA C 00 01 11 10 0 1 0 0 1 1 1 0 0 1 You will need to watch out for this in any examples you do, as it can often be forgotten, leading to a more complex Boolean expression than needed. You should begin to see now how the larger the group of 1’s we can produce the simpler our Boolean expression becomes. This will become even more obvious as we consider the 4 input logic systems. 14 Topic 1.2.3 – Karnaugh maps Four input Logic Systems The four input logic system produces 16 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 D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q a b c d e f g h i j k l m n o p BA DC 00 01 11 10 00 a b d c 01 e f h g 11 m n p o 10 i j l k Check 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 1’s into as big a group as possible, i.e. groups of 2, 4 or 8 adjacent cells. Ensure all logic 1’s are included in at least one group Write down the Boolean expression for each group, joined by ‘+’. 15 Module ET1 Introduction to Analogue and Digital Systems. Example: Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 1 1 1 0 0 1 0 1 0 1 0 0 0 1 0 1 The Karnaugh map is as follows: BA DC 00 01 11 10 00 1 1 0 1 01 0 1 1 0 11 0 1 1 0 10 0 1 0 0 Considering 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 1’s. The following Boolean expression results. A.C A.B A.C.D This expression was obtained in one step, consider the simplification via Boolean algebra. A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.(D D) A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C.D A.B.C A.B.C.(D D) A.B.C.D A.C.D.(B B) A.B.C.D A.B.C A.B.C. A.B.C.D A.C.D A.B.C.D A.C.(B B) A.B.C.D A.C.D A.B.C.(D D) A.C A.C.D A.B.C A.C A.C.D A.(B.C C) A.C.D A.(B C) A.C.D A.B A.C 16 Topic 1.2.3 – Karnaugh maps Having seen both methods of solution, which one do you prefer, Boolean or Karnaugh maps ? A silly question I would think, because it is only now that we can see the power of using the Karnaugh map. Before 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. A similar situation occurs with the Karnaugh map for 4 inputs, only more frequently. BA BA DC 00 01 11 10 DC 00 01 11 10 00 0 1 1 0 00 0 0 0 0 01 0 0 0 0 01 1 0 0 1 11 0 0 0 0 11 1 0 0 1 10 0 1 1 0 10 0 0 0 0 A.C A.C BA DC 00 01 11 10 00 1 0 0 1 01 0 0 0 0 11 0 0 0 0 10 1 0 0 1 17 BA DC 00 01 11 10 Module ET1 00 1 1 1 1 Introduction to Analogue and 01 Digital 0 Systems. 0 0 0 A.C 18 11 0 0 0 0 10 1 1 1 1 C Topic 1.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 Boolean expression to show how the output Q can be derived from inputs A, B, C and D. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 BA DC 00 01 11 10 00 01 11 10 {Hint : you should be able to find three groups in the Karnaugh map when it is completed.} Simplest Boolean expression is : ............................................................................... 19 Module ET1 Introduction to Analogue and Digital Systems. Before 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: Assume that a particular design has produced the following Karnaugh map. BA DC 00 01 11 10 00 0 1 0 0 01 0 1 1 1 11 0 0 0 1 10 1 1 0 1 Now consider the same map showing two different ways of grouping the Logic 1’s, together and the resulting Boolean expressions. BA BA DC DC 00 01 11 10 00 01 11 10 00 0 1 0 0 00 0 1 0 0 01 0 1 1 1 01 0 1 1 1 11 0 0 0 1 11 0 0 0 1 10 1 1 0 1 10 1 1 0 1 Q A.B.D B.C.D A.B.D B.C.D OR Q A.B.C A.C.D A.B.C A.C.D 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. 20 Topic 1.2.3 – Karnaugh maps In an examination you will gain marks for doing the following things: i. for correctly completing the Karnaugh map from a truth table or Boolean expression. ii. identifying the largest groups of adjacent Logic 1’s. iii. including every logic 1 in the map in at least one group, or individually if there are no adjacent 1’s. iv. then writing down a correct Boolean 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 1’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. 21 Module ET1 Introduction to Analogue and Digital Systems. Exercise 4 – Determine the simplest Boolean expression for the following: 1. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 Output Q 1 0 0 1 0 1 0 1 A 0 1 0 1 0 1 0 1 BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................................... 2. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 BA DC 00 01 11 10 00 01 11 10 Simplest Boolean Expression = ................................................................................. 22 Topic 1.2.3 – Karnaugh maps 3. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 Output Q 0 1 1 1 0 1 0 1 A 0 1 0 1 0 1 0 1 BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................................... 4. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 1 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 BA DC 00 01 11 10 00 01 11 10 Simplest Boolean Expression = ................................................................................. 23 Module ET1 Introduction to Analogue and Digital Systems. 5. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 Output Q 0 1 0 1 1 0 1 0 A 0 1 0 1 0 1 0 1 BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................................... 6. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 1 BA DC 00 01 11 10 00 01 11 10 Simplest Boolean Expression = ................................................................................. 24 Topic 1.2.3 – Karnaugh maps 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 Boolean expression from the truth table. However, what if we are not given the truth table but just a Boolean expression to simplify ? Well we could draw the truth table and fill it in from the Boolean 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 Boolean 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 = 1 one cell in the Karnaugh map. ii. any term that contains 1 variable = 2 cells in the Karnaugh map. For a 3 input function, i. any term that contains 3 variables = 1 cell in the Karnaugh map. ii. any term that contains 2 variables = 2 cells in the Karnaugh map. iii. any term that contains 1 variable = 4 cells in the Karnaugh map. For a 4 input function, i. any term that contains 4 variables = 1 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 1 variable = 8 cells in the Karnaugh map. Let’s have a look at a couple of examples. 25 Module ET1 Introduction to Analogue and Digital Systems. Example 1 : Simplify the following Boolean Expression A.B.C.D B.C.D B.C.D A.B.C.D A.B.D B.C.D To solve this you need to start with a blank Karnaugh map, take each term individually and put a ‘1’ in the cell of the Karnaugh map that corresponds to the logic expression. Step 1 : A.B.C.D (4 variables = 1 cell in map) BA DC 00 01 11 10 00 1 01 11 10 Step 2 : B.C.D (3 variables = 2 cells in map) BA DC 00 01 11 10 00 01 11 10 26 1 1 1 Topic 1.2.3 – Karnaugh maps Step 3 : B.C.D (3 variables = 2 cells in map) BA DC 00 01 11 10 00 1 01 1 1 1 11 10 1 1 Step 4 : A.B.C.D (4 variables = 1 cell in map) BA DC 00 00 01 11 10 1 1 1 01 1 11 10 1 1 Step 5 : A.B.D (3 variables = 2 cells in map) BA DC 00 01 11 10 00 1 1 01 1 11 1 10 1 1 1 Notice that this was already filled in. 27 Module ET1 Introduction to Analogue and Digital Systems. Step 6 : B.C.D (3 variables = 2 cells in map) BA DC 00 01 11 10 00 1 01 1 11 1 10 1 1 1 1 1 1 Step 7 : Finally having completed all the Logic 1’s, the rest of the map can be filled in with ‘0’s, to leave the completed map. BA DC 00 01 11 10 00 1 0 1 1 01 0 1 0 0 11 0 1 0 0 10 1 1 1 1 Step 8 : Form the largest groups of 1’s to include every ‘1’ at least once. BA 00 01 11 10 DC 28 00 1 0 1 1 01 0 1 0 0 11 0 1 0 0 10 1 1 1 1 C.D B.C A.C A.B.C Topic 1.2.3 – Karnaugh maps Example 2 : Simplify the following Boolean Expression. ( A C) A.B.C A.C.D A.C 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 1 : Remove the inverted function from the original expression. ( A C) A.B.C A.C.D A.C ( A.C) A.B.C A.C.D A.C A.C A.B.C A.C.D A.C Now proceed to complete the Karnaugh map as before. Step 2 : A.C BA DC 00 01 11 10 00 1 1 1 1 01 11 10 29 Module ET1 Introduction to Analogue and Digital Systems. Step 3 : A.B.C BA DC 00 01 11 10 00 1 1 01 1 11 1 10 1 1 Step 4 : A.C.D BA DC 00 01 11 10 00 1 1 01 1 11 1 10 1 1 1 1 Step 5 : A.C BA DC 00 01 11 10 00 1 01 1 1 11 1 1 1 1 10 30 1 1 1 Topic 1.2.3 – Karnaugh maps Step 6 : Complete the Karnaugh map by adding ‘0’s to the map. BA DC 00 01 11 10 00 1 0 0 1 01 0 1 1 0 11 0 1 1 0 10 1 1 1 1 Step 7 : Group the 1’s into as large a group as possible and write down a Boolean expression for each group. BA DC 00 01 11 10 00 1 0 0 1 01 0 1 1 0 11 0 1 1 0 10 1 1 1 1 Simplest Boolean Expression = A.C A.C A.D As 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 1 Karnaugh map has been provided for each example, because you can complete this step by step as you consider each term in the Boolean equation, there is no need to complete multiple Karnaugh maps as has been shown here for illustration purposes. 31 Module ET1 Introduction to Analogue and Digital Systems. Exercise 6 : Simplify the following Boolean Expressions. 1. A.B.C A.B.C A.B B.C BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................ 2. A.B.C A.B.C A.B A.C BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................ 3. A.B.C A.B.C A.B.C BA C 00 01 11 10 0 1 Simplest Boolean expression = ............................................................ 32 Topic 1.2.3 – Karnaugh maps 4. A.B.D A.B.C.D A.B.C B.C.D A.B.C.D BA DC 00 01 11 10 00 01 11 10 Simplest Boolean expression = ............................................................ 5. A.B.C.D A.B.D A.B A.B.C.D {Remember to split the NAND function} ............................................................................................................. BA DC 00 01 11 10 00 01 11 10 Simplest Boolean 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. 33 Module ET1 Introduction to Analogue and Digital Systems. Solutions to Student Exercises Exercise 1: 1. AND gate: Inputs B 0 0 1 1 2. A 0 1 0 1 Output Q 0 0 0 1 A 0 1 0 1 Output Q 1 0 0 0 A 0 1 0 1 Output Q 0 1 1 0 B 0 0 1 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 1 1 0 A B ExOR gate Inputs B 0 0 1 1 34 B NOR gate: Inputs 3. A A B Topic 1.2.3 – Karnaugh maps 4. NAND gate Inputs B 0 0 1 1 5. A 0 1 0 1 Output Q 1 1 1 0 A 0 1 0 1 Output Q 1 0 0 1 A 0 1 0 1 Output Q 1 0 1 1 A B 0 1 0 1 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 ExNOR gate Inputs B 0 0 1 1 A B Exercise 2: Inputs B 0 0 1 1 A B Simplest Boolean expression = A B Check via Boolean gives A.B A.B A.B A.B B.( A A) A.B B A B 35 Module ET1 Introduction to Analogue and Digital Systems. Exercise 3. C 0 0 0 0 1 1 1 1 Inputs B 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 Output Q 0 1 0 1 1 1 0 1 BA C 00 01 11 10 0 0 1 1 0 1 1 1 1 0 Simplest Boolean expression = A B.C Example 2 : (Page 18) BA DC 00 01 11 10 00 0 0 1 0 01 1 1 0 1 11 1 1 0 1 10 0 0 1 0 Boolean expression is : B.C A.B.C A.C 36 Topic 1.2.3 – Karnaugh maps Exercise 4: 1. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 Output Q 1 0 0 1 0 1 0 1 A 0 1 0 1 0 1 0 1 BA C 00 01 11 10 0 1 0 1 0 1 0 1 1 0 Simplest Boolean expression = A.B A.C A.B.C or A.(B C) A.B.C 2. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 0 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 BA DC 00 01 11 10 00 0 0 0 1 01 0 1 1 1 11 0 1 1 1 10 0 0 0 1 Simplest Boolean Expression = A.C A.B 37 Module ET1 Introduction to Analogue and Digital Systems. 3. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 Output Q 0 1 1 1 0 1 0 1 A 0 1 0 1 0 1 0 1 BA C 00 01 11 10 0 0 1 1 1 1 0 1 1 0 Simplest Boolean expression = A B.C 4. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 1 1 1 1 0 0 0 0 1 0 1 0 0 1 0 0 BA DC 00 01 11 10 00 1 1 1 1 01 0 0 0 0 11 0 1 0 0 10 1 0 0 1 Simplest Boolean Expression = B.C C.D A.B.C.D or C.(B D) A.B.C.D 38 Topic 1.2.3 – Karnaugh maps 5. Inputs B 0 0 1 1 0 0 1 1 C 0 0 0 0 1 1 1 1 Output Q 0 1 0 1 1 0 1 0 A 0 1 0 1 0 1 0 1 BA C 00 01 11 10 0 0 1 1 0 1 1 0 0 1 Simplest Boolean expression = A.C A.C or A C 6. Inputs D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 1 BA DC 00 01 11 10 00 0 1 1 0 01 1 0 0 1 11 1 1 1 1 10 0 0 0 0 Simplest Boolean Expression = C.D A.C A.C.D 39 Module ET1 Introduction to Analogue and Digital Systems. Exercise 6 : 1. A.B.C A.B.C A.B B.C BA C 00 01 11 10 0 0 0 1 1 1 1 0 1 1 Simplest Boolean expression = B A.C 2. A.B.C A.B.C A.B A.C BA C 00 01 11 10 0 1 1 1 1 1 0 1 0 0 Simplest Boolean expression = C A.B 3. A.B.C A.B.C A.B.C BA C 00 01 11 10 0 0 1 0 0 1 1 1 0 0 Simplest Boolean expression = A.B B.C or B.( A C) 40 Topic 1.2.3 – Karnaugh maps 4. A.B.D A.B.C.D A.B.C B.C.D A.B.C.D BA DC 00 01 11 10 00 0 1 1 0 01 0 1 1 0 11 0 0 1 1 10 0 0 1 1 Simplest Boolean expression = A.D B.D 5. A.B.C.D A.B.D A.B A.B.C.D {Remember to split the NAND function} A.B.C.D A.B.D A B A.B.C.D A.B.C.D A.B.D A B A.B.C.D BA DC 00 01 11 10 00 1 1 1 1 01 1 1 1 1 11 0 1 1 1 10 0 1 1 1 Simplest Boolean expression = A B D The next section contains some past examination style questions for you to practice. 41 Module ET1 Introduction to Analogue and Digital Systems. Examination Style Questions. 1. Use the laws of Boolean algebra or Karnaugh maps to simplify the following expressions. (i) Q A.B.C A.B.C A.C ..................................................................................... ..................................................................................... BA C 00 01 11 10 ..................................................................................... 0 ..................................................................................... 1 ..................................................................................... [2] Q = ............................................................................. (ii) Q A.B.C.D A.B.C.D B.C.D B.C.D BA ..................................................................................... ..................................................................................... ..................................................................................... ..................................................................................... ..................................................................................... ..................................................................................... DC 00 01 11 10 00 01 11 10 ..................................................................................... [3] Q = ............................................................................. 2. Simplify the following expressions. (i) Q A.B B A ..................................................................................... B 0 ..................................................................................... 0 ..................................................................................... 1 1 ..................................................................................... [2] Q = ............................................................................. 42 Topic 1.2.3 – Karnaugh maps (ii) Q A B.C A.B.C ..................................................................................... ..................................................................................... BA C 00 01 11 10 ..................................................................................... 0 ..................................................................................... 1 ..................................................................................... [2] Q = ............................................................................. 3. Use Karnaugh maps to simplify the following expressions as far as possible. (i) Q A.B A A ..................................................................................... B 0 ..................................................................................... 0 ..................................................................................... 1 1 ..................................................................................... [2] Q = ............................................................................. (ii) Q A.B A.B.C A.B.C A.B.C ..................................................................................... BA ..................................................................................... C 00 01 11 10 ..................................................................................... 0 ..................................................................................... 1 ..................................................................................... [3] Q = ............................................................................. 43 Module ET1 Introduction to Analogue and Digital Systems. 4. In designing a logic system, a student has produced the Karnaugh map shown below. BA DC 00 01 11 10 00 0 0 1 1 01 1 1 0 0 11 1 1 0 1 10 0 0 1 1 Give the simplest Boolean 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) Complete the Karnaugh map for the following expression: Q D.C.B.A C.B.A D.C.B.A C.B.A D.C.B.A BA DC 00 01 11 10 00 01 11 10 [2] b) Give the simplest Boolean 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] 44 Topic 1.2.3 – Karnaugh maps 6. Either using the laws of Boolean algebra or a Karnaugh maps simplify the following expression as much as possible. Q A.B.D B.C.D B.C.D B.C.D B.C.D BA ..................................................................................... DC 00 01 11 10 ..................................................................................... 00 ..................................................................................... 01 ..................................................................................... 11 ..................................................................................... 10 ..................................................................................... ..................................................................................... [5] Q = ............................................................................. 7. Use the laws of Boolean algebra or Karnaugh maps to simplify the following expressions. (i) Q A.B B.C B.C A.B.C ..................................................................................... BA ..................................................................................... C ..................................................................................... ..................................................................................... 00 01 11 10 0 1 ..................................................................................... [3] Q = ............................................................................. 45 Module ET1 Introduction to Analogue and Digital Systems. 8. Use the laws of Boolean algebra or Karnaugh maps to simplify the following expressions. (i) Q A.B.C A.B A.B A.B.C ..................................................................................... BA ..................................................................................... C ..................................................................................... 00 01 11 10 0 ..................................................................................... 1 ..................................................................................... [2] Q = ............................................................................. (ii) Q D.C.B.A D.C.A D.B.A D.C.A D.B.A ..................................................................................... ..................................................................................... BA DC 00 01 11 10 ..................................................................................... 00 ..................................................................................... 01 ..................................................................................... 11 ..................................................................................... 10 ..................................................................................... [4] Q = ............................................................................. 9. Use the laws of Boolean algebra or Karnaugh maps to simplify the following expressions. (i) Q C.A C.B C.B.A C.B.A ..................................................................................... ..................................................................................... ..................................................................................... ..................................................................................... BA C 00 01 11 10 0 1 ..................................................................................... [3] Q = ............................................................................. 46 Topic 1.2.3 – Karnaugh maps 10. A Karnaugh map is shown below. BA DC 00 01 11 10 00 1 1 0 0 01 0 0 1 1 11 1 0 1 1 10 1 1 0 0 Give the simplest Boolean 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] ............................................................................................................................................................ ............................................................................................................................................................ 11. The following truth table defines the logic conditions for a particular application. Inputs (a) D 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 C 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 B 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Output Q 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 0 47 Module ET1 Introduction to Analogue and Digital Systems. (a) Write down without simplification the Boolean expression for the output Q, in terms of the inputs A, B, C and D. .................................................................................................................................................. .................................................................................................................................................. [3] (b) Complete the Karnaugh map below for the same logic function using either the truth table or your logic expression from (a) BA DC 00 01 11 10 00 01 11 10 [2] (c) Hence derive the simplest Boolean 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 A, B, C and D, using AND, OR, and NOT gates only. [4] A B Q C D 48 Topic 1.2.3 – Karnaugh maps Self Evaluation Review Learning Objectives My personal review of these objectives: Draw a Karnaugh map for a logic system with up to four inputs and use it to minimise the number of gates required; Targets: 1. ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 2. ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… 49