Presentation is loading. Please wait.

Presentation is loading. Please wait.

EE345 - Micro-Controllers Boolean Algebra and Logic Gates Prof. Ahmad Abu-El-Haija.

Similar presentations


Presentation on theme: "EE345 - Micro-Controllers Boolean Algebra and Logic Gates Prof. Ahmad Abu-El-Haija."— Presentation transcript:

1 EE345 - Micro-Controllers Boolean Algebra and Logic Gates Prof. Ahmad Abu-El-Haija

2 March 5, 2016Digital System Design2 Acknowledgement This presentation is a modified version of lecture notes prepared by Dr. Pradondet Nilagupta, Kasetsart University. The latter is also a modified version based upon presentations by Prof. Maciej Ciesielski and Prof. Tilman Wolf, University of Massachusetts Amherst, and original slides from the publisher.

3 March 5, 2016EE345 – Micro-Controllers3 Algebras What is an Algebra?  Mathematical system consisting of Set of elements Set of operators Axioms or postulates Why is it important?  Defines rules of “calculations” Example: arithmetic on natural numbers  Set of elements: N = {1,2,3,4,…}  Operator: +, –, *  Axioms: associativity, distributivity, closure, identity elements, etc. Note: operators with two inputs are called binary  Does not mean they are restricted to binary numbers!  Operator(s) with one input are called unary

4 March 5, 2016EE345 – Micro-Controllers4 George Boole Father of Boolean algebra He came up with a type of linguistic algebra, the three most basic operations of which were (and still are) AND, OR and NOT. It was these three functions that formed the basis of his premise, and were the only operations necessary to perform comparisons or basic mathematical functions. Boole’s system (detailed in his 'An Investigation of the Laws of Thought, on Which Are Founded the Mathematical Theories of Logic and Probabilities', 1854) was based on a binary approach, processing only two objects - the yes-no, true-false, on-off, zero-one approach. Surprisingly, given his standing in the academic community, Boole's idea was either criticized or completely ignored by the majority of his peers. Eventually, one bright student, Claude Shannon (1916- 2001), picked up the idea and ran with it George Boole (1815 - 1864)

5 March 5, 2016EE345 – Micro-Controllers5 Axioms of Algebraic Structures A set of elements B and two binary operators + and ‧ 1.Closure w.r.t. the operator + ( ‧ ) x, y ∈ B ∋ x+y ∈ B 2.Associative w.r.t. + ( ‧ ) (x+y)+z= x+ (y+z) (x ‧ y) ‧ z= x ‧ (y ‧ z) 3.Commutative w.r.t. + ( ‧ ) x+y = y+x x ‧ y = y ‧ x

6 March 5, 2016EE345 – Micro-Controllers6 Axioms of Algebraic Structures 4.An identity element w.r.t. + ( ‧ ) 0+x = x+0 = x 1 ‧ x = x ‧ 1= x 5. ∀ x ∈ B, ∃ x' ∈ B (complement of x) ∋ x+x'=1 and x ‧ x'=0 6. ‧ is distributive over +: x ‧ (y+z)=(x ‧ y)+(x ‧ z) + is distributive over ‧ : x+(y ‧ z)=(x+y) ‧ (x+z)  Note the associative law can be derived no additive and multiplicative inverses complement

7 March 5, 2016EE345 – Micro-Controllers7 Boolean Algebra We need to define algebra for binary values  Developed by George Boole in 1854 Huntington postulates for Boolean algebra (1904):  Closure with respect to operator + and operator ·  Identity element 0 for operator + and 1 for operator ·  Commutativity with respect to + and · x+y = y+x, x·y = y·x  Distributivity of · over +, and + over · x·(y+z) = (x·y)+(x·z) and x+(y·z) = (x+y)·(x+z)  Complement for every element x is x’ with x+x’=1, x·x’=0  There are at least two elements x,y  B such that x  y

8 March 5, 2016EE345 – Micro-Controllers8 Boolean Algebra VERY good tool used to manipulate (simplify) Boolean functions Terminology:  Literal: A variable or its complement  Product term: literals connected by  Sum term: literals connected by +

9 March 5, 2016EE345 – Micro-Controllers9 Two-valued Boolean Algebra Two-valued Boolean is defined as  A set of elements B = {0,1} + operator: · operator: inverse: Observation? + is OR, · is AND, ’ is NOT xyx+y 000 011 101 111 xyx·y 000 010 100 111 xx' 01 10

10 March 5, 2016EE345 – Micro-Controllers10 Boolean Algebra Properties Let X: boolean variable, 0,1: constants 1. X + 0 = X -- Zero Axiom 2. X 1 = X -- Unit Axiom 3. X + 1 = 1 -- Unit Property 4. X 0 = 0 -- Zero Property 5. X + X = X -- Idepotence 6. X X = X -- Idepotence 7. X + X’ = 1 -- Complement 8. X X ’ = 0 -- Complement 9. (X ’ ) ’ = X-- Involution

11 March 5, 2016EE345 – Micro-Controllers11 Duality The principle of duality is an important concept. This says that if an expression is valid in Boolean algebra, the dual of that expression is also valid. To form the dual of an expression, replace all + operators with. operators, all. operators with + operators, all ones with zeros, and all zeros with ones. Form the dual of the expression a + (bc) = (a + b)(a + c) Following the replacement rules… a(b + c) = ab + ac Be careful not to alter the location of the parentheses if they are present.

12 March 5, 2016EE345 – Micro-Controllers12 Basic Theorems and Properties of Boolean Algebra Duality  the binary operators are interchanged; AND OR  the identity elements are interchanged; 1 0

13 March 5, 2016EE345 – Micro-Controllers13 Boolean Theorems Huntington’s postulates define some rules Need more rules to modify algebraic expressions  Theorems that are derived from postulates What is a theorem?  A formula or statement that is derived from postulates (or other proven theorems) Basic theorems of Boolean algebra  Theorem 1 (a): x + x = x (b): x · x = x  Looks straightforward, but needs to be proven ! Post. 1: closure Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0

14 March 5, 2016EE345 – Micro-Controllers14 Proof of x+x=x We can only use Huntington postulates: Show that x+x=x. x+x = (x+x)·1 by 2(b) = (x+x)(x+x’)by 5(a) = x+xx’by 4(b) = x+0by 5(b) = xby 2(a) Q.E.D. We can now use Theorem 1(a) in future proofs Huntington postulates: Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0

15 March 5, 2016EE345 – Micro-Controllers15 Proof of x·x=x Similar to previous proof Show that x·x = x. x·x = xx+0 by 2(a) = xx+xx’by 5(b) = x(x+x’)by 4(a) = x·1by 5(a) = xby 2(b) Q.E.D. Huntington postulates: Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0 Th. 1: (a) x+x=x

16 March 5, 2016EE345 – Micro-Controllers16 Absorption Property (Covering) 1. x + x y = x 2. x (x+y) = x (dual) Proof: x + x y = x 1 + x y = x (1+y) = x 1 = x QED (2 true by duality)

17 March 5, 2016EE345 – Micro-Controllers17 Consensus Theorem 1. xy + x ’ z + yz = xy + x ’ z 2. (x+y) (x ’ +z) (y+z) = (x+y) (x ’ +z) -- (dual) Proof: xy + x ’ z + yz = xy + x ’ z + (x+x ’ )yz = xy + x ’ z + xyz + x ’ yz = (xy + xyz) + (x ’ z + x ’ zy) = xy + x ’ z QED (2 true by duality).

18 March 5, 2016EE345 – Micro-Controllers18 Theorems to Apply to Exclusive-OR

19 March 5, 2016EE345 – Micro-Controllers19 Boolean Functions Elements and operators can express a function  Value of function determined by value of variables  Complete function is evaluated for all possible values Function can be represented by truth table  E.g., F 1 = x + y’z Evaluate in steps  E.g., y’ and y’z xyzy'y'zx+y'z 000100 001111 010000 011000 100101 101111 110001 111001

20 March 5, 2016EE345 – Micro-Controllers20 Logic Circuit Diagram of Function Logic function can be expressed as circuit diagram  Direct translation from algebraic expression Example: F 1 = x + y’z Problem: possibly multiple equivalent algebraic expressions  Difficult to compare Boolean functions

21 March 5, 2016EE345 – Micro-Controllers21 Design Problem Design the control logic for a fan in a greenhouse. The logic must sense three environmental conditions: 1. It is raining outside (variable x) 2. It is humid inside (variable y) 3. It is hot inside (variable z) The fan should turn on when It is humid AND it is not raining AND it is hot yx’z OR It is not humid AND ((its not raining AND it is hot) OR it is raining) y’ (x’z+x) Create a Boolean function that controls the fan.  F 1 = yx’z + y’(x’z+x)  F 2 = x’y’z+x’yz+xy’; F 3 = x’z+xy’ Question: How to evaluate these solutions (equivalent functions)? F

22 March 5, 2016EE345 – Micro-Controllers22 Boolean Function Representations Greenhouse example function can be expressed as: A nalytically, as sum of minterms : yx’z + y’(x’z+x)= yx’z+y’x’z+y’x = x’yz+x’y’z+xy’(z+z’) = x’yz+x’y’z+xy’z+xy’z’ xyzF2F2 0000 0011 0100 0111 1001 1011 1100 1110  As a logic network  As a truth table  How to derive different solutions ?  How to evaluate these solutions ?

23 March 5, 2016EE345 – Micro-Controllers23 How to compare expressions? From the Greenhouse Example:  Is yx’z + y’(x’z+x) = x’z+xy’ ? (are these functions equivalent?) yx’z + y’(x’z+x)= yx’z+y’x’z+y’x = (y+y’)x’z+y’x = x’z+xy’  Yes, both expressions describe the same function (equivalent) Problem: hard to compare algebraic expressions  Easier with gate level comparison? Comparison of Boolean Functions

24 March 5, 2016EE345 – Micro-Controllers24 Comparison of Boolean functions Comparison by algebraic expression  Good: can handle many variables  Bad: not clear how to get one expression from another Comparison on gate level  Bad: same as algebraic expression  Bad: hard to modify for comparison Comparison by truth table  Good: Only one representation in truth table  Bad: cumbersome for 4 or more variables  Bad: hard to derive gate level implementation Comparison with canonical form  Good: standardized form for algebraic expression  Bad: not necessarily solution with least number of gates

25 March 5, 2016EE345 – Micro-Controllers25 Canonical Forms A form is canonical if representation of a function in this form is unique  Truth table is canonical representation  Uses minterms as basic component A minterm is a product (ANDing) of all variables  Each variable of function appears in minterm  Variable is in normal form (x) or in complemented form (x’) Example: minterms for 3-variable function All algebraic expressions can be converted into canonical form xyz mintermdesignation 000x'y'z'm0m0 001x'y'zm1m1 010x'yz'm2m2 011x'yzm3m3 100xy'z'm4m4 101xy'zm5m5 110xyz'm6m6 111xyzm7m7

26 March 5, 2016EE345 – Micro-Controllers26 Canonical Forms xyzF mintermdesignation 0000x'y'z'm0m0 0011x'y'zm1m1 0100x'yz'm2m2 0111x'yzm3m3 1001xy'z'm4m4 1011xy'zm5m5 1100xyz'm6m6 1110xyzm7m7  Function = sum of all minterms where truth table is 1 Function is expressed as sum of minterms Greenhouse example: yx’z + y’(x’z+x)= yx’z+y’x’z+y’x = x’yz+x’y’z+xy’(z+z’) = x’yz+x’y’z+xy’z+xy’z’ = m3 + m1 + m5 + m4

27 March 5, 2016EE345 – Micro-Controllers27 Canonical Forms Canonical form: Sum of minterms Example: F=A+B’C  Expansion of minterms: A = ABC+ABC’+AB’C+AB’C’ B’C = AB’C+A’B’C  F = ABC+ABC’+AB’C+ AB’C’+A’B’C Alternate forms:  F=m 1 +m 4 +m 5 +m 6 +m 7  F=∑(1,4,5,6,7) Is this the only canonical form?  No, other forms exist (dual form, etc.) ABC F mintermdesignation 000 0 A'B'C'm0m0 001 1 A'B'Cm1m1 010 0 A'BC'm2m2 011 0 A'BCm3m3 100 1 AB'C'm4m4 101 1 AB'Cm5m5 110 1 ABC'm6m6 111 1 ABCm7m7

28 March 5, 2016EE345 – Micro-Controllers28 DeMorgan’s Theorem A key theorem in simplifying Boolean expressions DeMorgan’s theorem expresses duality:  For two variables: (x + y)’ = x’  y’ (x  y)’ = x’ + y’  Can be generalized to arbitrary number of variables (a+b+c+ …+z)’ = a’ b’ c’… z’, or (  x i )’ =  x i ’ (a b c    z)’ = a’+b’+c’+…+z’, or (  x i )’ =  x i ’ where:  = OR,  = AND Proof for DeMorgan’s theorem by truth tables  See Mano p. 59

29 March 5, 2016EE345 – Micro-Controllers29 Dual Canonical Form Sum of minterms can be converted to product of maxterms  Maxterms contain every variable in the function  Each maxterm is an OR of variables in different polarities  Function is a product (ANDing) of maxterms where truth table is 0 Due to duality:  m j ’ = M j Example:  F = M 0 ·M 2 ·M 3 = = (A+B+C)(A+B’+C)(A+B’+C’)  From DeMorgan: F’ = A’B’C’+A’BC’+A’BC = = m 0 +m 2 +m 3  Complement on both sides: F = m 1 +m 4 +m 5 +m 6 +m 7 Both canonical forms express same function ABC F MaxtermDesignation 000 0 A+B+CM0M0 001 1 A+B+C’M1M1 010 0 A+B’+CM2M2 011 0 A+B’+C’M3M3 100 1 A’+B+CM4M4 101 1 A’+B+C’M5M5 110 1 A’+B’+CM6M6 111 1 A’+B’+C’M7M7

30 March 5, 2016EE345 – Micro-Controllers30 Dual Canonical Form Sum of minterms can be converted to product of maxterms Recall:  A minterm is a product (AND) of all variables in respective polarities (positive or complemented)  e.g., a’ b c’ is a minterm for a 3-variable function  Note: a b’ is not a minterm in a 3-variable function (it is a product term)  Function is OR of minterms where F = 1 A maxterm is a sum (OR) of all variables in respective polarities  Maxterm contains every variable in the function  All the variables are OR-ed together in a maxterm  Function is product (AND) of maxterms where F = 0

31 March 5, 2016EE345 – Micro-Controllers31 Dual Canonical Form Duality (DeMorgan):  (  x i )’ =  x i ’  m’ j = M j Example: F = (m1,m4,m5,m6,m7)  Examine the complement of F: F’ = m 0 +m 2 +m 3 = A’B’C’ + A’BC’ + A’BC  Take a complement (DeMorgan): (F’)’ = (A+B+C)(A+B’+C)(A+B’+C’) = M 0 ·M 2 ·M 3  Since (F’)’ = F : F = M 0 ·M 2 ·M 3 = m 1 +m 4 +m 5 +m 6 +m 7 Both canonical forms express same function:  F =  m i =  M i ABC F MaxtermDesignation 000 0 A+B+CM0M0 001 1 A+B+C’M1M1 010 0 A+B’+CM2M2 011 0 A+B’+C’M3M3 100 1 A’+B+CM4M4 101 1 A’+B+C’M5M5 110 1 A’+B’+CM6M6 111 1 A’+B’+C’M7M7

32 March 5, 2016EE345 – Micro-Controllers32 Example Truth table for f 1 (a,b,c) at right The canonical sum-of-products form for f 1 is f 1 (a,b,c) = m 1 + m 2 + m 4 + m 6 = a ’ b ’ c + a ’ bc ’ + ab ’ c ’ + abc ’ The canonical product-of-sums form for f 1 is f 1 (a,b,c) = M 0 M 3 M 5 M 7 = (a+b+c) (a+b ’ +c ’ ) (a ’ +b+c ’ ) (a ’ +b ’ +c ’ ). Observe that: m j = M j ’ abcf1f1 0000 0011 0101 0110 1001 1010 1101 1110

33 March 5, 2016EE345 – Micro-Controllers33 Shorthand: ∑ and ∏ f 1 (a,b,c) = ∑ m(1,2,4,6), where ∑ indicates that this is a sum-of-products form, and m(1,2,4,6) indicates that the minterms to be included are m 1, m 2, m 4, and m 6. f 1 (a,b,c) = ∏ M(0,3,5,7), where ∏ indicates that this is a product-of-sums form, and M(0,3,5,7) indicates that the maxterms to be included are M 0, M 3, M 5, and M 7. Since m j = M j ’ for any j, ∑ m(1,2,4,6) = ∏ M(0,3,5,7) = f 1 (a,b,c)

34 March 5, 2016EE345 – Micro-Controllers34 Conversion between Canonical Forms Replace ∑ with ∏ (or vice versa) and replace those j ’ s that appeared in the original form with those that do not. Example: f 1 (a,b,c)= a ’ b ’ c + a ’ bc ’ + ab ’ c ’ + abc ’ = m 1 + m 2 + m 4 + m 6 = ∑ (1,2,4,6) = ∏ (0,3,5,7) = (a+b+c) (a+b ’ +c ’ ) (a ’ +b+c ’ ) (a ’ +b ’ +c ’ )

35 March 5, 2016EE345 – Micro-Controllers35 Standard Forms (NOT Unique) Standard forms are “ like ” canonical forms, except that not all variables need to appear in the individual product (SOP) or sum (POS) terms. Example: f 1 (a,b,c) = a ’ b ’ c + bc ’ + ac ’ is a standard sum-of-products form f 1 (a,b,c) = (a+b+c) (b ’ +c ’ ) (a ’ +c ’ ) is a standard product-of-sums form.

36 March 5, 2016EE345 – Micro-Controllers36 Conversion of SOP from standard to canonical form Expand non-canonical terms by inserting equivalent of 1 in each missing variable x: (x + x ’ ) = 1 Remove duplicate minterms f 1 (a,b,c) = a ’ b ’ c + bc ’ + ac ’ = a ’ b ’ c + (a+a ’ )bc ’ + a(b+b ’ )c ’ = a ’ b ’ c + abc ’ + a ’ bc ’ + abc ’ + ab ’ c ’ = a ’ b ’ c + abc ’ + a ’ bc + ab ’ c ’

37 March 5, 2016EE345 – Micro-Controllers37 Conversion of POS from standard to canonical form Expand noncanonical terms by adding 0 in terms of missing variables (e.g., xx ’ = 0) and using the distributive law Remove duplicate maxterms f 1 (a,b,c) = (a+b+c) (b ’ +c ’ ) (a ’ +c ’ ) = (a+b+c) (aa ’ +b ’ +c ’ ) (a ’ +bb ’ +c ’ ) = (a+b+c) (a+b ’ +c ’ ) (a ’ +b ’ +c ’ ) (a ’ +b+c ’ ) (a ’ +b ’ +c ’ ) =(a+b+c) (a+b ’ +c ’ ) (a ’ +b ’ +c ’ ) (a ’ +b+c ’ )

38 March 5, 2016EE345 – Micro-Controllers38 Sum of Product (SOP) Form Any function can be expressed as Sum of Products (SOP)  A product term is a product (AND) of the variables in respective polarities  Minterm is a special case of product term (has all variables)  SOP is not canonical, many SOP forms exist for same function Greenhouse example : yx’z + y’(x’z+x) = x’yz + x’y’z + x y’ = x’z + xy’ xyzF 0011 0111 10--1  SOP table (list only for F=1) SOP has natural representation in practice, as two-level logic network

39 March 5, 2016EE345 – Micro-Controllers39 Counting Boolean Functions Now we can express algebraic functions uniquely  Unique sum of minterms or product of maxterms representations How many binary Boolean functions exist?  How many different combinations of minterms can one pick?  There are 4 minterms in a binary function  Each minterm can be present in the sum or not Two choices for each minterm  Total 2 4 =16 combinations How many Boolean functions exist with n variables?  2 n minterms  Total: 2 2 n combinations

40 March 5, 2016EE345 – Micro-Controllers40 Truth Table of Two Binary Variables

41 March 5, 2016EE345 – Micro-Controllers41 Possible combinations of Binary Boolean Functions

42 March 5, 2016EE345 – Micro-Controllers42 Digital Logic Gates Name Graphics Algebraic Truth Symbols Function Table

43 March 5, 2016EE345 – Micro-Controllers43 Digital Logic Gates Name Graphics Algebraic Truth Symbols Function Table

44 March 5, 2016EE345 – Micro-Controllers44 Multiple-input Gates NOR does not extend easily  Associativity does not hold Multiple-input gate: z

45 March 5, 2016EE345 – Micro-Controllers45 Multiple Input NAND and NOR Multiple NOR = a complement of OR gate Multiple NAND = a complement of AND gate The cascaded NAND operations = sum of products The cascaded NOR operations = product of sums

46 March 5, 2016EE345 – Micro-Controllers46 Multiple-input XOR Extension of exclusive-OR not straightforward  What is the definition for 3 variables? Turns into “odd” function  Function is 1 when there is an odd number of 1’s Uncommon in hardware implementations

47 March 5, 2016EE345 – Micro-Controllers47 Positive and Negative Logic Signal levels are represented as H (high) and L (low)  e.g., H is 5V and L is 0V Positive logic  H corresponds to logic 1  L corresponds to logic 0 Negative logic  H corresponds to logic 0  L corresponds to logic 1 User has choice of logic used

48 March 5, 2016EE345 – Micro-Controllers48 Positive and Negative Logic Truth table with H and L In positive logic: AND In negative logic: OR Arrows indicate negative logic

49 March 5, 2016EE345 – Micro-Controllers49 Integrated Circuits Small-scale integration (SSI)  10’s of logic gates  Early 1960’s Medium-scale integration (MSI)  100’s – 1000’s of logic gates  Late 1960’s Large-scale integration (LSI)  1000’s – 10,000’s of logic gates  Mid 1970’s Very large-scale integration (VLSI)  100,000’s of logic gates  1980’s Ultra large-scale integration (ULSI)  Millions of logic gates  1990’s and 2000’s

50 March 5, 2016EE345 – Micro-Controllers50

51 March 5, 2016EE345 – Micro-Controllers51 Logic Families TTL: transistor-transistor Logic  Standard family, very familiar  Used for a long time ECL: emitter-coupled logic  High speed of operation MOS: metal-oxide semiconductor  Suitable for circuits that need high component density CMOS: complementary metal-oxide semiconductor  Suitable for systems requiring low power consumption, such as digital cameras and hand-held digital devices

52 March 5, 2016EE345 – Micro-Controllers52 Characteristics of Digital Logic Families Fan-out: number of standard loads that the ouput of a typical gate can drive Fan-in: number of inputs available in a gate Power dissipation: power consumed by gate Propagation delay: average transition delay time for the signal to propagate from input to output Noise margin: minimum external noise voltage added to input signal that caused an undesirable change in the circuit output

53 March 5, 2016EE345 – Micro-Controllers53 Chip Design Why is it better to have more gates on a single chip?  Easier to build systems  Lower power consumption  Higher clock frequencies What are the drawbacks of large circuits?  Complex to design  Chips have design constraints  Hard to test Need tools to help develop integrated circuits  Computer Aided Design (CAD) tools  Automate tedious steps of design process  Hardware description language (HDL) describe circuits  VHDL is one such system (approved as standard by IEEE)


Download ppt "EE345 - Micro-Controllers Boolean Algebra and Logic Gates Prof. Ahmad Abu-El-Haija."

Similar presentations


Ads by Google