480 likes | 955 Views
Boolean Algebra – Part 2. Inversion. Inversion or Complement of a Function means all 0 outputs become 1 and all 1 outputs become 0. Inversion. DeMorgan’s Laws ( X + Y ) ’ = X ’ Y ’ ( X Y ) ’ = X ’ + Y ’. Proof:. DeMorgan’s Laws. For complex expressions,
E N D
Boolean Algebra – Part 2 ECEn 224
Inversion Inversion or Complement of a Function means all 0 outputs become 1 and all 1 outputs become 0 ECEn 224
Inversion DeMorgan’s Laws ( X + Y )’ = X’ Y’ ( X Y )’ = X’ + Y’ Proof: ECEn 224
DeMorgan’s Laws For complex expressions, apply DeMorgan’s Laws successivelyDeMorgan’s Laws: (X+Y)’ = X’Y’ (XY)’ = X’ + Y’ Example: F = A’B + AB’ F’ = (A’B + AB’)’ = (A’B)’•(AB’)’ = (A+B’)•(A’+B) = AA’+AB+A’B’+BB’ = AB+A’B’ (X+Y)’ = X’Y’ (XY)’ = X’ + Y’ ECEn 224
DeMorgan’s Laws Another Example: F’ = [ ( a’b + 1)(cd + e’ + 0) ]’ = (a’b + 1)’ + (cd + e’ + 0)’ = [(a’b)’ • 1’] + (cd)’ • (e’)’ • 0’ = (a + b’) • 0 + (c’ + d’) • e • 1 Note: Expression is not simplified ECEn 224
DeMorgan’s Laws - One Step Rule [ f( X1, X2, … XN, 0, 1, +, •) ]’ = f( X1 ’, X2 ’, … XN ’, 1, 0, •, +) 1. Replace + with • and • with + 2. Replace 0 with 1 and 1 with 0 3. Replace all variables with the inverse Be careful of hierarchy… This is biggest source of errorsBefore beginning, surround all AND terms with parentheses Like taking the dual ECEn 224
DeMorgan’s Laws Another Example: F = ( a’b + 1)(cd + e’ + 0) F = ( (a’ • b) + 1) • ( (c • d) + e’ + 0) F’ = ( (a + b’) • 0) + ( (c’ + d’) • e • 1) Variables and constants inverted! Note: Expression is not simplified ECEn 224
Canonical Forms ECEn 224
Canonical Forms • Is this equality true? • AD + A’D’ + CD ?=? AD + A’D’ + A’C • Hard to tell • Both look minimized… • But they look different… • For many expressions there are multiple minimal forms • Miminimizing is not a good way to determine equality ECEn 224
Canonical Forms • A canonical form is something written in the standard way • Two expressions which are equal will have identical canonical forms • Is there a standard (canonical) way of representing boolean expressions? • Yes… ECEn 224
Truth Tables Canonical? f = AD + A’D’ + CD f = AD + A’D’ + A’C Same truth table, two different minimal expressions. So, are truth tables canonical forms? Yes, if we agree on a fixed column order. ECEn 224
Minterm Expansion f = AB + AC + B’C • Each row in the truth table can be numbered • Each row corresponds to an AND term in the SOP expression • Call each row’s AND term a minterm(e.g., m0 = A’B’C’, m5 = AB’C) • Combine minterms into SOP expressions • Called minterm expansion or standard sum of products (standard SOP) f = m1 + m5 + m6 + m7 f = m(1,5,6,7) f = A’B’C + AB’C + ABC’ + ABC ECEn 224
Minterms have names • The order of the variables is significant! • Given a minterm expression we can easily tell which minterm number it corresponds to A’B’C’ 000 m0 AB’C’ 100 m4 AB’C 101 m5 • Given the minterm number we can derive the minterm expression. m1 001 A’B’C m3 011 A’BC m6 110 ABC’ ECEn 224
Minterms • Are these minterms of 4 variables? abcd ab’cd’ ab’c a’bc’bd Yes Yes no, only 3 variables no, b more than once ECEn 224
Minterm Expansion • A minterm expansion is unique f (A,B,C,D) =m(0,2,3,7) • Useful for: • Proving equality • Shorthand for representing boolean expressions ECEn 224
Maxterms are POS Equivalents to Minterms Note that maxterms are the inverse of minterms ECEn 224
Maxterm Expansion Any function can be written as a product of maxterms. This is called the maxterm expansion or standard product of sums (standard POS) f = AB + AC + B’C Use the 0’s for the function to write the POS: f(A,B,C) = M0 M2 M3 M4 f(A,B,C) = M(0, 2, 3, 4) f = (A+B+C)(A+B’+C)(A+B’+C’)(A’+B+C) ECEn 224
Maxterm Expansion • Are these maxterms of 4 variables? a + b + c + d a + b’ + c + d’ a + b’ + d’ a’ + b + c’ + a’ + d yes yes no, only 3 variables no, a’ more than once ECEn 224
Identifying Maxterms • A little different from minterms • Given a maxterm expression we can easily tell which maxterm number it corresponds to A+B+C 000 M0 A’+B+C 100 M4 A’+B+C’ 101 M5 • Given the maxterm number we can derive the maxterm expression M1 001 A+B+C’ M3 011 A+B’+C’ M6 110 A’+B’+C ECEn 224
Maxterm Expansion • Maxterm expansions are useful for the same things as minterm expansions • Proving equality • Shorthand for representing boolean expressions • We will use the them when we want POS instead of SOP representations ECEn 224
Minterm / Maxterm Relationships For any function, if a minterm is in the Minterm Expansion, the corresponding maxterm is not in the Maxterm Expansion. f (A,B,C) = m1 + m5 + m6 + m7 f (A,B,C) = M0 M2 M3 M4 Makes it easy to convert between SOP and POS ECEn 224
Minterm Example • Is this equation true? AD + A’D’ + CD = AD + A’D’ + A’C • One method • Draw truth table for each side • Compare which minterms each side contains Minterm expansions shorthand truth tables… ECEn 224
Minterm Example • Is this equation true? AD + A’D’ + CD = AD + A’D’ + A’C • Another method • Expand each term into its minterms (X = XY’ + XY) • Compare which minterms each side contains AD = AC’D + ACD AD = AC’D + ACD A’D’ = A’C’D’ + A’CD’ A’D’ = A’C’D’ + A’CD’ CD = A’CD + ACD A’C = A’CD’ + A’CD ECEn 224
Minterm Example Minimize the following:f(A,B,C) = m1 + m5 + m7 • Write out as SOPF = A’B’C + AB’C + ABC • MinimizeF = B’C + AC minterm expansions shorthand expressions… ECEn 224
Maxterm Example Minimize the following:f (A,B,C) = M1M5M7 • Write out as POSF = (A + B + C’)(A’ + B + C’)(A’ + B’ + C’) • MinimizeF = (B + C’)(A’ + C’) maxterm expansions shorthand expressions… ECEn 224
Minterm/Maxterm Example Convert the following function of A, B, C to POS:F = AB + C • Write the minterm expansionF = m1 + m3 + m5 + m6 + m7(use truth table if it helps) • Convert to maxterm expansionF = M0 • M2 • M4 • Write POS from maxterm expansionF = (A + B + C)(A + B’ + C)(A’ + B + C) • Simplify if desiredF = (B + C)(A + C) ECEn 224
Algebraic Simplification ECEn 224
Algebraic SimplificationObjectives • Why Simplify? • Simpler equations less hardware to implement, faster, cheaper, less power By inspection:f = A’B’C + AB’C + ABC’ + ABC Simplifying: f = A’B’C + AB’C + ABC’ + ABC f = B’C + AB 4 3-input AND gates 1 4-input OR gate XY’+XY=X 2 2-input AND gates 1 2-input OR gate ECEn 224
Hardware Cost • Exact cost depends on technology • nMOS, CMOS, TTL, I2L, GaAs, FPGA, … • In general: • Fewer literals smaller/faster/lower power circuit • Inverters don’t count • Free in some technologies • Insignificant difference in others ECEn 224
Algebraic SimplificationWhich theorems to use? • Suggestions: • Know the identitiesand basic laws • Memorize left side ofessential theorems • Create duals on right as needed ECEn 224
Four Methods of Algebraic Simplification • Combine terms • Eliminate terms • Eliminate literals • Add redundant terms ECEn 224
Methods of Algebraic Simplification • Combine terms ABC’ + A’B’C + A’BC’ BC’ + A’B’C • Eliminate terms • Eliminate literals • Add redundant terms Use X Y + X Y’ = X ECEn 224
Methods of Algebraic Simplification • Combine terms • Eliminate terms A’B + B(A’D + C) A’B + A’BD + BC A’B + BC • Eliminate literals • Add redundant terms Use X + X Y = X ECEn 224
Methods of Algebraic Simplification • Combine terms • Eliminate terms • Eliminate literals A’B + A’B’C’D’ + ABCD’ A’(B + B’C’D’) + ABCD’ A’(B + C’D’) + ABCD’ A’B + A’C’D’ + ABCD’ A’C’D’ + B(A’ + ACD’) A’C’D’ + B(A’ + CD’) A’B + BCD’ + A’C’D’ • Add redundant terms Use X + X’ Y = X + Y ECEn 224
Methods of Algebraic Simplification • Combine terms • Eliminate terms • Eliminate literals • Add redundant terms A’B’C + AB’C + ABC A’B’C + AB’C + AB’C + ABC B’C + AC ECEn 224
Proving an Equation is True • Construct a truth table for both sides • Tedious, not very elegant • Computers love this method • Convert Both Sides to minterm/maxterm expansion • Manipulate one side algebraically to equal the other • Perform the same operation on both sides ECEn 224
Perform the same operation on both sides • Valid Operations • Complement • Construct the dual • Invalid Operations • Add (OR) a term to both sides (not reversible) • Multiply (AND) both sides by a term (not reversible) • Subtract a term from both sides (subtraction?) ECEn 224
Proving an Equation Add a term to both sides Prove Y = Z Y = Z Add 1 to both sides Y + 1 = Z + 1 Use X + 1 = 1 1 = 1 Therefore Y = Z NO! You cannot OR an arbitrary term with both sides. However, you can duplicate an existing term: Y = Z Y + Y = Z ECEn 224
Proving an Equation Multiply (AND) both sides by a term Prove Y = Z Y = Z Multiply both sides by 0 Y • 0 = Y • 0 Use X • 0 = 0 0 = 0 Therefore Y = Z NO! You cannot AND an arbitrary term to both sides. However, you can duplicate an existing term: Y = Z Y • Y = Z ECEn 224
Proving an Equation is False • Show one combination of values for which the equation is false (counter example) • Use Boolean algebra manipulation • Reduce to sum of products form • Minimize • Compare the two sides • Be careful! Some expressions have more than one minimal forms. ECEn 224
Incompletely Specified Functions ECEn 224
Incompletely Specified Functions w x y z A B C Known: N1 does not generate outputs A B C with values of 101 or 111 N1 N2 f The X’s represent “don’t cares” – since those input combinations never occur, we don’t care what the output is. ECEn 224
Incompletely Specified Functions Multiple ways to choose those X’s when minimizing. Cost of minimal solution will depend on values chosen. f1 = A’B’C + AB’C’ + ABC’ f1 = A’B’C + AC’ f2 = A’B’C + AB’C’ + ABC’ + ABC f2 = A’B’C + AC’(B’ + B) + AB(C’ + C) f2 = A’B’C + AC’ + AB Worse than f1 ECEn 224
Incompletely Specified Functions f1 = A’B’C + AC’ f3 = A’B’C + AB’C’ + AB’C + ABC’ f3 = A’C( B + B’) + AB’( C’ + C) f3= A’C + AB’ Betterthanf1 f4 = A’B’C + AB’C’ + AB’C + ABC’ + ABC f4 = (A’ + A)B’C+ AB’(C’ + ’C) + AB(C’ + C) f4 = B’C+ AB’ + AB = B’C + A Best ECEn 224
Incompletely Specified Functions • If the function has n don’t cares • Must solve 2n truth tables to use this method • Ouch! • A better way will be shown in a later chapter… ECEn 224
Don’t Cares - Minterm Representation Use d0 … d7 to represent don’t care minterms F = m1 + m4 + m6 + d5 + d7F = m( 1, 4, 6) + d( 5, 7) ECEn 224
Don’t Cares - Maxterm Representation Use D0 … D7 to represent don’t care maxterms F = M0 M2 M3 D5 D7 F = M(0, 2, 3) D(5, 7) ECEn 224