Lecture 6: Boolean Algebra and minimization techniques Quine-McCluskey Minimization Method • Advantages over K-maps – Can be computerized – Can handle functions of more than six variables • Overview of the method – Given the minterms of a function – Find all prime implicants (steps 1 and 2) • Partition minterms into groups according to the number of 1’s • Exhaustively search for prime implicants – Find a minimum prime implicant cover (steps 3 and 4) • Construct a prime implicant chart • Select the minimum number of prime implicants Quine-McCluskey Method: Outline 1. Express each minterm in n variables by a bit string of length n with the i-th position filled by 1 if x_i occurs in the expression and 0 if ~x_i occurs. 2. Group the bit strings according to the number of 1's in them. 3. Use the Resolution Rule to combine as many n-variable terms into terms containing n-1 variables as possible. 4. Continue applying the Resolution Rule to combine Boolean products into fewer variables as long as possible. 5. Find the smallest set of the resulting combined Boolean products, together with any of the original terms that were never combined with anything, so that the sum of these products represents the Boolean function. Quine-McCluskey Method: Representation Represent each product in the function as a Boolean sequence, according to whether the variables or their negations occur in the product. For the example on the previous slide, the seven products would be represented as: w w w ~w ~w ~w ~w x y ~z ~x y z ~x y ~z x y z x ~y z ~x y z ~x ~y z 1110 1011 1010 0111 0101 0011 0001 Quine-McCluskey Method: Combining Order the terms by the number of 1's in them; then form all the 3-term sequences you can by looking for 4-term sequences that differ in only one position; note that we only need to compare each sequence to ones that have exactly one more 1 in them. Label each term with its numeric value. term F -----------1 0001 1 -----------3 0011 1 5 10 0101 1010 1 1 -----------7 0111 1 11 1011 1 14 1110 1 ------------ --> 1,3 --> 1,5 00-1 0-01 --> --> --> --> --> 0-11 -011 01-1 1011-10 3,7 3,11 5,7 10,11 10,14 none none none Quine-McCluskey Method: Combining Repeat the process with the 3-term sequences, forming 2-term sequences: Second phase: -----------1,3 00-1 1,5 0-01 3,7 0-11 3,11 -011 5,7 01-1 10,11 10110,14 1-10 --> 1,3,5,7 --> 1,3,5,7 none none none none none 0--1 0--1 (duplicate) Q-M Method: Selecting Prime Implicants ---------------------------------------Prime Implicants Coverage Map 1 3 5 7 10 11 14 ---------------------------------------1,3,5,7 0--1 x x x x 1,3 00-1 x x 1,5 0-01 x 3,7 0-11 x 3,11 -011 x 5,7 01-1 10,11 101- x 10,14 1-10 x x x x or x x x ---------------------------------------- Essential for 14 Quine-McCluskey Method: Formation Finally, translate the selected Boolean sequences back into the appropriate product terms: 0--1 1-10 101- wz wy z wxy Use the Q-M method to find the MSOP of the function f(A,B,C,D) = m(2,4,6,8,9,10,12,13,15) A AB CD 00 0 01 4 00 11 12 1 1 5 13 1 9 1 3 7 15 11 1 D 11 1 2 10 8 1 01 C 10 6 1 14 1 10 1 B Step 1 -- List Prime Implicants in Groups Step 2 -- Generate Prime Implicants The Resulting Minimal Realization of f f(A,B,C,D) = PI1 + PI3 + PI4 + PI7 = 1-0- + -010 + 01-0 + 11-1 = AC + B CD + A BD + ABD Definition of terms for two-level simplification • Implicant • Single product term of the ONset (terms that create a logic 1) • Prime implicant • Implicant that can't be combined with another to form an implicant with fewer literals. Systematic Simplification •A Prime Implicant is a product term obtained by combining the maximum possible number of adjacent squares in the map. •A prime implicant is called an Essential Prime Implicant if it is the only prime implicant that covers (includes) one or more minterms. •Prime Implicants and Essential Prime Implicants can be determined by inspection of the K-Map. •A set of prime implicants that "covers all minterms" means that, for each minterm of the function, there is at least one prime implicant in the selected set of prime implicants that includes the minterm. Karnaugh maps: Don’t cares • • • In some cases, outputs are undefined We “don’t care” if the logic produces a 0 or a 1 This knowledge can be used to simplify functions. AB 00 CD C A 01 11 10 00 0 0 X 0 01 1 1 X 1 11 1 1 0 0 10 0 X 0 0 B D - Treat X’s like either 1’s or 0’s - Very useful - OK to leave some X’s uncovered Karnaugh maps: Don’t cares • f(A,B,C,D) = m(1,3,5,7,9) + d(6,12,13) without don't cares f= A’D + C’D A AB 00 01 11 10 CD C 00 0 0 X 0 01 1 1 X 1 11 1 1 0 0 10 0 X 0 0 B D A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 B C 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 1 D 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 f 0 1 0 1 0 1 X 1 0 1 0 0 X X 0 0 Don’t Care Conditions • In some situations, we don’t care about the value of a function for certain combinations of the variables. •these combinations may be impossible in certain contexts •or the value of the function may not matter in when the combinations occur Don’t Care Conditions • In such situations we say the function is incompletely specified and there are multiple (completely specified) logic functions that can be used in the design. • so we can select a function that gives the simplest circuit • When constructing the terms in the simplification procedure, we can choose to either cover or not cover the don’t care conditions. Quine-McCluskey (tabular) method 1. Arrange all minterms in group such that all terms in the same group have the same # of 1’s in their binary representation. 2. Compare every term of the lowest-index group with each term in the successive group. Whenever possible, combine two terms being compared by means of gxi+gxi´=g(xi+xi´)=g. Two terms from adjacent groups are combinable if their binary representation differ by just a single digit in the same position. 3. The process continues until no further combinations are possible. The remaining unchecked terms constitute the set of PI. Ex) f(x1,x2,x3,x4) = (0,1,2,5,6,7,8,9,10,13,15) # 0 1 2 8 5 6 9 10 7 13 15 x1,x2,x3,x x1,x2,x3,x4 4 0 0 0 0 10 10 0 1 1 1 0 0 11 1 1 1 0 0 0 01 0 0 1 00 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 0 0 - 0 0 0 0 0 0 0 (0,1) (0,2) (0,8) 0 0 1 1 0 0 0 0 0 0 1 1 0 - 1 1 0 0 0 (1,5) (1,9) (2,6) (2,10) (8,9) (8,10) 0 0 1 1 1 1 - 0 1 0 1 1 1 1 1 1 1 - 1 1 (5,7) (5,13) (6,7) (9,13) (7,15) (13,15) x1,x2,x3,x x1,x2,x3,x 4 4 - 0 0 1 0 0 - 0 1 1 (0,1,8,9) (0,2,8,10) (1,5,9,13) (5,7,13,15) Using prime implicant chart, we can find essential PI 0 1 15 (2,6) (6,7) (0,1,8,9) (0,2,8,10) (1,5,9,13) (5,7,13,15) 2 5 6 7 9 10 13 8 The reduced PI chart 1 (2,6) (6,7) (0,1,8,9) (1,5,9,13) 6 The essential PI’s are (0,2,8,10) and (5,7,13,15) . So, f(x1,x2,x3,x4) = (0,2,7,8) + (5,7,13,15) + PI’s 9 Here are 4 different choices (2,6) + (0,1,8,9), (2,6) + (1,5,9,13) (6,7) + (0,1,8,9), or (6,7) + (1,5,9,13) A PI pj dominates PI pk iff every minterm covered by pk is also covered by pj. m1 m2 m3 m4 pj pk Branching method m p1 p2 p3 p4 p5 1 (can remove) m2 m3 m4 m5 If we choose p1 first, then p3, p5 are next. p1 p3 p5 p4 p2 p3 Quine – McCluskey method (no limitation of the # of variables)