lec02 logic gates

Upload: tim-baker

Post on 06-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Lec02 Logic Gates

    1/23

    CSSE1000 Lecture 2

    Intro to Logic Gates

    School of Information Technology and Electrical EngineeringThe University of Queensland

  • 8/2/2019 Lec02 Logic Gates

    2/23

    Admin Issues

    Circuit Schematics

    Boolean Algebra

    If you have questions, ask them at anyme

    2

  • 8/2/2019 Lec02 Logic Gates

    3/23

    Digital circuits

    Only two logical levels present (i.e. binary)0 usually small voltage (e.g. around 0 volts)

    1 usually larger voltage (e.g. 1.5 to 5 volts, dependingon the logic family, i.e. type/size of transistors)

    Logic gates are the building blocks of computers;

    Each gate has one or more inputs

    perform operations (or functions) e.g.: NOT, AND, OR, NAND, NOR gates

    5

    Inputs and outputs can have only two states, 1 and 0 Can be called true and false

  • 8/2/2019 Lec02 Logic Gates

    4/23

    NOT gate inverts the signal

    If A is 0 X is 1

    A X

    This is thes y m b o l for

    If A is 1, X is 0 Gates o eration can be re resented usin a

    a NOT gate

    truth table:A X

    1 0Input Output

    6

  • 8/2/2019 Lec02 Logic Gates

    5/23

    Output is 1 if all inputs are 1, i.e. ifin ut A a n d in ut B

    a n d input Ca n d areall 1, t he output is 1 Logic symbol

    Truth Table

    A B X

    2-input AND gate The opposite is a

    A X 0 1 0

    1 0 0

    NAND gate (output

    is 0 if all inputs are 1)

    1 1 1

    NANDA

    X

    0 0 1

    0 1 1A

    X

    7

    B

    1 1 0B

    Bubble m eans inversion

  • 8/2/2019 Lec02 Logic Gates

    6/23

    Output is 1 if at least one of the inputs is 1 i.e. ifin ut A o r in ut B

    o r input Co r is 1,the output is 1

    Logic symbolru a e

    A B X

    0 0 0OR

    2-input OR gate The opposite is a

    0 1 11 0 1

    1 1 1B

    X

    NORgate (output

    is 0 if any input is 1)NOR

    AXX

    ORA

    0 0 1

    0 1 0

    9

    B

    Bubble m eans inversion

    B1 1 0

  • 8/2/2019 Lec02 Logic Gates

    7/23

    For a 2-input gate Out ut is 1 ifexactl one of the in uts is 1

    Lo ic s mbolTruth Table

    A

    BX

    0 0 0

    0 1 1

    1 1 10This entry is the

    difference between For > 2 inputs

    Output is 1 if an odd number of inputs is 1

    10

    Sometimes called the odd function

  • 8/2/2019 Lec02 Logic Gates

    8/23

    Logic functions can be expressed

    variables, e.g. A B X

    unc ons, e.g. + .Rules about how this works called

    Boolean algebra

    take on values 0 or 1

    12

  • 8/2/2019 Lec02 Logic Gates

    9/23

    r v

    Conventions well use: Inversion: overline

    e.g. NOT(A) =

    AND: dot(.) or implied (by adjacency)

    e.g. AND(A,B) = AB = A.B OR: plus sign

    e.g. OR(A,B,C) = A+B+C

    Other examples:

    NAND(A,B,C) = ABC

    XOR(A,B) = A B = B + AB

    13

    NOR(A,B) = A+B

  • 8/2/2019 Lec02 Logic Gates

    10/23

    Summar of Lo ic FunctionRepresentations

    There are four representations of logic

    functions assume function ofn in uts Truth table

    Lists output for all 2n combinations of inputs

    Best to list inputs in a systematic way Boolean function (or equation)

    output is 1

    Lo ic Dia ram Combination of logic symbols joined by wires

    Timing Diagram

    14

  • 8/2/2019 Lec02 Logic Gates

    11/23

    r v

    Inputs are conventionally on left Outputs are

    conventionally

    A

    on right

    BM

    ElectricalConnection

    No Connection Lines represent electricalwires. Can be at hi h or

    15

    low potential (logic 1 orlogic 0 respectively).

  • 8/2/2019 Lec02 Logic Gates

    12/23

    Gates onIntegrated Circuits (ICs)

    14 13 12 11 10 9

    VCC

    8

    n spac ng s .

    x 0.3; chip is about1 2 3 4 5 6 7

    GND

    74LS00 has four 2-input NAND gates

    16

    . . ,

  • 8/2/2019 Lec02 Logic Gates

    13/23

    More than a logic diagram, a circuit schematic tells

    you how to build the circuit

    ICs are labelled U1, U2 etc (Other components also labelled)T e of IC iven also e. . 74LS00 or 74HCT00

    Outputs labelled

    Connectionswhich arentpart of the

    Pin numbers are iven

    separately

    17

    Inputs are labelled

  • 8/2/2019 Lec02 Logic Gates

    14/23

    Lo ic FunctionImplementation

    Any logic function can be implemented as

    the OR f AND c mbinati ns f the in uts Called sum of products

    Consider truth table

    A B C

    0 0 0M

    0

    ,write down the AND combination

    of in uts that ive that 1

    0 1 0

    0 1 1

    0

    1

    OR these together 1 0 1

    1 1 0

    1

    1

    19

    1 1 1 1

  • 8/2/2019 Lec02 Logic Gates

    15/23

    Lo ic FunctionImplementation

    A B C

    0 0 0

    M

    00 0 1

    0 1 0

    0 1 1

    0

    0

    1

    1 0 0

    1 0 1

    1 1 0

    0

    1

    1

    1 1 1 1

    20

  • 8/2/2019 Lec02 Logic Gates

    16/23

    Exam le cont.Equivalent Logic Diagram

    A

    A

    B C A B C

    M = ABC + ABC + ABC + ABC

    A

    A B C4

    A B C5

    M8B

    2

    C

    A B C

    6

    21

    A B C7C

    3

  • 8/2/2019 Lec02 Logic Gates

    17/23

    Sum of products does not necessarily produce circuit

    with minimum number of gatesfunction Use rules of Boolean algebra (next slide)

    Example: Z = AB + AC = A(B+C)

    A AB

    A A(B + C)

    B

    AB + AC

    C

    B

    B + CC AC

    22Fewer gates

  • 8/2/2019 Lec02 Logic Gates

    18/23

    = + =

    Name AND form OR form

    Null law

    0A = 0

    1 + A = 1

    Inverse law

    = =

    AA = 0 A + A = 1

    Commutative law

    Associative law

    AB = BA

    (AB)C = A(BC)

    A + B = B + A

    (A + B) + C = A + (B + C)

    Distributative law

    Absorption law

    A + BC = (A + B)(A + C)

    A(A + B) = A A + AB = A

    A(B + C) = AB + AC

    23De Morgan's law AB = A + B A + B = AB

  • 8/2/2019 Lec02 Logic Gates

    19/23

    Express Z = A(B+C(A + B)) as a sum

    24

  • 8/2/2019 Lec02 Logic Gates

    20/23

    r w u v

    AND/OR can be interchanged if you invert

    the inputs and outputsAB = A + B A + B = AB

    (a) (b)

    A + BAB = AB=A + B

    (c) (d)

    25

    Homework: Use truth tables to convinceyourself that these are valid

  • 8/2/2019 Lec02 Logic Gates

    21/23

    All circuits can be constructed from NAND or NOR gates

    These are called complete gates Exam les:

    NOT AND OR

    A + BAB

    AB

    B

    A A

    A+

    B

    BA

    A

    27

    Reason: Easier to build NAND and NOR gates fromtransistors

  • 8/2/2019 Lec02 Logic Gates

    22/23

    A B XOR

    0 0 0

    A

    B

    0 1 1

    1 0 1 A

    On any wire, you can introduce a

    1 1 0

    A

    B

    A

    B

    AA

    28

    BB

  • 8/2/2019 Lec02 Logic Gates

    23/23

    Go through the course profile

    Do the reading if you havent already Do the homework (due at Prac sessions)

    Sign-up (via session change request form) for

    rac sess on

    Tutorial session

    30