Presentation on theme: ""— Presentation transcript:
68 Lecture 5Karnaugh MapsOne of the easiest ways to simplify a Boolean expression is throughthe use of a Karnaugh map. Let us recall the OR gate (again!)The Boolean minterm is A B + A B + A BThe general form of a 2 input Karnaugh map is below. Note thateach square differs from its neighbouring square by changing only 1of the numbers- this is more important for 3 and greater KarnaughmapsA logic function with n variables will require 2n squaresBA00011110
69 To produce a simplified Boolean expression using a K-map (1) produce the Boolean minterm(2) plot the 1s for the ANDed variables in the appropriate square(3) loop adjacent (horizontal or vertical groups of 8, 4, or 2 1s together(4) eliminate variable/complements pairs(5) OR the remaining variablesLets use the OR function as an example.1. The Boolean minterm is2A B + A B + A BBA
70 BA1Loop 13. Loop adjacent 1sLoop 24. Eliminate variable/complements pairsFrom loop 1: A B and A B, since A and A are variable and complementthey are eliminated. This leaves only B.From loop 2, A B and A B, since B and B are variable and complementthey are eliminated. This leaves only A.5. OR the remaining variables Y = A + B
71 NoteYou may only loop horizontally or vertically. This is because you are changing just one variable at a time. You cannot loop diagonally.Start with the highest number of squares 8, then 4 then 2.If you have a group of 4, it is the same as looping 4 groups of 2. (Can you see where the 4 doublets are?)You can loop the same 1 more than once – in fact you can do this often.
72 Consider the case of a 3 input K map. In this case we have A, B and C which are grouped into the 4 possible AB combinations x 2 possible Ccombinations. Therefore the K map will have 8 squaresA BA BCConsider the truth table.Step 1. MintermY =
73 Step 2. Mark 1s in the appropriate squares A BA BCStep 3. Loop 8, 4 or 2, adjacent 1s.Step 4. Eliminate variable/complements pairsStep 5. OR remaining variables
74 Check 1:Do we always get a 1 when C = 1Do we always get a 1 when A B = 1
75 Check 2:Can we simplify the original minterm expression to get the same answer.Y = A B C + A B C + A B C + A B C + A B C
76 AB CD Pick any square and As the number of variables increases K maps become very useful.Consider the case of a 4 variable input (A,B,C and D). There are 4possible AB combinations x 4 possible CD combinations so the K mapwill have 16 squares. Fill in the possible arrangementsABCDPick any square andgoing vertically or horizontally we only change one variable at a time.
77 A BA BC DNote the pattern 0 1 1 1 1 0We are changing one bit at a time. This single variable change is calledadjacency.The bit in the sequence is which is the same as the first bit.This is important when considering special looping arrangements
78 Exercise 5.1 Use this 4 input truth table. Step 1. Write out the unsimplified Boolean minterm
79 Step 2. Mark 1s in the appropriate squares Step 3. Loop 8, 4 or 2 adjacent 1s.Step 4. Eliminate variable/complements pairsStep 5. OR remaining variables
80 Check:Do you get a ‘1’ when D = 1 or when A B C = 1
81 Lecture 6 K maps can have some unusual looping arrangements. You should prove to yourself that the K map for the expressionY = A B C D + A B C D + A B C D + A B C D + A B C D is given belowA BA BC D1
82 Is loop 3 permitted???? NO A B A B C D Loop 1 B and B - eliminate A, C, D - keep11111Loop 2B and B - eliminateA, C, D - keepIs loop 3 permitted????NO
83 Why can we not loop on a diagonal or a group of 3??
84 So the original expression can be simplified to Y = A C D + A C D + A B C DBut we can combine the first 2 terms here to giveY = A C D + A C D + A B C D= A (C + C ) D + A B C D= A D + A B C DIs this the case could we not have done this using the K-map.Answer – we can if we look for ‘unusual’ looping arrangements.
85 A BA BC D1Eliminate B and Balso C and C whichjust leavesA and DA BA B1C DThis grouping isequivalent to
86 Other interesting looping arrangements are A BA BC11No change1A BA BCEliminate A and Agives B and C111Y = A B C + B C
88 You should prove that looping (i) vertically and (ii) horizontally gives the same result.A BA BA BA BC D11C DC DC D11
89 We can come to some conclusions about the structure of K maps We can come to some conclusions about the structure of K maps. For a 3 variable K mapa 1 cell group yields a 3 variable product terma 2 cell group yields a 2 variable product terma 4 cell group yields a 1 variable product terma 8 cell group yields a value of 1 for the expressionExample. What logic expression do we get from these K maps?A BA BC1111A BA BC1111
90 This allows us to regard different parts of the K map to be associated with different variables.
91 For a 4 variable K mapa 1 cell group yields a 4 variable product terma 2 cell group yields a 3 variable product terma 4 cell group yields a 2 variable product terma 8 cell group yields a 1 variable product terma 16 cell group yields a value of 1 for the expressionA BA BC D
92 Similar to a 3 variable to a map we can regard different parts of the K map to be associated with different variables.A BA BC D
93 Some formal definitions A literal is a variable either complemented or not complemented.Example A, B and DNormal product term is a product of terms in which no variable appears more than once. Example AB or ACD. An example of a non-normal product term would be ACC
94 An implicant is a normal product term that implies Y = 1 An implicant is a normal product term that implies Y = 1. For example if Y= AB + BC, the implicants are AB and BC.A prime implicant (PI) is one that is not a subset of another implicant.In a K map a PI is the largest possible grouping allowed.E.g a group of 4 will be a PI whereas the two groups of 2 will only be implicants.A distinguished 1-cell is a cell that is covered by only one PI.In a K-map, such cells are 1s that are circled once.An essential prime implicant is a PI if it includes a 1 that is not included in any other prime implicant.For a K map the EPIs must include the PIs associated with a distinguished 1 cells.
95 5. A minimal sum is a SOP expression such that no SOP expression of Y has fewer product terms. It will include the EPIs but MUST also include whatever number of other terms to make sure that all the 1s have been covered.
96 The best way to examine these terms is by means of an example The best way to examine these terms is by means of an example. Using the information in the K-map to determinethe number and list of PIs,The distinguished 1-cells,the EPIs andthe minimal sum.A BA BC D1
97 So we can write Y asY =This SOP expression contains 5 terms – these are the 5 implicants.What we want to see is if it is possible to write out another expression for Y but which has fewer terms.
98 the PIs,The distinguished 1-cells,the EPIs andthe minimal sum.
99 Recall thatY =Now Ymin = A C D + A C D + other terms????The key point was the distinguished 1-cells are also EPI and the EPI will form part of the minimal sum.We must check whether using the EPIs alone is sufficient so that all the 1s are covered.Answer – NO we must add an extra term/s – but which one??Add BCD to the EPIs to give the minimal sum
100 Exercise 6. 1. Here is a slight variation from the previous example Exercise 6.1. Here is a slight variation from the previous example. Using the information in the K-map to determinethe number and list of PIs,The distinguished 1-cells,the EPIs andthe minimal sum.A BA BC D1
101 the PIs,The distinguished 1-cells,the EPIs andthe minimal sum.
102 In each of the 3 maps the location of the EPI have been circled 1In each of the 3 maps the locationof the EPI have been circledHow do we know that theses areEPIs?They are the PIs associated with adistinguished 1 cell.So the minimal sum will includethese two terms.How many ways is it possible togroup together the other 1spresent using as small a number ofgroups as possible??11
103 So the minimal sum will include these two terms. Do these two terms cover all the 1s present?If YES then the the minimal sum is just the EPIsIf NO then we need to add the minimal number of extra termsHow many ways is it possible to group together the other 1spresent using as small a number ofgroups as possible??
104 The previous example showed that that there are 3 ways to ensure that all the 1s are covered so there are three possible ways to write out the the minimal sumYmin = A B C + A C D +Ymin = A B C + A C D +Each of these uses 4 terms. The original expression used 6. This means that there exist expressions with 5 PI but they do not form a minimal sum.
105 Exercise 6.2 Using the information in the K-map to determine the number and lists of PIs,The distinguished 1-cells,the EPIs andthe minimal sum.A BA BC D111111111
106 the PIs,The distinguished 1-cells,the EPIs andthe minimal sum.
107 Remember this is the ‘sum-of-products’. Y = A B C + A B C Lecture 7We can write the minterm asSince it consist of terms from rows 4 and 7 it can also be written as S A,B,C (4,7)= S (4,7).This is known as the canonical sum of the logic function and the elements within the sum make up the minterm list and mans ‘the sum of the minterms 4 and 7 with variables A,B and C’.Remember this is the ‘sum-of-products’.In the case of 3 input K map the cell numbers areY = A B C + A B C
108 What are the cell numbers associated with the 4 variable K map. C D
110 Exercise 7. 1. Look at the K map below Exercise 7.1. Look at the K map below. Write out an canonical sum for Y?A BA BC D1
111 Exercise 7.2This system has four inputs and one outputs. The first two inputs A and B represent a 2-bit binary number in the range of 0 to 3. A second binary number (in the same range) is represented by the other two outputs, C and D.The output F is to be 1 if and only if the second number is larger than the first number.Show a truth table for F and write down the unsimplifed Boolean expression.Show F on a Karnaugh map and find a simplified expression for F.
113 The final aspect of K maps is the ‘don’t care’ condition. To produce a decimal signal for the numbers 0-9 we need to know the binary equivalents.
114 From the truth table binary numbers 0000 to 1001 represent 0 to 9. (This is a 4 bit weighted code and is correctly known as the 8421 BCD code – binary coded decimal).The truth table shows that possible values such as 1010 etc are possible but these would not lie in the range 0-9.These six combinations are called ‘Don’t cares’ when plotted on a Karnaugh map using an XWe may allow the Xs to be 1 or 0 depending on our needs.In the example above, suppose to prevent using these 6 additional number we wish to stop when the BCD count reaches 9. The Boolean expression for this isD C B A (remember that A B = B A).
115 The 6 don’t cares are marked with an X which could me that they could be 0 or 1. A BA BC DX1We can then loop around, 8, 4 or 2 adjacent 1s and since the Xs could be 1s we loop around them and then proceed as normally.So the simplified expression is Y = D A
116 An interesting question. Why do we not loop like this as well. Answer. Firstly it does not cover a 1 and secondly it would add an extra term ABA BA BC DX1
117 Exercise 7.3: Simplify the logic function given by f= S (1, 3, 7, 8, 9, 10, 12, 13, 14, 15)How would your answer change if the function to be minimised had don’t care conditions D = (4, 5, 11).