dld lecture 2

Upload: hammna-ashraf

Post on 04-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 DLD Lecture 2

    1/48

    Amina Asghar

    Boolean Algebra and Logic Gates

  • 7/29/2019 DLD Lecture 2

    2/48

    Binary (Boolean) Logic

    y Deals with binary variables and binary logic functions

    y Has two discrete values

    y 0False,Open

    y1True,Close

    y Three basic logical operations

    y AND (.); OR (+); NOT ()

  • 7/29/2019 DLD Lecture 2

    3/48

    Logic Gates and Truth Table

  • 7/29/2019 DLD Lecture 2

    4/48

    Boolean Algebra

    y Branch of Algebra used for describing and designing two

    valued state variables

    y Introduced by GeorgeBoole in 19th centaury

    yShannon used it to design switching circuits (1938)

  • 7/29/2019 DLD Lecture 2

    5/48

    Boolean Algebra Postulatesy An algebraic structure defined by a set ofelements,B,

    together with two binary operators + and . that satisfythe]following postulates:

    y Postulate1:

    y Closure with respect to both +

    y Closure with respect to both .

    y Postulate 2:

    y An identity element with respect to +, designated by 0 ( x+0

    = 0+x = x)y An identity element with respect to . designated by 1 ( x.1=1.x = x)

  • 7/29/2019 DLD Lecture 2

    6/48

    y Postulate3:y Commutative with respect to + ( x+y = y+x)y Commutative with respect to . ( x.y = y.x)

    y Postulate 4:y

    . is distributive over + ( x.(y+z) = (x.y)+(y.z) )y + is distributive over . ( x+(y.z) = (x+y).(y+z) )

    y Postulate 5:y For each element a ofB, thereexist an element a such that

    y a + a = 1

    y a. a = 0

    y Postulate 6:y Thereexists at least two elements a, b in B, such that a b

  • 7/29/2019 DLD Lecture 2

    7/48

    Boolean Algebra - Theorems

    Theorems help us out in manipulating Boolean expression

    They must be proven from other postulates or already proven theorems

    Theorems help us out in manipulating Boolean expression

    They must be proven from other postulates or already proven theorems

  • 7/29/2019 DLD Lecture 2

    8/48

    Duality Principle of Boolean Algebra

    y Duality Principle says that every algebraic expression

    deducible from the postulates ofBoolean algebra remains

    valid if theoperators and identity of elements are

    interchanged.

    y In two valued Boolean algebra, the identity elements and

    elements of set B are same: 1 & 0

    y If dual of algebraic expression is required, we simply

    interchange OR and AND operators.

  • 7/29/2019 DLD Lecture 2

    9/48

    Lets prove the following theorems using

    postulates/ proven theorems

    y Theorem 1(a): x+x=x

    y Theorem 1(b): x.x=x by duality

    y Theorem 2(a): x+1=1

    y Theorem 2(b): x.0=0 by dualityy Theorem 3: (x)=x

    y Theorem 6(a): x+xy=x

    y Theoem 6(b)= x(x+y)=x by duality

    The theorems ofBoolean algebra can also be shown true by means of truth

    table

  • 7/29/2019 DLD Lecture 2

    10/48

    Operator Precedence for Boolean

    Expression

    y Parentheses

    y NOT

    y AND

    y OR

  • 7/29/2019 DLD Lecture 2

    11/48

    Boolean Functions

    y A Boolean function is an expression formed with binary

    variables, binary operators OR and AND, unary operator

    NOT, parentheses and equal sign.

    y

    Examplesy F

    1= xyz

    y F2= x + yz

    y F3= xyz + xyz + xy

  • 7/29/2019 DLD Lecture 2

    12/48

    y A Boolean function may also be represented by truth table

    Same functions

  • 7/29/2019 DLD Lecture 2

    13/48

    Representation of Boolean function by

    logical diagram

  • 7/29/2019 DLD Lecture 2

    14/48

    Implementation of which function

    requires less gates F3 or F4??

  • 7/29/2019 DLD Lecture 2

    15/48

    Algebraic Manipulationsy Literal primed or unprimed variable

    y When Boolean function is implemented with logic gates,eachliteral in the function is designated as input to gate and each termis implemented with a gate.

    y Complex Boolean function --- large number of gates

    y To get simpler circuits, one must know hoe to manipulateBoolean functions to obtain equal and simpler expression.y Literal minimization and term minimizationy We can do the literal minimization by applying algebraic

    manipulationsby employing postulates and basic theorems.

    y Term minimization will be discussed later.

  • 7/29/2019 DLD Lecture 2

    16/48

    Examples

    y Simplify the following

    y x + xy

    y x (x+ y)

    y xyz + xyz + xyy xy + xz + yz

    yy ((x+yx+y) () (x+zx+z) () (y+zy+z))

  • 7/29/2019 DLD Lecture 2

    17/48

    Complement of a Function

    y F is a complement ofF and is obtained by an interchange of

    0s for 1s and 1s for 0s.

    y Complement of function can be obtained by De Morgans

    theorem

  • 7/29/2019 DLD Lecture 2

    18/48

  • 7/29/2019 DLD Lecture 2

    19/48

    Example

    y Find the complement of the following functions by applying

    De Morgans theorem as many times as necessary.

    y F1= xyz + xyz

    y F2= x (yz+ yz)

  • 7/29/2019 DLD Lecture 2

    20/48

    Example

    y Find the complement of following functions by taking their

    dual and complementing each literal.

    y F1= xyz + xyz

    y F2= x (yz+ yz)

  • 7/29/2019 DLD Lecture 2

    21/48

    Canonical forms of Expressiony We can writeexpressions in many ways, but some ways are more useful than

    others

    y A sum of products (SOP) expression contains:

    y Only OR (sum) operations at the outermost level

    y

    Each term that is summed must be a product of literalsy The advantage is that any sum of products expression can be implemented using

    a two-level circuit

    y literals and their complements at the 0th level

    y AND gates at the first level

    y a single OR gate at the second level

  • 7/29/2019 DLD Lecture 2

    22/48

    Minterms

    Primed variable corresponds

    to 0

    and unprimed correspond

    to 1

    Primed variable corresponds

    to 0

    and unprimed correspond

    to 1

  • 7/29/2019 DLD Lecture 2

    23/48

    Sum of Minterms form

  • 7/29/2019 DLD Lecture 2

    24/48

    The dual idea

  • 7/29/2019 DLD Lecture 2

    25/48

    Maxtems

    Primed variable

    corresponds to 1 andunprimed corresponds

    to 0

    Primed variable

    corresponds to 1 andunprimed corresponds

    to 0

  • 7/29/2019 DLD Lecture 2

    26/48

    Product of Maxterms form

  • 7/29/2019 DLD Lecture 2

    27/48

    Minterms and Maxterms are related

  • 7/29/2019 DLD Lecture 2

    28/48

    Converting between Canonical forms

  • 7/29/2019 DLD Lecture 2

    29/48

    Sum of Minterms

    y We investigated that

    y For n variables there are 2n minterms

    y Any boolean function can be described in terms of sum of

    minterms

    y The function can beeither 1 or 0 for each minterm, and

    since there 2n minterms, therefore the possible functions that

    can be formed with n variables are 22n

  • 7/29/2019 DLD Lecture 2

    30/48

    Expressing the Boolean function as

    sum of minterms

    y Expand theexpression into sum of minterms

    y Each term is inspected to check that it contains all the variables

    y If the term misses any variable then it is ANDed with an expression such

    as x+x,where x is the missing variable

  • 7/29/2019 DLD Lecture 2

    31/48

    Example

  • 7/29/2019 DLD Lecture 2

    32/48

  • 7/29/2019 DLD Lecture 2

    33/48

    Expressing the function in terms of

    product of Maxterms

    y Each 22n functions of n variables can also beexpressed as a

    product of maxterms

    y To express a function in terms of product of maxterms

    y

    It must first rewritten as OR terms by using distributive lawx+yz=(x+y)(x+z)

    y Then the missing variable in each term is ORed with xx

  • 7/29/2019 DLD Lecture 2

    34/48

    Example

  • 7/29/2019 DLD Lecture 2

    35/48

  • 7/29/2019 DLD Lecture 2

    36/48

    Standard forms of Expression

    y In standard forms, terms may have one, two or any number

    of literals

    y Sum of products is a Boolean expression containing AND

    terms of one or more literals each.The sum denotes the

    ORing of these terms.

    y Product of sums is a Boolean expression containing OR

    terms of one or more literals each.T

    he product denotes theANDing of these terms

  • 7/29/2019 DLD Lecture 2

    37/48

    Non standard form

    y Sometimes expression is neither sum of products or product

    of sums.This is non standard form.

    y It can be changed into standard form by using distributive

    law .

  • 7/29/2019 DLD Lecture 2

    38/48

  • 7/29/2019 DLD Lecture 2

    39/48

  • 7/29/2019 DLD Lecture 2

    40/48

    Digital Logic Gates

  • 7/29/2019 DLD Lecture 2

    41/48

  • 7/29/2019 DLD Lecture 2

    42/48

  • 7/29/2019 DLD Lecture 2

    43/48

    0

  • 7/29/2019 DLD Lecture 2

    44/48

  • 7/29/2019 DLD Lecture 2

    45/48

  • 7/29/2019 DLD Lecture 2

    46/48

  • 7/29/2019 DLD Lecture 2

    47/48

  • 7/29/2019 DLD Lecture 2

    48/48