Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 171 Digital Circuits Chapter 4 Boolean Algebra Herbert G. Mayer, PSU Status 2/1/2016 Copied with Permission from prof. Mark PSU ECE.

Similar presentations


Presentation on theme: "ECE 171 Digital Circuits Chapter 4 Boolean Algebra Herbert G. Mayer, PSU Status 2/1/2016 Copied with Permission from prof. Mark PSU ECE."— Presentation transcript:

1 ECE 171 Digital Circuits Chapter 4 Boolean Algebra Herbert G. Mayer, PSU Status 2/1/2016 Copied with Permission from prof. Mark Faust @ PSU ECE

2 Syllabus Boolean Algebra Huntington’s Postulates Operators Truth Tables Boolean Functions and Theorems Graphic Symbols References

3 Boolean Algebra A fire sprinkler system F should spray water if high heat is sensed and the system is in the state: enabled Let Boolean variable h represent “high heat is sensed,” let e represent “enabled,” and F represent “spraying water.” Then an equation is: F = h AND e A car alarm F should sound if the alarm is enabled, and either the car is shaken or the door is opened Let a represent “alarm is enabled,” s represent “car is shaken,” d represent “door is opened,” and F represent “alarm sounds.” Then an equation is: F = a AND ( s OR d ) 3

4 Boolean Algebra (History) 384-322 BC: Aristotle, foundations of logic 1854: George Boole “An Investigation of the Laws of Thought”, mathematical methods for two-valued logic 1904: H.E. Huntington, Sets of Independent Postulates for the Algebra of Logic 1938: Claude Shannon, A Symbolic Analysis of Relay Switching Circuits 4

5 Boolean Algebra Postulates (Axioms) Accepted as true; Foundation for further proofs Values B = { 0, 1 } Variables A, B, C X, Y, Z Ready, Green, OverWeightLimit Operators (often represented differently!) +  Additional Operators () = 5

6 Huntington’s Postulates 6

7 Literals Variable or Complement of Variable X, DoorOpen, Green, Green Expressions Constants ( 0, 1 ), Literals, Operators ( X + Y  Z ), A + B Precedence Complement AND  OR + () Can be used to override default order, or enhance “readability” Boolean Algebra 7

8 Operators Complement, AKA NOT A’ /A !A  A ~A A A OR A + B A | B A  B v for Latin: vel = or AND A * B A & B A  B A  B A B 8

9 Truth Tables (NOT) 9

10 Graphic Symbols (NOT) 10

11 Additional Operators NOR A + B A | B A  B NAND A * B A & B A  B A  B A B 11

12 Truth Tables NOR operatorNAND operator X Y X + Y 0 0 1 0 1 0 1 0 0 1 1 0 X Y X  Y 0 0 1 0 1 1 1 0 1 1 1 0 12

13 Graphic Symbols 13

14 Additional Operators XOR (Exclusive OR, Modulo 2, Different) A  B XNOR (Exclusive NOR, Equal ) A  B AKA “Equivalence” in Europe 14

15 Truth Tables XOR operatorXNOR operator X Y X  Y 0 0 0 0 1 1 1 0 1 1 1 0 X Y X  Y 0 0 1 0 1 0 1 0 0 1 1 1 15

16 Graphic Symbols 16

17 Boolean Functions Product Terms –Comprised of literals (including complements), AND –X  Y  Z A  B  C X Y Z A B C Sum Terms –Comprised of literals (including complements), OR –X + Y + Z A + B + C Sum of Products (SOP) –X  Y + X  Z --parentheses not needed, AND binds higher Product of Sums (POS) –(X + Y)  (X + Z)--parentheses needed! F(X,Y,Z) --Boolean function of 3 variables X, Y, Z 17

18 Truth Tables B 5 B 4 B 3 B 2 B 1 B 0 F 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1 0. 1 1 1 1 1 1 1 0 1 2 3. 63 2 6 = 64 Question: How many rows are there in a truth table for n variables? As many rows as unique Combinations of inputs Enumerate by counting in binary 2n2n 18

19 Boolean Algebra -- Manipulation Simplify –Operand Count Reduction –Reduce Number of Terms Transform: Put in Preferred Form –AND/OR –NAND/NOR 19

20 Reducing Number of Terms F = (X + Y)  (X + Z) = X + Y  Z Huntington’s Postulate P4a 20

21 Huntington’s Postulate via Karnaugh 21

22 Boolean Theorems 22

23 Boolean Theorems 23

24 Boolean Theorems 24

25 Boolean Functions Boolean function f() expresses a truth value, depending on Boolean operands and operators Often denoted as true or false True or false can be represented as 0 and 1, sometimes on or off, or high_voltage or low_voltage, or other variations Key idea: there are 2 possible values per Boolean value, no more! We’ll pick 0 and 1 Operand values can be combined via operators Operands are variables or constants 25

26 Boolean Functions Operators include or, and, not, xor, equivalence, their negations, many more Operators handle 1 or 2 values, often variables, to create a new Boolean result E.g. function f0( a, b ) here depends on 2 Boolean variables a and b, yielding true if a and b differ: f0( a, b ) = a xor b Name of operation: exclusive or, AKA xor 26

27 Boolean Function We can write Boolean functions as: –Expressions –Tables –Maps, specifically 2D Karnaugh Maps –Maps, drawn as a 3D thorus –Minterms, Minterm sum Σ –Maxterms, Maxterm product Π –Etc. 27

28 Boolean Function Via Expression Given Boolean variables a, b, c, d, and the specific Boolean function f1( a, b, c, d ) below f1() may be encoded as an expression, as shown, with ‘ standing for negating its preceding operand; e.g. x’ means “not x”: f1 = b’ and d’ -- a, c are don’t cares for f1() 28

29 Boolean Function Via Truth Table Function f1() can be expressed as Truth Table: 29

30 Boolean Function Via Truth Table f1() can be expressed as a Karnaugh Map, AKA K-Map: 30

31 Boolean Function Via Truth Table Function f1() can be expressed as a thorus, found in [1] at Wiki: 31

32 Boolean Function Via Truth Table Function f1() can be expressed as Minterms: f1( a, b, c, d ) = Σ m i with i = { 0, 2, 8, 10 } 32

33 Boolean Function Via Truth Table Function f1() can be expressed as Maxterms: f1’( a, b, c, d ) = Π m i with i = { 1, 3, 4, 5, 6, 7, 9, 11, 12, 13, 14, 15 } 33

34 K-Maps Karnaugh Maps, AKA K-Maps offer an intuitive way to minimize a function... By grouping together as many terms (1s or 0s) together in rectangular groups Even wrap-around sides of a rectangle to capture Boolean variables Hard to draw K-Maps, when there are many more than 4 variables; see sample with 5 Can use multiple K-Maps for 6 or more variables 34

35 K-Maps: f2() Key idea: group largest possible rectangle of all ones (‘1’) together See example f2() 35

36 K-Maps: f2() Solution for f2() 36

37 K-Maps: f3() Largest groups of rectangles of all ones (‘1’) together, including across the border See example f3() 37

38 K-Maps: f3() Solution for f3() 38

39 K-Maps: f4() Largest groups of rectangles of all ones (‘1’) together, including “double-counting” See example f4() 39

40 K-Maps: f4() Solution for f4() 40

41 K-Maps: f5() If f2() had a few Don’t Cares, indicated by x, how could we express the function f5()? Set some x->1, some other x->0 41

42 K-Maps: f5() A possible solution for f5() 42

43 Simpler K-Maps: f6_1() Only 3 Boolean variables for f6_1() f6_1 = a b + ac + b’ c 43

44 Simpler K-Maps: f6_2() Same 3 Boolean variables for f6_2() f6_2 = a b + b’ c Consensus Theorem in action! 44

45 More Complex K-Map: f7() f7() is function of 5 variables: a b c d e Here K-map for f7() = abc + bcd + cde 45

46 Truth Table for f7() 46

47 Student Exercise K-Map: f7_1() F7_1() also function of 5 variables: a b c d e Compute K-map for f7_1() = ? 47

48 Student Exercise K-Map: f7_2() F7_2() function of 5 variables: a b c d e Compute harder K-map for f7_2() = ? 48

49 Literal Count Reduction F = X  Y + X + Y  Z = Y + X + Y  Z = Y + X Simplification Theorem Absorption Theorem Simplification Theorem Absorption Theorem X  Y + X = Y + X Y + Y  Z = Y 49

50 Transformation F = X  Y  Z = X + Y + Z deMorgan’s Theorem From implementation with NAND gates, shifted to OR gates and input Inverters 50

51 Principle of Perfect Induction If:f1 = x y + x’ z + y z;f2 = x y + x’ z Show via Karnaugh Map:f1 = f2 51

52 Principle of Perfect Induction Truth tables for: f1 = x y + x’ z + y z; f2 = x y + x’ z Proves that y z is being absorbed x y z f1: x y x’ z y z f2: x y x’ z f1 = f2 0 0 0 0 + 0 + 0 = 0 0 + 0 = 0 0 0 1 0 + 1 + 0 = 1 0 + 1 = 1 0 1 0 0 + 0 + 0 = 0 0 + 0 = 0 0 1 1 0 + 1 + 1 = 1 0 + 1 = 1 1 0 0 0 + 0 + 0 = 0 0 + 0 = 0 1 0 1 0 + 0 + 0 = 0 0 + 0 = 0 1 1 0 1 + 0 + 0 = 1 1 + 0 = 1 1 1 1 1 + 0 + 1 = 1 1 + 0 = 1 52

53 SoP of 1s vs. SoP of 0s 53 Boolean expression, focusing on 1s in f8() generates sum of products (SoP) Or equivalently, focusing on 0s, in which case g8() generates a sum of products of 0s And g8()’ = f8(); which is preferable? Engineering intuition may suggest: count 0s and 1, then start with the option of smaller number of cases! We’ll analyze a case:

54 SoP of 1s vs. SoP of 0s 54 Function f8(), SoP of 1s

55 SoP of 1s vs. SoP of 0s 55 Using SoP form of 1s yields: f8() = a + b’ + c + d’ Using SoP of 0s yields: g8() = a’bc’d Inverting g8() generates same result as f8(): g8()’ = a’’ + b’ + c’’ + d’ g8()’ = a + b’ + c + d’ g8()’ = f8(), q.e.d. We observe a very similar number of steps, or a similar cost function to compute Counting 0s vs. 1s to start did not help here

56 References 1.For Karnaugh maps: https://en.wikipedia.org/wiki/Karnaugh_ map 56


Download ppt "ECE 171 Digital Circuits Chapter 4 Boolean Algebra Herbert G. Mayer, PSU Status 2/1/2016 Copied with Permission from prof. Mark PSU ECE."

Similar presentations


Ads by Google