580 likes | 599 Views
ECE 171 Digital Circuits Chapter 4 Boolean Algebra. Herbert G. Mayer, PSU Status 4/22/2018 Copied with Permission from prof. Mark Faust @ PSU ECE. Syllabus. Boolean Algebra Huntington ’ s Postulates Operators Truth Tables Boolean Functions and Theorems Graphic Symbols References.
E N D
ECE 171Digital Circuits Chapter 4 Boolean Algebra Herbert G. Mayer, PSU Status 4/22/2018 Copied with Permission from prof. Mark Faust @ PSU ECE
Syllabus Boolean Algebra Huntington’s Postulates Operators Truth Tables Boolean Functions and Theorems Graphic Symbols References
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 )
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”
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 () =
Boolean Algebra • Literals Variable or Complement of Variable X, DoorOpen, Green • Expressions Constants ( 0, 1 ), Literals, Operators ( X + Y×Z ), A + B • Precedence Complement AND × OR + () Use to override default order, or enhance “readability”
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
Truth Tables (NOT)
Additional Operators • NOR A + B A | B A Ú B • NAND A * B A & B A × B A Ù B A B
Truth Tables 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 NOR operator NAND operator
Additional Operators • XOR (Exclusive OR, Modulo 2, Different) A Å B • XNOR (Exclusive NOR, Equal ) A Å B AKA “Equivalence” in Europe
Truth Tables 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 XOR operator XNOR operator
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
0 1 2 3 . . . 63 B5 B4 B3 B2 B1 B0 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 26 = 64 Truth Tables Question: How many rows are there in a truth table for n variables? 2n As many rows as unique Combinations of inputs Enumerate by counting in binary
Boolean Algebra -- Manipulation • Simplify • Operand Count Reduction • Reduce Number of Terms • Transform: Put in Preferred Form • AND/OR • NAND/NOR
Term Reduction Huntington’s Postulate P4a F = (X + Y) × (X + Z) = X + Y×Z
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
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
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.
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()
Boolean Function Via Truth Table Function f1() can be expressed as Truth Table:
Boolean Function Via Truth Table f1() can be expressed as Karnaugh Map, AKA K-Map:
Boolean Function Via Truth Table Function f1() can be expressed as a thorus, found in [1] at Wiki:
Boolean Function Via Truth Table Function f1() can be expressed as Minterms: f1( a, b, c, d ) = Σ mi with i = { 0, 2, 8, 10 }
Boolean Function Via Truth Table Function f1() can be expressed as Maxterms: f1’( a, b, c, d ) = Π mi with i = { 1, 3, 4, 5, 6, 7, 9, 11, 12, 13, 14, 15 }
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, with more than 4 variables; see sample with 5 • Can use multiple K-Maps for 6 or more variables
K-Maps: f2() • Key idea: group largest possible rectangle of all ‘1’ together, until all ‘1’ are covered • Sometimes rectangle may be distributed: spread over various physical partitions
K-Maps: f2() Solution for f2()
K-Maps: f3() Largest groups of groups of all ones (‘1’) viewed together, including across border
K-Maps: f3() Solution for f3()
K-Maps: f4() Largest groups of rectangles of all ones (‘1’) together, including “double-counting”
K-Maps: f4() Solution for f4()
K-Maps: f5() • If f2() had a few Don’t Cares, indicated by x, how could we express function f5()? • Set some x = 1, some others to x = 0
K-Maps: f5() A possible solution for f5()
Simpler K-Maps: f6_1() Only 3 Boolean variables; determine f6_1(): f6_1 = a b + ac + b’ c Perhaps we can do better?
Simpler K-Maps: f6_2() Same 3 Boolean variables for f6_2() f6_2 = a b + b’ c Consensus Theorem in action!
More Complex K-Map: f7() • f7() is function of 5 variables: a b c d e • Here K-map for f7() = abc + bcd + cde
Student Exercise K-Map: f7_1() • f7_1() also function of 5 variables: a b c d e • Compute K-map for f7_1() = ?
Student Exercise K-Map: f7_1() Solution: f7_1() = abe + cde + bcd
Student Exercise K-Map: f7_2() • f7_2() function of 5 variables: a b c d e • Compute harder K-map for f7_2() = ?
Student Exercise K-Map: f7_2() Solution: f7_2() = cde + bcd+ abde + abce’