Boolean Algebra and Logic Gates ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall, 2017 ldvan@cs.nctu.edu.tw http://www.cs.nctu.edu.tw/~ldvan/
Outlines Basic Definitions of Algebra Axiomatic Definitions of Boolean Algebra Basic Theorems and Properties of Boolean Algebra Boolean Function Canonical and Standard Forms Other logic Operations Digital Logic Gates DCD-02-2
History In 1854, George Boole developed an algebraic system Now, called Boolean algebra In 1904, E. V. Huntington formulated several postulates for Boolean algebra. Widely used in research nowadays. In 1938, C. E. Shannon introduced a two-valued Boolean algebra Called switching algebra https://en.wikipedia.org/wiki/george_boole http://www.bjinnovate.com/archives/515105.html DCD-02-3
Basic Definitions of Algebra Basic definitions: 1. Closure: A set S is closed with respective to a binary operator if, for every pair of elements of S, the binary operator specifies a rule for obtaining a unique element of S. 2. Associative law: A binary operator * on a set S is said to be associative whenever (x*y)*z= x*(y*z) for all x, y, z S. 3. Commutative law: A binary operator * on a set S is said to be commutative whenever x*y= y*x for all x, y S. 4. Identity element: A set S is said to have an identity element with respect to a binary operation * on S if there exists an element e S with the property that x*e = e*x =x for every x S. 5. Inverse: A set S having the identity element e with respect to a binary operation * is said to have an inverse whenever x S, there exists an element y S such that x*y = e. 6. Distributive law: If * and are two binary operators on a set S, * is said to be distributive over whenever x*(y z)=(x*y) (x*z) DCD-02-4
Axiomatic Definition of Boolean Algebra Digital Circuit Design Boolean Algebra defined by a set of elements B and two binary operators + and and has the following postulates: Postulate 1: (a) The structure is closed with respect to the operator +. (b) The structure is closed with respect to the operator. Postulate 2: (a) The element 0 is an identity element with respect to +. 0+x = x+0 = x (b) The element 1 is an identity element with respect to. 1 x = x 1= x Postulate 3: (a) The structure is commutative with respect to +. x+y = y+x (b) The structure is commutative with respect to. x y = y x DCD-02-5
Axiomatic Definition of Boolean Algebra Digital Circuit Design Postulate 4: (a) The operator is distributive over +: x (y+z)=(x y)+(x z) (b) The operator + is distributive over x+(y z)=(x+y) (x+z) Postulate 5: (a) For every element x B, there exists an element x' B (complement of x) such that (a) x+x'=1 and (b) x x'=0. Postulate 6: There exist at least two elements x, y B such that x y. Difference with ordinary algebra The operator + is distributive over is valid for Boolean algebra, but not for ordinary algebra. Boolean algebra does not have additive and multiplicative inverses; therefore, there are not subtraction or division operations. Complement is valid for Boolean algebra, but not for ordinary algebra. DCD-02-6
Two-Valued Boolean Algebra Definition: A two-valued Boolean algebra is defined on a set of two elements, B = {0,1}, with rules for the two binary operators + and as shown in the following operator tables. The rules of operations x y x y x y x+y x x 0 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 1 DCD-02-7
Two-Valued Boolean Algebra Postulate 1: The structure is closed with respect to the two operators is obvious from the tables since the result of each operation is either 1 or 0 and {1, 0} B. Postulate 2: From the table, we see that 0+0=0 0+1=1+0=1; 1 1=1 1 0=0 1=0 => Two identity elements Postulate 3: The commutative laws are obvious from the symmetry of the binary operator tables. DCD-02-8
Two-Valued Boolean Algebra Postulate 4: The distributive law can be shown to hold from the truth table of all possible values of x, y, and z. Postulate 5: Complement x+x'=1: since 0+0'=0+1=1 and 1+1'=1+0=1 x x'=0: since 0 0'=0 1=0 and 1 1'=1 0=0 Postulate 6: Has two distinct elements 1 and 0, with 0 1 Note A set of two elements + : OR operation; : AND operation A complement operator: NOT operation Binary logic is a two-valued Boolean algebra DCD-02-9
Basic Theorems and Properties Duality The binary operators are interchanged; AND OR The identity elements are interchanged; 1 0 DCD-02-10
Basic Theorems and Properties Theorem 1(a): x+x = x x+x = (x+x) 1 by postulate 2(b) = (x+x) (x+x') 5(a) = x+xx' 4(b) = x+0 5(b) = x 2(a) Theorem 1(b): x x = x x x = x x + 0 by postulate 2(a) = xx + xx' 5(b) = x (x + x') 4(a) = x 1 5(a) = x 2(b) DCD-02-11
Basic Theorems and Properties Theorem 2(a): x + 1 = 1 x + 1 = 1 (x + 1) = (x + x')(x + 1) = x + x' 1 = x + x = 1 Theorem 2(b): x 0 =0 By duality Theorem 3: (x')' = x Postulate 5 defines the complement of x, x + x' = 1 and x x' = 0 The complement of x' is x is also (x')' DCD-02-12
Basic Theorems and Properties Theorem 6 (a): x + xy = x x + xy = x 1 + xy = x (1 +y) = x 1 = x Theorem 6 (b): x(x+y) = x By duality By means of truth table x y xy x + xy 0 0 0 0 0 1 0 0 1 0 0 1 1 1 1 1 DCD-02-13
Basic Theorems and Properties DeMorgan's Theorems (x+y)' = x' y' (x y)' = x' + y x y x+y (x+y) x y x y 0 0 0 1 1 1 1 0 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 0 0 0 Operator Precedence Parentheses NOT AND OR DCD-02-14
A Boolean function Boolean Functions binary variables binary operators OR and AND unary operator NOT parentheses Examples F 1 = x y z' F 2 = x + y'z F 3 = x' y' z + x' y z + x y' F 4 = x y' + x' z F 3 =F 4 Why and How to Verify??? DCD-02-15
Boolean Functions The truth table of 2 n entries x y z F 1 F 2 F 3 F 4 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 0 Two Boolean expressions may specify the same function F 3 = F 4 DCD-02-16
Implementation with logic gates F 4 is more economical Boolean Functions F 2 F 3 F 4 DCD-02-17
Algebraic Manipulation To minimize Boolean expressions literal: a primed or unprimed variable (an input to a gate) term: an implementation with a gate The minimization of the number of literals and the number of terms => a circuit with less equipment It is a hard problem (no specific rules to follow) Ex1: x(x'+y) = xx' + xy = 0+ xy = xy Ex2: x+x'y = (x+x')(x+y) = 1 (x+y) = x+y Ex3: (x+y)(x+y') = x+xy+xy'+yy' = x(1+y+y') = x Ex4: x'y'z + x'yz + xy' = x'z(y'+y) + xy'= x'z + xy' Ex5: xy + x'z + yz = xy + x'z + yz(x+x')= xy + x'z + yzx + yzx' = xy(1+z) + x'z(1+y) = xy +x'z Ex6: (x+y)(x'+z)(y+z) = (x+y)(x'+z) by duality from the previous result DCD-02-18
Complement of a Function Complement Procedures: An interchange of 0's for 1's and 1's for 0's in the value of F By DeMorgan's theorem (A+B+C)' = (A+X)' let B+C = X = A'X by DeMorgan's = A'(B+C)' by DeMorgan's = A'(B'C') by associative = A'B'C' Generalizations (A+B+C+... +F)' = A'B'C'... F' (ABC... F)' = A'+ B'+C'+... +F' DCD-02-19
Complement of a Function Complement Examples: (x'yz' + x'y'z)' = (x'yz')' (x y'z)' = (x+y'+z) (x+y+z') [x(y'z'+yz)]' = x' + ( y'z'+yz)' = x' + (y'z')' (yz)' = x' + (y+z) (y'+z') A simpler procedure Take the dual of the function and complement each literal DCD-02-20
Canonical and Standard Forms Minterms A minterm (also called a standard product): an AND term consists of all literals in their normal form or in their complement form For example, two binary variables x and y, xy, xy', x'y, x'y' n variables has 2 n minterms Maxterms A maxterm (also called a standard sum): an OR term For example, two binary variables x and y, x+y, x+y', x +y, x +y' n variables has 2 n maxterms DCD-02-21
Canonical and Standard Forms Each maxterm is the complement of its corresponding minterm, and vice versa x y z term Term 0 0 0 x y z m 0 x+y+z M 0 0 0 1 x y z m 1 x+y+z M 1 0 1 0 x yz m 2 x+y +z M 2 0 1 1 x yz m 3 x+y +z M 3 1 0 0 xy z m 4 x +y+z M 4 1 0 1 xy z m 5 x +y+z M 5 1 1 0 xyz m 6 x +y +z M 6 1 1 1 xyz m 7 x +y +z M 7 DCD-02-22
Canonical Forms A Boolean function can be expressed by a truth table sum of minterms f 1 = x'y'z + xy'z' + xyz = m 1 + m 4 +m 7 =S(1, 4, 7) f 2 = x'yz+ xy'z + xyz'+xyz = m 3 + m 5 +m 6 + m 7 =S(3, 5, 6, 7) x y z f 1 f 2 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 DCD-02-23
Canonical Forms The complement of a Boolean function Find the minterms that produce a 0 f 1 ' = m 0 + m 2 +m 3 + m 5 + m 6 = x'y'z'+x'yz'+x'yz+xy'z+xyz' f 1 = (f 1 ')' = (x+y+z)(x+y'+z) (x+y'+z') (x'+y+z')(x'+y'+z) = M 0 M 2 M 3 M 5 M 6 Any Boolean function can be expressed as A sum of minterms A product of maxterms Both are called canonical form DCD-02-24
Canonical Forms Sum of minterms F = A+B'C = A (B+B') + B'C = AB +AB' + B'C = AB(C+C') + AB'(C+C') + (A+A')B'C =ABC+ABC'+AB'C+AB'C'+A'B'C F(A,B,C) = A'B'C +AB'C' +AB'C+ABC'+ ABC = m 1 + m 4 +m 5 + m 6 + m 7 = S(1, 4, 5, 6, 7) Or, built the truth table first DCD-02-25
Product of maxterms Canonical Forms F 1 (x,y,z) =F 1 = (x+y+z)(x+y'+z)(x'+y+z)(x'+y+z') = M 0 M 2 M 4 M 5 = P(0,2,4,5) F 2 = x + yz = (x + y)(x + z) = (x+y+zz')(x+z+yy') =(x+y+z)(x+y+z )(x+y'+z) F 3 = x'+y = x' + y + zz' = (x'+y+z)(x'+y+z') F 4 = xy + x'z = (xy + x') (xy +z) = (x+x')(y+x')(x+z)(y+z) = (x'+y)(x+z)(y+z) =(x+y+z)(x+y'+z)(x'+y+z)(x'+y+z') =M 0 M 2 M 4 M 5 DCD-02-26
Conversion between Two Canonical Forms Conversion between Canonical Forms F(A,B,C) = S(1,4,5,6,7) F'(A,B,C) = S(0,2,3) By DeMorgan's theorem F(A,B,C) = P(0,2,3) m j ' = M j Interchange the symbols S and P and list those numbers missing from the original form S of 1's P of 0's Digital Circuit Design DCD-02-27
Example F = xy + x z Conversion between Two Canonical Forms F(x, y, z) = S(1, 3, 6, 7) F(x, y, z) = P (0, 2, 4, 5) Digital Circuit Design DCD-02-28
Standard Forms Standard Forms Canonical forms are seldom used sum of products Example 1: F 1 = y' + xy+ x'yz' product of sums Example 2: F 2 = x(y'+z)(x'+y+z) DCD-02-29
Multi-level implementation Standard Forms Example 3: F 3 = AB+C(D+E)=AB+CD+CE DCD-02-30
Other Logic Operations 2 n rows in the truth table of n binary variables 2 2n functions for n binary variables 16 functions of two binary variables All the new symbols except for the exclusive-or symbol are not in common use by digital designers DCD-02-31
Other Logic Operations DCD-02-32
Digital Logic Gates Boolean expression: AND, OR and NOT operations Constructing gates of other logic operations the feasibility and economy the possibility of extending gate's inputs the basic properties of the binary operations the ability of the gate to implement Boolean functions Consider the 16 functions two: null and identity are equal to a constant four: inhibition, implication, transfer, complement are repeated twice inhibition and implication are not commutative or associative. eight: transfer, complement, AND, OR, NAND, NOR, XOR, and equivalence are used as standard gates complement: inverter transfer: buffer (increasing drive strength) equivalence: XNOR DCD-02-33
Digital Logic Gates DCD-02-34
Digital Logic Gates DCD-02-35
Digital Logic Gates Extension to multiple inputs A gate can be extended to multiple inputs if its binary operation is commutative and associative AND and OR are commutative and associative (x+y)+z = x+(y+z) = x+y+z (x y)z = x(y z) = x y z DCD-02-36
Digital Logic Gates NAND and NOR are commutative but not associative => they are not extendable z DCD-02-37
Digital Logic Gates Multiple NOR = a complement of OR gate Multiple NAND = a complement of AND The cascaded NAND operations = sum of products The cascaded NOR operations = product of sums DCD-02-38
Digital Logic Gates The XOR and XNOR gates are commutative and associative Multiple-input XOR gates are uncommon? XOR is an odd function: it is equal to 1 if the inputs variables have an odd number of 1's DCD-02-39
Positive and Negative Logic Positive and Negative Logic two signal values <=> two logic values positive logic: H=1; L=0 negative logic: H=0; L=1 Consider a TTL gate a positive logic NAND gate a negative logic OR gate the positive logic is used in this book DCD-02-40
DCD-02-41
Conclusions From this lecture, you have learned the follows: Basic Definitions of Algebra Axiomatic Definitions of Boolean Algebra Basic Theorems and Properties of Boolean Algebra Boolean Function Canonical and Standard Forms Other logic Operations Digital Logic Gates DCD-02-42