boolean algibra

download boolean algibra

of 20

Transcript of boolean algibra

  • 8/8/2019 boolean algibra

    1/20

    Fall 2002 EECS150 Lec4-bool1 Page 1, 9/5 9am

    EECS150 - Digital Design

    Lecture 4 - Boolean Algebra I

    (Representations of Combinational

    Logic Circuits)September 5, 2002

    John Wawrzynek

  • 8/8/2019 boolean algibra

    2/20

    Fall 2002 EECS150 Lec4-bool1 Page 2, 9/5 9am

    Outline

    Review of three representations for combinational logic: truth tables,

    graphical (logic gates), and

    algebraic equations Relationship among the three

    Adder example

    Formal description of Boolean algebra Laws of Boolean algebra

  • 8/8/2019 boolean algibra

    3/20

    Fall 2002 EECS150 Lec4-bool1 Page 3, 9/5 9am

    Combinational Logic (CL) Defined

    yi = fi(x0 , . . . . , xn-1), where x, y are {0,1}.

    Y is a function of only X.

    If we change X, Y will change immediately (well almost!).

    There is an implementation dependent delay from X to Y.

  • 8/8/2019 boolean algibra

    4/20

    Fall 2002 EECS150 Lec4-bool1 Page 4, 9/5 9am

    CL Block Example #1

    Truth Table Description:

    Boolean Equation:y0 = (x0 AND not(x1))

    OR (not(x0) AND x1)

    y0 = x0x1' + x0'x1

    Gate Representation:

    x0 x1

    y0 0 00

    00

    1 111

    1 1

    How would weprove that all three representations are equivalent?

  • 8/8/2019 boolean algibra

    5/20

    Fall 2002 EECS150 Lec4-bool1 Page 5, 9/5 9am

    Boolean Algebra/Logic Circuits

    Why are they called logic circuits? Logic: The study of the principles of reasoning.

    The 19th Century Mathematician, George Boole, developed a

    math. system (algebra) involving logic, Boolean Algebra.

    His variables took on TRUE, FALSE

    Later Claude Shannon (father of information theory) showed

    (in his Masters thesis!) how to map Boolean Algebra to digital

    circuits: Primitive functions of Boolean Algebra:

  • 8/8/2019 boolean algibra

    6/20

    Fall 2002 EECS150 Lec4-bool1 Page 6, 9/5 9am

    Relationship Among Representations

    Truth Table

    BooleanExpression

    gate

    representation(schematic)

    ? ?

    unique

    notunique

    notunique

    [convenient for

    manipulation]

    [close to

    implementaton]

    * Theorem: Any Boolean function that can be expressed as a truth table canbe written as an expression in Boolean Algebra using AND, OR, NOT.

    How do we convert from one to the other?

  • 8/8/2019 boolean algibra

    7/20

    Fall 2002 EECS150 Lec4-bool1 Page 7, 9/5 9am

    Notes on Example #1

    The example is the standardfunction called exclusive-or

    (XOR,EXOR)

    Has a standard algebraic

    symbol:

    And a standard gate symbol:

    x0 x1 y

    0 0 00

    00

    1 1

    111 1

  • 8/8/2019 boolean algibra

    8/20

    Fall 2002 EECS150 Lec4-bool1 Page 8, 9/5 9am

    CL Block Example #2

    4-bit adder:

    R = A + B,

    c is carry out

    Truth Table Representation:

    In general: 2n rows for n inputs.

    Is there a more efficient (compact) way to specify this function?

    256 rows!

  • 8/8/2019 boolean algibra

    9/20

    Fall 2002 EECS150 Lec4-bool1 Page 9, 9/5 9am

    4-bit Adder Example

    Motivate the adder circuit designby hand addition:

    Add a0 and b0 as follows:

    Add a1 and b1 as follows:

    carry to

    next stage

    r = a XOR b

    c = a AND b = ab r = a XOR b XOR ci

    co = ab + aci + bci

  • 8/8/2019 boolean algibra

    10/20

    Fall 2002 EECS150 Lec4-bool1 Page 10, 9/5 9am

    4-bit Adder Example

    In general:ri = ai XOR bi XOR cin

    cout = aicin + aibi + bicin = cin(ai + bi) + aibi

    Now, the 4-bit adder: Full adder cell

    ripple adder

  • 8/8/2019 boolean algibra

    11/20

    Fall 2002 EECS150 Lec4-bool1 Page 11, 9/5 9am

    4-bit Adder Example

    Graphical Representation of FA-cellri = ai XOR bi XOR cin

    cout = aicin + aibi + bicin

    Alternative Implementation(with 2-input gates):

    ri = (ai XOR bi) XOR cin

    cout = cin(ai + bi) + aibi

  • 8/8/2019 boolean algibra

    12/20

    Fall 2002 EECS150 Lec4-bool1 Page 12, 9/5 9am

    Boolean Algebra

    Defined as: { }{ }

    .0,1

    :Complement.6

    .)(),()()(

    :lawsveDistributi5.

    .1,0

    in1,0:Identities.4

    .,

    :lawseCommunitiv3.

    .in,in,in

    ,in:Closure2.

    .such thatelementsleast twoatcontains1.

    :holdaxiomsfollowingthesuch that,operationunary,,operatorsbinary,elementsofSet

    ==+

    +=+++=+

    ==+

    =+=+

    +

    +

    aaaa

    cabacbacabacba

    aaaa

    B

    abbaabba

    BaBbaBba

    Ba,b

    baa,bB

    B

  • 8/8/2019 boolean algibra

    13/20

    Fall 2002 EECS150 Lec4-bool1 Page 13, 9/5 9am

    Logic Functions

    Do the axioms hold?

    Ex: communitive law: 0+1 = 1+0?

    Algebra.Booleanvalidais

    NOTAND,OR,},1,0{ ===+=B

    00 001 110 111 1

    00 001 010 011 1

    0 11 0

  • 8/8/2019 boolean algibra

    14/20

    Fall 2002 EECS150 Lec4-bool1 Page 14, 9/5 9am

    Theorem: Any Boolean function that can be expressed as a truth

    table can be expressed using NAND and NOR.

    Proof sketch:

    How would you show that either NAND or NOR is sufficient?

    Other logic functions of 2 variables (x,y)x y f0 f1

    00 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 101 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 110 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 111 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

    0 AND X Y + OR NOR XNOR NAND 1

    Look at NOR and NAND:

    = NOT = AND

    = OR

  • 8/8/2019 boolean algibra

    15/20

    Fall 2002 EECS150 Lec4-bool1 Page 15, 9/5 9am

    Laws of Boolean AlgebraDuality: A dual of a Boolean expression is derived by interchanging OR

    and AND operations, and 0s and 1s (literals are left unchanged).

    )},,0,1,,...,,({)},,1,0,,...,,({ 2121 +=+ nD

    nxxxFxxxF

    Any law that is true for an expression is also true for its dual.

    Operations with 0 and 1:

    1. x + 0 = x x * 1 = x

    2. x + 1 = 1 x * 0 = 0

    Idempotent Law:3. x + x = x x x = x

    Involution Law:

    4. (x) = x

    Laws of Complementarity:5. x + x = 1 x x = 0

    Commutative Law:

    6. x + y = y + x x y = y x

  • 8/8/2019 boolean algibra

    16/20

    Fall 2002 EECS150 Lec4-bool1 Page 16, 9/5 9am

    Laws of Boolean Algebra (cont.)

    Associative Laws:

    (x + y) + z = x + (y + z) x y z = x (y z)

    Distributive Laws:

    x (y + z) = (x y) + (x z) x +(y z) = (x + y)(x + z)

    Simplification Theorems:x y + x y = x (x + y) (x + y) = xx + x y = x x (x + y) = x

    DeMorgans Law:

    (x + y + z + ) = xyz (x y z ) = x + y +z

    Theorem for Multiplying and Factoring:(x + y) (x + z) = x z + x y

    Consensus Theorem:x y + y z + x z = (x + y) (y + z) (x + z)

    x y + x z = (x + y) (x + z)

  • 8/8/2019 boolean algibra

    17/20

    Fall 2002 EECS150 Lec4-bool1 Page 17, 9/5 9am

    Proving Theorems via axioms of Boolean

    Algebra

    Ex: prove the theorem: x y + x y = x

    x y + x y = x (y + y) distributive law

    x (y + y) = x (1) complementary law

    x (1) = x identity

    Ex: prove the theorem: x + x y = x

    x + x y = x 1 + x y identity

    x 1 + x y = x (1 + y) distributive law

    x (1 + y) = x (1) identity

    x (1) = x identity

  • 8/8/2019 boolean algibra

    18/20

    Fall 2002 EECS150 Lec4-bool1 Page 18, 9/5 9am

    DeMorgans Law

    * DeMorgans Law can be used to convert AND/OR expressions to

    OR/AND expressions:Example: z = abc + abc + abc + abc

    z = abc + abc + abc + abc

    x y x' y' (x + y)' x'y'

    0 0 1 1 1 10 1 1 0 0 01 0 0 1 0 01 1 0 0 0 0

    x y x' y' (x y)' x' + y'

    0 0 1 1 1 10 1 1 0 1 1

    1 0 0 1 1 11 1 0 0 0 0

    (x + y) = x y

    =

    (x y) = x + y

    =

    Exhaustive

    Proof

    Exhaustive

    Proof

  • 8/8/2019 boolean algibra

    19/20

    Fall 2002 EECS150 Lec4-bool1 Page 19, 9/5 9am

    Algebraic Simplification

    Ex: full adder (FA) carry out function

    Cout = abc + abc + abc + abc

  • 8/8/2019 boolean algibra

    20/20

    Fall 2002 EECS150 Lec4-bool1 Page 20, 9/5 9am

    Algebraic Simplification

    Ex: full adder (FA) carry out functionCout = abc + abc + abc + abc

    = abc + abc + abc + abc + abc

    = abc + abc + abc + abc + abc

    = (a + a)bc + abc + abc + abc

    = (1)bc + abc + abc + abc

    = bc + abc + abc + abc + abc

    = bc + abc + abc + abc + abc

    = bc + a(b +b)c + abc +abc

    = bc + a(1)c + abc + abc

    = bc + ac + ab(c + c)= bc + ac + ab(1)

    = bc + ac + ab