8/7/2018

Lect 07 Outline • Boolean Functions Boolean Functions: Canonical Form and Minimization –Truth Table Conversion and Vice Versa • Canonical form of Function CS221: Digital Design –SOP and POS Dr. A. Sahu • and Hamming Distances Dept of Comp. Sc. & Engg. • K‐Maps Indian Institute of Technology Guwahati

1 2

Converting among Representations Converting among Representations Q: Convert to equation Q: Convert to equation abcFTerm 0000 abFTerm 0010 001a’b’ 0100 011a’b 0110 100 1000 110 1011 ab’c 1101 abc’ F = ab’c + abc’ + abc F = a’b’ + a’b 1111abc

Converting among Representations Standard Representation Q: Convert to truth table: F = a’b’ + a’b • How to determine two functions are Inputs Output the same? • Use algebraic methods a b a’b’ a’b F • But if we failed, does that prove not 00101 equal? No. 01011 • Solution: Convert to truth tables 10000 –Only ONE truth table representation of given same functions: Standard 11000 representation

1 8/7/2018

Standard Representation: Truth Table Only ONE truth table representation of given Represent TT in efficiently/elegantly? same functions: Standard representation • Truth tables too big for numerous inputs // F=ab+a’ F=a’b’+a’b+ab • Use standard form of equation instead abF abF – Known as canonical form – English meaning of “Canonical” : simplest 0 0 1 0 0 1 a or standard in mathematics 011 011 • Regular algebra: group terms of polynomial by 100 100 power 111 111 – ax2 + bx + c – (3x2 + 4x + 2x2 + 3 + 1 Î 5x2 + 4x + 4)

Boolean Algebra Canonical Form Canonical Form ‐‐ Sum of Minterms • Truth tables too big for numerous inputs Determine if F(a,b)=ab+a’ is same function as • Use standard form of equation instead: F(a,b) = a’b’+a’b+ab by to canonical form. Canonical • : create sum of minterms F = ab+a’ (already sum of products)

– Minterm: product term with every function a literal appearing exactly once, in true or F = ab + a’(b+b’) (expanding term) complemented form – Just multiply‐out equation until sum of product terms F = ab + a’b + a’b’ (it is canonical form) – Then expand each term until all terms are Minterm: product term with every function literal minterms appearing exactly once, in true or complemented form

Canonical form and Standard Form Canonical Forms • Canonical forms • It is useful to specify Boolean functions – Sum of minterms (SOM) – Product of maxterms (POM) in a form that: • Standard forms (may use less gates) – Allows comparison for equality. – Sum of products ()(SOP) – Has a correspondence to the truth tables – Product of sums (POS) • Canonical Forms in common usage: • SOP form may not be in Canonical Form – Sum of Minterms (SOM) F = ab+a’ (already sum of products:SOP) – Product of Maxterms (POM) F = ab + a’(b+b’) (expanding term) F = ab + a’b + a’b’ (it is canonical form:SOM)

2 8/7/2018

Minterms in SOP Minterms

• Product term is a term where literals are • Function with n variables has 2n minterms ANDed • A minterm equals 1 at exactly one input – Example: x’y’, xz, xyz, … combination and is equal to 0 otherwise • minterm : A product term in which all – Example: x’y’z’ = 1 only when x=0, y=0, z=0 • variables appear exactly once, in normal Minterm is denoted as mi where i corresponds or complemented form the input combination at which this minterm is equal to 1 – Example: F(x,y,z) has 8 minterms x’y’z’, x’y’z, x’yz’, …

Example: 2 Variable Minterms Maxterms

• Maxterms are OR terms with every variable in • Two variables (X and Y) produce 2x2=4 true or complemented form. combinations X+Y (both normal) XY (both normal) X+Y’ (x normal, y complemented) XY’ (X normal, Y complemented) X’+Y (x complemented, y normal) X’Y (X complemented, Y normal) X’+Y’ (both complemented) X’Y’ (both complemented)

Maxterms and Minterms Minterms : three variables XY Z Term Symbol m0 m1 m2 m3 m4 m5 m6 m7 • Two variable minterms and maxterms. 000x’y’z’m0 10000000

Index Minterm Maxterm 001x’y’zm1 01000000 0x’ y’ x + y 010x’yz’m2 00100000 011x’yzm 00010000 1 x ‘y x + y’ 3 100xy’z’ m4 00001000 2x y’ x’ + y 101xy’zm5 00000100

3x yx’ + y’ 110xyz’m6 00000010

• The index above is important for describing which 111xyzm7 00000001 variables in the terms are true and which are th complemented. mi indicated the i minterm i indicates the binary combination Variable complemented if 0 m is equal to 1 for ONLY THAT combination Variable uncomplemented if 1 i

3 8/7/2018

Maxterms in POS Maxterms

• Sum term : A term where literals are ORed. • Function with n variables has 2n maxterms • Example: x’+y’, x+z, x+y+z, … • A maxterm equals 0 at exactly one input • Maxterm : a sum term in which all variables combination and is equal to 1 otherwize appear exactly once, in normal or • Example: (x+y+z) = 0 only when x=0, y=0, complemented form z=0

• Example: F(x,y,z) has 8 maxterms • A maxterm is denoted as Mi where i (x+y+z), (x+y+z’), (x+y’+z), … corresponds the input combination at which this maxterm is equal to 0

Maxterms : three variable

XY ZTerm Sym Expressing Functions with Minterms M0 M1 M2 M3 M4 M5 M6 M7 • can be expressed algebraically from 0 0 0 X+Y+Z M0 0 1111111 a give truth table 0 0 1 X+Y+Z’ M1 1 0 111111 • Forming sum of ALL the minterms that produce 1 01 0X+Y’+Z M 110 11111 2 in the function XY ZmF 01 1X+Y’+Z’M3 1110 1111 EElxample : CCidhfionsider the function 0 0 0 m0 1 10 0X’+Y+Z M4 11110 111 defined by the truth table 001m1 0

10 1X’+Y+Z’M5 111110 11 010m2 1

11 0X’+Y’+ZM6 1111110 1 F(X,Y,Z)= X’Y’Z’ + X’YZ’ + XY’Z + 011m3 0 XYZ 100m 0 11 1X’+Y’+Z’M7 11111110 4 = m0 + m2 + m5 + m7 101m 1 M indicated the ith maxterm i indicates 5 i = ∑m(0, 2, 5, 7) the binary combination Mi is equal to 0 110m6 0 Variable complemented if 1 for ONLY THAT combination 111m 1 Variable not complemented if 0 7

Expressing Functions with Maxterms Sum of Minterms vs Product of • Boolean function : Expressed algebraically from a Maxterms give truth table • A function can be expressed algebraically as: • By forming logical product (AND) of ALL the maxterms that produce 0 in the function • The sum of minterms Example: XY ZMFF’ • The product of maxterms Consider the function defined by the 000M0 1 0 • Given the truth table, writing F as 0 0 1 M1 0 1 truth table 010M 1 0 2 • ∑mi –for all minterms that produce 1 in the table, F(X,Y,Z) = Π M(1,3,4,6) 011M 0 1 3 or Applying DeMorgan 100M4 01 101M5 10 • ΠMi –for all maxterms that produce 0 in the table F’ = m1 + m3 + m4 + m6= ∑ m(1,3,4,6) 110M6 01 • Minterms and Maxterms are complement of F = F’’ = [m1 + m3 + m4 + m6]’ 111M7 10 = m ’.m ’.m ’.m ’ each other. 1 3 4 6 Note the indices in this list are those that = M1.M3.M4.M6 are missing from the previous list in = Π M(1,3,4,6) Σm(0,2,5,7)

4 8/7/2018

Example: minterm & maxterm Example (Cont.) Solution: Method2_a Solution: Method2_b E = Y’ + X’Z’ E = Y’ + X’Z’ • Write E = Y’ + X’Z’ in the = Y’(X+X’)(Z+Z’) + ’Z’(Y+Y’) E’ = Y(X+Z) XY ZmME = (XY’+X’Y’)(Z+Z’) + X’YZ’+ = YX + YZ form of ∑mi and ΠMi? 000m M 1 0 0 X’Z’Y’ = YX(Z+Z’) + YZ(X+X’) • Method1 0 0 1 m M 1 1 1 = Y’Z+ X’Y’Z+XY’Z ’+ X’Y’Z’+ = XYZ+XYZ’+X’YZ 010m M 1 First construct the Truth Table 2 2 X’YZ’+X’Z’Y’ E = 011m M 0 as shown 3 3 = m5 + m1 + m4 + m0 + m2 + m0 (X’+Y’+Z’)(X’+Y’+Z)(X+Y’+Z’) 100m4 M4 1 = m + m + m + m + m = M . M . M E = ∑m(0,1,2,4,5), and 0 1 2 4 5 7 6 3 101m5 M5 1 = ∑ m(0,1,2,4,5) = ΠM(3,6,7) E = M(3,6,7) 110m6 M6 0 Π To find the form ΠMi, consider the To find the form Smi, consider 111m7 M7 0 remaining indices the remaining indices E = ΠM(3,6,7) E = ∑ m(0,1,2,4,5)

Canonical Forms Standard Forms

• The sum of minterms and the product of • Sum of Products (SOP) and Product of Sums maxterms forms are known as the canonical (POS) are also standard forms forms of a function. • AB+CD = (A+C)(B+C)(A+D)(B+D) • The sum of min‐terms is a specia l case of ttehe SOP form, where all product terms are min‐ terms • The product of max‐terms is a special case of the POS form, where all sum terms are max‐ terms

SOP and POS Conversion Implementation of SOP F(X,Y,Z) = XZ+Y’Z+X’YZ SOP Æ POS POS Æ SOP • Any SOP expression can be implemented using 2- levels of gates F = AB + CD F = (A’+B)(A’+C)(C+D) • The 1 st level consists of = (AB+C)(AB+D) = (A’+BC)(C+D) AND gates, and the 2nd = (A+C)(B+C)(AB+D) = A’C+A’D+BCC+BCD level consists of a single = (A+C)(B+C)(A+D)(B+D) = A’C+A’D+BC+BCD OR gate = A’C+A’D+BC • Also called 2-level Hint 1: Use id15: X+YZ=(X+Y)(X+Z) Circuit Hint 1: Use id15 (X+Y)(X+Z)=X+YZ Hint 2: Factor Hint 2: Multiply

5 8/7/2018

Implementation of SOP Implementation of POS • Consider F = AB + C(D+E) F(X,Y,Z) = (X+Z)(Y’+Z)(X’+Y+Z) • This expression is NOT in the sum-of-products form • Any POS expression can • Use the identities/algebraic manipulation to convert to a be implemented using 2- standard form (sum of products), as in F = AB + CD + CE levels of gates • Logic Diagrams: • The 1 st level consists of nd A OR gates, and the 2 A B level consists of a single B C F F AND gate C D C • Also called 2-level D E Circuit E 3‐level circuit 2‐level circuit

Canonical Forms Simplification: Theorem method E = ∑ m(0,1,2,4,5) • It is useful to specify Boolean functions = m + m + m + m + m in a form that: 0 1 2 4 5 = m5 + m1 + m4 + m0 + m2 + m0 – Allows comparison for equality. = XY’Z+X’Y’Z+XY’Z’+X’Y’Z’+X’YZ’ +X’Z’Y’ – HdhhblHas a correspondence to the truth tables = (XY’+X’Y’)(Z+Z’) + X’YZ’+ X’Z’Y’ • Canonical Forms in common usage: = Y’(X+X’)(Z+Z’) + X’Z’(Y+Y’) = Y’ + X’Z’ – Sum of Minterms (SOM)/Sum of Product (SOP) Simplified one: Require less Both are in SOP Gates and faster format : 2 level – Product of Maxterms/Sum (POM)/POS 2 Level

Simplification of Boolean Functions: Simplification of Boolean Functions Two Methods ƒ An implementation of a Boolean Function • Algebraic method by using Identities & requires the use of logic gates. Theorem ƒ A smaller number of gates, with each gate • Graphical method by using Karnaugh Map (other then Inverter) having less number of method – The K‐map method is easy and straightforward. inputs, may reduce the cost of the – A K‐map for a function of n variables consists of 2n implementation. cells, and, ƒ There are 2 methods for simplification of – in every row and column, two adjacent cells Boolean functions. should differ in the value of only one of the logic variables.

35 Maurice Karnaugh, Bell Lab, 1954. 36

6 8/7/2018

Karnaugh Map Method Karnaugh Map Advantages

• A graphical method of simplifying logic • Minimization can be done more equations or truth tables. systematically • Also called a K map • Thillheoretically can be used for any number of • Much simpler to find minimum solutions input variables, but practically limited to 5 or • Easier to see what is happening (graphical) 6 variables. • Almost always used instead of boolean minimization.

Gray Codes Truth Table Adjacencies AB F • Gray code is a binary value encoding in 00 1 These are adjacent in a gray code sense which adjacent values only differ by one 01 1 - they differ by 1 bit bit F = A’ 10 0 We can apply XY + XY’ = X 11 0 A’B’ + A’B = A’(B’+B) = A’(1) = A’ 2‐bit Gray Code A B F 00 0 Same idea: A’B + AB = B 00 F = B 01 1 10 0 01 11 1 Key idea: Problem: 11 Physical adjacency in truth 10 Gray code adjacency allows use of table does not indicate gray simplification theorems code adjacency

Karnaugh Map Method Filling of Karnaugh Map • The truth table values are placed in the K Why not: A’B’, A’B, AB’, AB map. 00, 01, 10, 11 • Adjacent K map square differ in only one Only two adjacent can be grouped variable both horizontally and vertically. Group Reduce a variable: AB’+AB=A(B’+B)=A • The pattern from top to bottom and left to right must be in the form A’B’, A’B, AB, AB’ • A SOP expression can be obtained by ORing 00, 01, 11, 01 all squares that contain a 1. All 4 Adjacent can be grouped A’B’, A’B, AB, AB’ 00, 01, 11, 01

7 8/7/2018

Karnaugh Map: 2, 3, 4 Variable 2‐Variable Karnaugh Map ABF Gray coding 00 01 00 A 000 001 011 010 01 B 01 10 11 100 101 111 110 10 0 1 1 A=1, B=0 A=0, B=0 1 0000 0001 0011 0010

A=1, B=1 0100 0101 0111 0110 A=0, B=1 1100 1101 1111 1110 A different way to draw a truth table: by folding it 1000 1001 1011 1010

Karnaugh Map: 2, 3, 4 Variable Karnaugh Map Gray coding, Decimal 01 0132 • In a K‐map, physical adjacency does imply gray code adjacency 23 4576 A A 0132 B 01 B 01 0 0 4576 10 00 1 10 1 11 12 13 15 14

8 9 11 10 F =A’B’ + A’B = A’ F = A’B + AB = B

2‐Variable Karnaugh Map 2‐Variable Karnaugh Map

A B index F A A B index F A 00 0 1 B 01 B 01 01 1 1 00 0 1 0 0 1 0 10 2 0 10 01 1 1 1 1 11 3 0 10 10 2 0 10 11 3 0

F = A’B’ + A’B = A’

8 8/7/2018

2‐Variable K Map: Grouping Another Example A A A B index F A B index F 01 B 01 00 0 0 B 0 1 1 1 0 00 0 1 0 1 0 0 1 10 2 1 01 1 1 1 10 1 11 10 2 0 11 3 1 A = 0 11 3 0 F = A’B + AB’ + AB F = A’ = (A’B + AB) + (AB’ + AB) = A + B

Another Example Yet Another Example

A A B index F A B index F A 01 00 0 1 B B 01 00 0 0 0 1 1 1 0 01 0 11 01 1 1 10 2 1 1 11 1 11 11 3 1 10 2 1 A = 1 11 3 1B = 1 F = 1 F = A + B Groups of more than two 1’s can be combined

9