Upcoming SlideShare
×

# Boolean algebra And Logic Gates

5,405 views

Published on

7 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
5,405
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
233
0
Likes
7
Embeds 0
No embeds

No notes for slide
• We can also use algebraic properties in doing this proof. We will show that, x’ . y’, satisfies the definition of the complement of (x + y), defined as (x + y)’ by DeMorgan’s Law. To show this we need to show that A + A’ = 1 and A . A’ = 0 with A = x + y and A’ = x’ . y’. This proves that x’ . y’ = (x + y)’. Part 1: Show x + y + x’ . y’ = 1. x + y + x’ . y’ = (x + y + x’) (x + y + y’) X + YZ = (X + Y)(X + Z) (Distributive Law) = (x + x’ + y) (x + y + y’) X + Y = Y + X (Commutative Law) = (1 + y)(x + 1) X + X’ = 1 = 1 . 1 1 + X = 1 = 1 1 . X = 1 Part 2: Show (x + y) . x’ . y’ = 0. (x + y) . x’ . y’ = (x . x’ . y’ + y . x’ . y’) X (Y + Z) = XY + XZ (Distributive Law) = (x . x’ . y’ + y . y’ . x’) XY = YX (Commutative Law) = (0 . y’ + 0 . x’) X . X’ = 0 = (0 + 0) 0 . X = 0 = 0 X + 0 = X (With X = 0) Based on the above two parts, x’y’ = (x + y)’ The second DeMorgans’ law is proved by duality. Note that DeMorgan’s Law, given as an identity is not an axiom in the sense that it can be proved using the other identities.
• G&apos; = ((a (b&apos; + c&apos;))+ d ) e&apos; = (a (b&apos; + c&apos;) + d) e&apos;
• F(A,B,C,D,E) = A’B’C’DE’ + A’BC’D’E + AB’C’D’E + AB’CDE
• F(A,B,C,D,E) = A’B’C’DE’ + A’BC’D’E + AB’C’D’E + AB’CDE
• ### Boolean algebra And Logic Gates

1. 1. Charles Kime & Thomas Kaminski© 2008 Pearson Education, Inc.(Edited by Dr. Muhamed Mudawar for COE 202 & EE 200 at KFUPM)Boolean Algebraand Logic GatesLogic and Computer Design Fundamentals
2. 2. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values andbinary variables. Basic logical operators are the logic functionsAND, OR and NOT. Logic gates implement logic functions. Boolean Algebra: a useful mathematical systemfor specifying and transforming logic functions. We study Boolean algebra as a foundation fordesigning and analyzing digital systems!
3. 3. Binary Variables Recall that the two binary values havedifferent names:• True/False• On/Off• Yes/No• 1/0 We use 1 and 0 to denote the two values. Variable identifier examples:• A, B, y, z, or X1 for now• RESET, START_IT, or ADD1 later
4. 4. Logical Operations The three basic logical operations are:• AND• OR• NOT AND is denoted by a dot (·). OR is denoted by a plus (+). NOT is denoted by an overbar ( ¯ ), asingle quote mark () after, or (~) beforethe variable.
5. 5.  Examples:• is read “Y is equal to A AND B.”• is read “z is equal to x OR y.”• is read “X is equal to NOT A.”Notation Examples Note: The statement:1 + 1 = 2 (read “one plus one equals two”)is not the same as1 + 1 = 1 (read “1 or 1 equals 1”).= BAY ⋅yxz +=AX =
6. 6. Operator Definitions Operations are defined on the values"0" and "1" for each operator:AND0 · 0 = 00 · 1 = 01 · 0 = 01 · 1 = 1OR0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 1NOT10 =01=
7. 7. 0110XNOTXZ=Truth Tables Tabular listing of the values of a function for allpossible combinations of values on its arguments Example: Truth tables for the basic logic operations:111001010000Z = X·YYXAND ORX Y Z = X+Y0 0 00 1 11 0 11 1 1
8. 8. Truth Tables – Cont’d Used to evaluate any logic function Consider F(X, Y, Z) = X Y + Y ZX Y Z X Y Y Y Z F = X Y + Y Z0 0 0 0 1 0 00 0 1 0 1 1 10 1 0 0 0 0 00 1 1 0 0 0 01 0 0 0 1 0 01 0 1 0 1 1 11 1 0 1 0 0 11 1 1 1 0 0 1
9. 9.  Using Switches• Inputs: logic 1 is switch closed logic 0 is switch open• Outputs: logic 1 is light on logic 0 is light off.• NOT input: logic 1 is switch open logic 0 is switch closedLogic Function ImplementationSwitches in series => ANDSwitches in parallel => ORCNormally-closed switch => NOT
10. 10.  Example: Logic Using Switches Light is on (L = 1) forL(A, B, C, D) =and off (L = 0), otherwise. Useful model for relay and CMOS gate circuits,the foundation of current digital logic circuitsLogic Function Implementation – cont’dBADCA (B C + D) = A B C + A D
11. 11. Logic Gates In the earliest computers, switches were openedand closed by magnetic fields produced byenergizing coils in relays. The switches in turnopened and closed the current paths. Later, vacuum tubes that open and closecurrent paths electronically replaced relays. Today, transistors are used as electronicswitches that open and close current paths.
12. 12. Logic Gate Symbols and Behavior Logic gates have special symbols: And waveform behavior in time as follows:X 0 0 1 1Y 0 1 0 1X · Y(AND) 0 0 0 1X + Y(OR) 0 1 1 1(NOT) X 1 1 0 0OR gateXYZ = X + YXYZ = X · YAND gateX Z = XNOT gateorinverter
13. 13. Logic Diagrams and Expressions Boolean equations, truth tables and logic diagrams describethe same function! Truth tables are unique, but expressions and logic diagramsare not. This gives flexibility in implementing functions.XY FZLogic DiagramLogic EquationZYXF +=Truth Table11 1 111 1 011 0 111 0 000 1 100 1 010 0 100 0 0X Y Z ZYXF ⋅+=
14. 14. Gate Delay In actual physical gates, if an input changes thatcauses the output to change, the output changedoes not occur instantaneously. The delay between an input change and theoutput change is the gate delay denoted by tG:tGtGInputOutputTime (ns)00110 0.5 1 1.5tG = 0.3 ns
15. 15. 1.3.5.7.9.11.13.15.17.CommutativeAssociativeDistributiveDeMorgan’s2.4.6.8.X .1 X=X .0 0=X .X X=0=X .XBoolean Algebra10.12.14.16.X + Y Y + X=(X + Y) Z+ X + (Y Z)+=X(Y + Z) XY XZ+=X + Y X .Y=XY YX=(XY)Z X(YZ)=X + YZ (X + Y)(X + Z)=X .Y X + Y=X + 0 X=+X 1 1=X + X X=1=X + XX= X Invented by George Boole in 1854 An algebraic structure defined by a set B = {0, 1}, together with twobinary operators (+ and ·) and a unary operator ( )IdempotenceComplementInvolutionIdentity element
16. 16. Some Properties of Boolean Algebra Boolean Algebra is defined in general by a set B that canhave more than two values A two-valued Boolean algebra is also know as SwitchingAlgebra. The Boolean set B is restricted to 0 and 1.Switching circuits can be represented by this algebra. The dual of an algebraic expression is obtained byinterchanging + and · and interchanging 0’s and 1’s. The identities appear in dual pairs. When there is onlyone identity on a line the identity is self-dual, i. e., thedual expression = the original expression. Sometimes, the dot symbol ‘’ (AND operator) is notwritten when the meaning is clear
17. 17.  Example: F = (A + C) · B + 0dual F = (A · C + B) · 1 = A · C + B Example: G = X · Y + (W + Z)dual G = Example: H = A · B + A · C + B · Cdual H = Unless it happens to be self-dual, the dual of anexpression does not equal the expression itself Are any of these functions self-dual?(A+B)(A+C)(B+C)=(A+BC)(B+C)=AB+AC+BCDual of a Boolean Expression(X+Y) · (W · Z) = (X+Y) · (W+Z)(A+B) · (A+C) · (B+C)H is self-dual
18. 18. Boolean Operator Precedence The order of evaluation is:1. Parentheses2. NOT3. AND4. OR Consequence: Parentheses appeararound OR expressions Example: F = A(B + C)(C + D)
19. 19. Boolean Algebraic Proof – Example 1 A + A · B = A (Absorption Theorem)Proof Steps JustificationA + A · B= A · 1 + A · B Identity element: A · 1 = A= A · ( 1 + B) Distributive= A · 1 1 + B = 1= A Identity element Our primary reason for doing proofs is to learn:• Careful and efficient use of the identities and theorems ofBoolean algebra, and• How to choose the appropriate identity or theorem to applyto make forward progress, irrespective of the application.
20. 20.  AB + AC + BC = AB + AC (Consensus Theorem)Proof Steps Justification= AB + AC + BC= AB + AC + 1 · BC Identity element= AB + AC + (A + A) · BC Complement= AB + AC + ABC + ABC Distributive= AB + ABC + AC + ACB Commutative= AB · 1 + ABC + AC · 1 + ACB Identity element= AB (1+C) + AC (1 + B) Distributive= AB . 1 + AC . 1 1+X = 1= AB + AC Identity elementBoolean Algebraic Proof – Example 2
21. 21. Useful Theorems MinimizationX Y + X Y = Y AbsorptionX + X Y = X SimplificationX + X Y = X + Y DeMorgan’s X + Y = X · Y Minimization (dual)(X+Y)(X+Y) = Y Absorption (dual)X · (X + Y) = X Simplification (dual)X · (X + Y) = X · Y DeMorgan’s (dual) X · Y = X + Y
22. 22. Truth Table to Verify DeMorgan’sX Y X·Y X+Y X Y X+Y X · Y X·Y X+Y0 0 0 0 1 1 1 1 1 10 1 0 1 1 0 0 0 1 11 0 0 1 0 1 0 0 1 11 1 1 1 0 0 0 0 0 0X + Y = X · Y X · Y = X + Y Generalized DeMorgan’s Theorem:X1+ X2+ … + Xn = X1 · X2 · … · XnX1 · X2 · … · Xn = X1 + X2 + … + Xn
23. 23. Complementing Functions Use DeMorgans Theorem:1. Interchange AND and OR operators2. Complement each constant and literal Example: Complement F =F = (x + y + z)(x + y + z) Example: Complement G = (a + bc)d + eG = (a (b + c) + d) ex+ zyzyx
24. 24. Expression Simplification An application of Boolean algebra Simplify to contain the smallest numberof literals (variables that may or may notbe complemented)= AB + ABCD + A C D + A C D + A B D= AB + AB(CD) + A C (D + D) + A B D= AB + A C + A B D = B(A + AD) +AC= B (A + D) + A C (has only 5 literals)++++ DCBADCADBADCABA
25. 25. Next … Canonical Forms Minterms and Maxterms Sum-of-Minterm (SOM) Canonical Form Product-of-Maxterm (POM) Canonical Form Representation of Complements of Functions Conversions between Representations
26. 26. Minterms Minterms are AND terms with every variablepresent in either true or complemented form. Given that each binary variable may appearnormal (e.g., x) or complemented (e.g., ), thereare 2nminterms for n variables. Example: Two variables (X and Y) produce2 x 2 = 4 combinations:(both normal)(X normal, Y complemented)(X complemented, Y normal)(both complemented) Thus there are four minterms of two variables.YXXYYXYXx
27. 27. Maxterms Maxterms are OR terms with every variable intrue or complemented form. Given that each binary variable may appearnormal (e.g., x) or complemented (e.g., x), thereare 2nmaxterms for n variables. Example: Two variables (X and Y) produce2 x 2 = 4 combinations:(both normal)(x normal, y complemented)(x complemented, y normal)(both complemented)YX +YX +YX +YX +
28. 28.  Two variable minterms and maxterms. The minterm mi should evaluate to 1 for eachcombination of x and y. The maxterm is the complement of the mintermMinterms & Maxterms for 2 variablesx y Index Minterm Maxterm0 0 0 m0 = x y M0 = x + y0 1 1 m1 = x y M1 = x + y1 0 2 m2 = x y M2 = x + y1 1 3 m3 = x y M3 = x + y
29. 29. Minterms & Maxterms for 3 variablesM3 = x + y + zm3 = x y z3110M4 = x + y + zm4 = x y z4001M5 = x + y + zm5 = x y z5101M6 = x + y + zm6 = x y z60111100y1000x1010zM7 = x + y + zm7 = x y z7M2 = x + y + zm2 = x y z2M1 = x + y + zm1 = x y z1M0 = x + y + zm0 = x y z0MaxtermMintermIndexMaxterm Mi is the complement of minterm miMi = mi and mi = Mi
30. 30. Purpose of the Index Minterms and Maxterms are designated with an index The index number corresponds to a binary pattern The index for the minterm or maxterm, expressed as abinary number, is used to determine whether the variableis shown in the true or complemented form For Minterms:• ‘1’ means the variable is “Not Complemented” and• ‘0’ means the variable is “Complemented”. For Maxterms:• ‘0’ means the variable is “Not Complemented” and• ‘1’ means the variable is “Complemented”.
31. 31. Standard Order All variables should be present in a minterm ormaxterm and should be listed in the same order(usually alphabetically) Example: For variables a, b, c:• Maxterms (a + b + c), (a + b + c) are in standard order• However, (b + a + c) is NOT in standard order(a + c) does NOT contain all variables• Minterms (a b c) and (a b c) are in standard order• However, (b a c) is not in standard order(a c) does not contain all variables
32. 32. Sum-Of-Minterm (SOM) Sum-Of-Minterm (SOM) canonical form:Sum of minterms of entries that evaluate to ‘1’x y z F Minterm0 0 0 00 0 1 1 m1 = x y z0 1 0 00 1 1 01 0 0 01 0 1 01 1 0 1 m6 = x y z1 1 1 1 m7 = x y zF = m1 + m6 + m7 = ∑ (1, 6, 7) = x y z + x y z + x y zFocus on the‘1’ entries
33. 33. + a b c dSum-Of-Minterm Examples F(a, b, c, d) = ∑(2, 3, 6, 10, 11) F(a, b, c, d) = m2 + m3 + m6 + m10+ m11 G(a, b, c, d) = ∑(0, 1, 12, 15) G(a, b, c, d) = m0 + m1 + m12 + m15+ a b c da b c d + a b c d+ a b c d + a b c d+ a b c da b c d + a b c d
34. 34. Product-Of-Maxterm (POM) Product-Of-Maxterm (POM) canonical form:Product of maxterms of entries that evaluate to ‘0’x y z F Maxterm0 0 0 10 0 1 10 1 0 0 M2 = (x + y + z)0 1 1 11 0 0 0 M4 = (x + y + z)1 0 1 11 1 0 0 M6 = (x + y + z)1 1 1 1Focus on the‘0’ entriesF = M2·M4·M6 = ∏ (2, 4, 6) = (x+y+z) (x+y+z) (x+y+z)
35. 35.  F(a, b, c, d) = ∏(1, 3, 6, 11) F(a, b, c, d) = M1 · M3 · M6 · M11 G(a, b, c, d) = ∏(0, 4, 12, 15) G(a, b, c, d) = M0 · M4 · M12 · M15Product-Of-Maxterm Examples(a+b+c+d) (a+b+c+d) (a+b+c+d) (a+b+c+d)(a+b+c+d) (a+b+c+d) (a+b+c+d) (a+b+c+d)
36. 36. Observations We can implement any function by "ORing" the mintermscorresponding to the ‘1’ entries in the function table. Aminterm evaluates to ‘1’ for its corresponding entry. We can implement any function by "ANDing" the maxtermscorresponding to ‘0’ entries in the function table. A maxtermevaluates to ‘0’ for its corresponding entry. The same Boolean function can be expressed in twocanonical ways: Sum-of-Minterms (SOM) and Product-of-Maxterms (POM). If a Boolean function has fewer ‘1’ entries then the SOMcanonical form will contain fewer literals than POM.However, if it has fewer ‘0’ entries then the POM form willhave fewer literals than SOM.
37. 37. Converting to Sum-of-Minterms Form A function that is not in the Sum-of-Minterms formcan be converted to that form by means of a truth table Consider F = y + x zx y z F Minterm0 0 0 1 m0 = x y z0 0 1 1 m1 = x y z0 1 0 1 m2 = x y z0 1 1 01 0 0 1 m4 = x y z1 0 1 1 m5 = x y z1 1 0 01 1 1 0F = ∑(0, 1, 2, 4, 5) =m0 + m1 + m2 + m4 + m5 =x y z + x y z + x y z +x y z + x y z
38. 38. Converting to Product-of-Maxterms Form A function that is not in the Product-of-Minterms formcan be converted to that form by means of a truth table Consider again: F = y + x zx y z F Minterm0 0 0 10 0 1 10 1 0 10 1 1 0 M3 = (x+y+z)1 0 0 11 0 1 11 1 0 0 M6 = (x+y+z)1 1 1 0 M7 = (x+y+z)F = ∏(3, 6, 7) =M3 · M6 · M7 =(x+y+z) (x+y+z) (x+y+z)
39. 39. Conversions Between Canonical FormsF = m1+m2+m3+m5+m7 = ∑(1, 2, 3, 5, 7) =x y z + x y z + x y z + x y z + x y zF = M0· M4· M6 = ∏(0, 4, 6) = (x+y+z)(x+y+z)(x+y+z)x y z F Minterm Maxterm0 0 0 0 M0 = (x + y + z)0 0 1 1 m1 = x y z0 1 0 1 m2 = x y z0 1 1 1 m3 = x y z1 0 0 0 M4 = (x + y + z)1 0 1 1 m5 = x y z1 1 0 0 M6 = (x + y + z)1 1 1 1 m7 = x y z
40. 40. Algebraic Conversion to Sum-of-Minterms Expand all terms first to explicitly list all minterms AND any term missing a variable v with (v + v) Example 1: f = x + x y (2 variables)f = x (y + y) + x yf = x y + x y + x yf = m3 + m2 + m0 = ∑(0, 2, 3) Example 2: g = a + b c (3 variables)g = a (b + b)(c + c) + (a + a) b cg = a b c + a b c + a b c + a b c + a b c + a b cg = a b c + a b c + a b c + a b c + a b cg = m1 + m4 + m5 + m6 + m7 = ∑ (1, 4, 5, 6, 7)
41. 41. Algebraic Conversion to Product-of-Maxterms Expand all terms first to explicitly list all maxterms OR any term missing a variable v with v · v Example 1: f = x + x y (2 variables)Apply 2nddistributive law:f = (x + x) (x + y) = 1 · (x + y) = (x + y) = M1 Example 2: g = a c + b c + a b (3 variables)g = (a c + b c + a) (a c + b c + b) (distributive)g = (c + b c + a) (a c + c + b) (x + x y = x + y)g = (c + b + a) (a + c + b) (x + x y = x + y)g = (a + b + c) (a + b + c) = M5 . M2 = ∏ (2, 5)
42. 42. Function Complements The complement of a function expressed as asum of minterms is constructed by selecting theminterms missing in the sum-of-mintermscanonical form Alternatively, the complement of a functionexpressed by a Sum of Minterms form is simplythe Product of Maxterms with the same indices Example: Given F(x, y, z) = ∑ (1, 3, 5, 7)F(x, y, z) = ∑ (0, 2, 4, 6)F(x, y, z) = ∏ (1, 3, 5, 7)
43. 43. Summary of Minterms and Maxterms There are 2nminterms and maxterms for Booleanfunctions with n variables. Minterms and maxterms are indexed from 0 to 2n– 1 Any Boolean function can be expressed as a logicalsum of minterms and as a logical product of maxterms The complement of a function contains those mintermsnot included in the original function The complement of a sum-of-minterms is a product-of-maxterms with the same indices
44. 44.  Standard Sum-of-Products (SOP) form:equations are written as an OR of AND terms Standard Product-of-Sums (POS) form:equations are written as an AND of OR terms Examples:• SOP:• POS: These “mixed” forms are neither SOP nor POS••Standard FormsBCBACBA ++C·)CB(A·B)(A +++C)(AC)B(A ++B)(ACACBA ++
45. 45. Standard Sum-of-Products (SOP) A sum of minterms form for n variables canbe written down directly from a truth table.• Implementation of this form is a two-levelnetwork of gates such that:• The first level consists of n-input AND gates• The second level is a single OR gate This form often can be simplified so that thecorresponding circuit is simpler.
46. 46.  A Simplification Example: Writing the minterm expression:F = A B C + A B C + A B C + ABC + ABC Simplifying:F = A B C + A (B C + B C + B C + B C)F = A B C + A (B (C + C) + B (C + C))F = A B C + A (B + B)F = A B C + AF = B C + A Simplified F contains 3 literals compared to 15Standard Sum-of-Products (SOP))7,6,5,4,1()C,B,A(F Σ=
47. 47. AND/OR Two-Level Implementation The two implementations for F are shown belowFBCAIt is quiteapparent whichis simpler!
48. 48. SOP and POS Observations The previous examples show that:• Canonical Forms (Sum-of-minterms, Product-of-Maxterms),or other standard forms (SOP, POS) differ in complexity• Boolean algebra can be used to manipulate equations intosimpler forms• Simpler equations lead to simpler implementations Questions:• How can we attain a “simplest” expression?• Is there only one minimum cost circuit?• The next part will deal with these issues