41
ECE 331 – Digital System Design Multiplexers and Demultiplexers, and Encoders and Decoders (Lecture #15) The slides included herein were taken from the materials accompanying Fundamentals of Logic Design, 6 th Edition, by Roth and Kinney, and were used with permission from Cengage Learning.

MUX e Decoder

Embed Size (px)

DESCRIPTION

MUX e DECODER

Citation preview

  • ECE 331 Digital System Design

    Multiplexers and Demultiplexers,and

    Encoders and Decoders

    (Lecture #15)

    The slides included herein were taken from the materials accompanying

    Fundamentals of Logic Design, 6th Edition, by Roth and Kinney,

    and were used with permission from Cengage Learning.

  • Multiplexers

    Fall 2010 ECE 331 - Digital System Design 2

  • Multiplexers

    A multiplexer has

    N control inputs N control inputs

    2N data inputs

    1 output

    A multiplexer routes (or connects) the selected data input to the output.

    Fall 2010 ECE 331 - Digital System Design 3

    The value of the control inputs determines the data input that is selected.

  • Multiplexers

    Data

    Fall 2010 ECE 331 - Digital System Design 4

    Z = A.I0

    + A.I1

    Data

    inputs

    Control

    input

  • Multiplexers

    A B F

    0 0 I0

    0 1 I1

    1 0 I2

    1 1 I3

    MSB LSB

    Fall 2010 ECE 331 - Digital System Design 5

    Z = A.B'.I0

    + A'.B.I1

    + A.B'.I2

    + A.B.I3

  • Multiplexers

    A B C F

    0 0 0 I0

    0 0 1 I0 0 1 I1

    0 1 0 I2

    0 1 1 I3

    1 0 0 I4

    1 0 1 I5

    1 1 0 I6

    1 1 1 I7

    Fall 2010 ECE 331 - Digital System Design 6

    Z = A.B'.C'.I0

    + A'.B'.C.I1

    + A'.B.C'.I2

    + A'.B.C.I3

    +

    A.B'.C'.I0

    + A.B'.C.I1

    + A'.B.C'.I2

    + A.B.C.I3

    MSB LSB

  • Multiplexers

    Fall 2010 ECE 331 - Digital System Design 7

  • 8-to-1 Multiplexer in VHDL

    Fall 2010 ECE 331 - Digital System Design 8

  • 8-to-1 Multiplexer in VHDL

    Fall 2010 ECE 331 - Digital System Design 9

  • Multiplexer (Bus)

    Fall 2010 ECE 331 - Digital System Design 10

  • Demultiplexers

    Fall 2010 ECE 331 - Digital System Design 11

  • Demultiplexers

    A demultiplexer has

    N control inputs

    1 data input

    2N outputs

    A demultiplexer routes (or connects) the data input to the selected output.

    The value of the control inputs determines the output that is selected.

    Fall 2010 ECE 331 - Digital System Design 12

    that is selected.

    A demultiplexer performs the opposite function of a multiplexer.

  • Demultiplexers

    W = A'.B'.I

    X = A.B'.I

    Out0

    InI

    W

    X

    Y

    Out1

    A B W X Y Z

    0 0 I 0 0 0

    X = A.B'.I

    Y = A'.B.I

    Z = A.B.I

    In

    S1 S0

    IY

    Z

    A B

    Out2

    Out3

    Fall 2010 ECE 331 - Digital System Design 13

    0 0 I 0 0 0

    0 1 0 I 0 0

    1 0 0 0 I 0

    1 1 0 0 0 I

  • Decoders

    Fall 2010 ECE 331 - Digital System Design 14

  • Decoders A decoder has

    N inputs

    2N outputs

    A decoder selects one of 2N outputs by decoding the binary value on the N inputs.

    The decoder generates all of the minterms of the N input variables.

    Fall 2010 ECE 331 - Digital System Design 15

    the N input variables.

    Exactly one output will be active for each combination of the inputs.

    What does active mean?

  • Decoders

    BW

    XI0

    Out0

    Out

    W = A'.B'

    X = A.B'

    A B W X Y Z

    0 0 1 0 0 0

    Active-high outputs

    B X

    Y

    Z

    I0

    I1A

    Out1

    Out2

    Out3

    X = A.B'

    Y = A'.B

    Z = A.Bmsb

    Fall 2010 ECE 331 - Digital System Design 16

    0 0 1 0 0 0

    0 1 0 1 0 0

    1 0 0 0 1 0

    1 1 0 0 0 1

  • Decoders

    W = (A'.B')'

    X = (A.B')'BW

    XI0

    Out0

    Out

    A B W X Y Z

    0 0 0 1 1 1

    Active-low outputs

    X = (A.B')'

    Y = (A'.B)'

    Z = (A.B)'msb

    B X

    Y

    Z

    I0

    I1A

    Out1

    Out2

    Out3

    Fall 2010 ECE 331 - Digital System Design 17

    0 0 0 1 1 1

    0 1 1 0 1 1

    1 0 1 1 0 1

    1 1 1 1 1 0

  • Decodersmsb

    Fall 2010 ECE 331 - Digital System Design 18

  • 3-to-8 Decoder in VHDL

    Fall 2010 ECE 331 - Digital System Design 19

  • 3-to-8 Decoder in VHDL

    Fall 2010 ECE 331 - Digital System Design 20

  • Decoder with Enable

    high-levelB

    W

    XI0

    Out0

    Out

    En A B W X Y Z

    1 0 0 1 0 0 0

    1 0 1 0 1 0 0

    high-levelenable

    Enable

    X

    Y

    Z

    I1AOut1

    Out2

    Out3En

    Fall 2010 ECE 331 - Digital System Design 21

    1 0 1 0 1 0 0

    1 1 0 0 0 1 0

    1 1 1 0 0 0 1

    0 x x 0 0 0 0

    enabled

    disabled

  • Decoder with Enable

    BW

    XI0

    Out0

    Outlow-level

    En A B W X Y Z

    0 0 0 1 0 0 0

    0 0 1 0 1 0 0

    Enable

    X

    Y

    Z

    I1AOut1

    Out2

    Out3En

    low-levelenable

    Fall 2010 ECE 331 - Digital System Design 22

    0 0 1 0 1 0 0

    0 1 0 0 0 1 0

    0 1 1 0 0 0 1

    1 x x 0 0 0 0

    enabled

    disabled

  • 2-to-4 Decoder with Enable in VHDL

    Fall 2010 ECE 331 - Digital System Design 23

  • Encoders

    Fall 2010 ECE 331 - Digital System Design 24

  • Encoders An encoder has

    2N inputs

    N outputs N outputs

    An encoder outputs the binary value of the selected (or active) input.

    An encoder performs the inverse operation of a decoder.

    Issues

    Fall 2010 ECE 331 - Digital System Design 25

    Issues

    What if more than one input is active?

    What if no inputs are active?

  • Encoders

    D

    Z

    I0

    IC Out0

    A B C D Y Z

    0 0 0 1 0 0

    Z

    YI1C

    B I2

    I3A

    Out0Out1

    Fall 2010 ECE 331 - Digital System Design 26

    0 0 0 1 0 0

    0 0 1 0 0 1

    0 1 0 0 1 0

    1 0 0 0 1 1

  • Priority Encoders

    If more than one input is active, the higher-order input has priority over the lower-order input.input has priority over the lower-order input.

    The higher value is encoded on the output

    A valid indicator, d, is included to indicate whether or not the output is valid.

    Output is invalid when no inputs are active

    d = 0

    Fall 2010 ECE 331 - Digital System Design 27

    d = 0

    Output is valid when at least one input is active

    d = 1Why is the valid indicator needed?

  • Priority Encoders

    msb

    Valid bit

    Fall 2010 ECE 331 - Digital System Design 28

  • LIBRARY ieee ;

    USE ieee.std_logic_1164.all ;

    VHDL: 4-to-2 Priority Encoder

    4 input bits

    ENTITY priority IS

    PORT ( w : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ;

    y : OUT STD_LOGIC_VECTOR(1 DOWNTO 0) ;

    z : OUT STD_LOGIC ) ;

    END priority ;

    ARCHITECTURE Behavior OF priority IS

    BEGIN

    y

  • Designing logic circuits using multiplexers

    Fall 2010 ECE 331 - Digital System Design 30

  • Using an n-input Multiplexer Use an n-input multiplexer to realize a logic circuit for

    a function with n minterms.

    m = 2n, where m = # of variables in the function m = 2n, where m = # of variables in the function

    Each minterm of the function can be mapped to an input of the multiplexer.

    For each row in the truth table, for the function, where the output is 1, set the corresponding input of the multiplexer to 1.

    Fall 2010 ECE 331 - Digital System Design 31

    the multiplexer to 1.

    That is, for each minterm in the minterm expansion of the function, set the corresponding input of the multiplexer to 1.

    Set the remaining inputs of the multiplexer to 0.

  • Using an n-input Mux

    Example:

    Using an 8-to-1 multiplexer, design a logic circuit to realize the following Boolean function

    F(A,B,C) = m(2, 3, 5, 6, 7)

    Fall 2010 ECE 331 - Digital System Design 32

    F(A,B,C) = m(2, 3, 5, 6, 7)

  • Using an n-input Mux

    Example:

    Using an 8-to-1 multiplexer, design a logic circuit to realize the following Boolean function

    F(A,B,C) = m(1, 2, 4)

    Fall 2010 ECE 331 - Digital System Design 33

    F(A,B,C) = m(1, 2, 4)

  • Using an (n / 2)-input Multiplexer Use an (n / 2)-input multiplexer to realize a logic

    circuit for a function with n minterms.

    m = 2n, where m = # of variables in the function m = 2n, where m = # of variables in the function

    Group the rows of the truth table, for the function, into (n / 2) pairs of rows.

    Each pair of rows represents a product term of (m 1)variables.

    Each pair of rows can be mapped to a multiplexer input.

    Fall 2010 34

    Determine the logical function of each pair of rows in terms of the mth variable.

    If the mth variable, for example, is x, then the possible values are x, x', 0, and 1.

  • Using an (n / 2)-input Mux

    Example: F(x,y,z) = m(1, 2, 6, 7)

    Fall 2010 ECE 331 - Digital System Design 35

  • Using an (n / 2)-input Mux

    Example: F(A,B,C,D) = m(1,3,4,11,1215)

    Fall 2010 ECE 331 - Digital System Design 36

  • Using an (n / 4)-input Mux

    The design of a logic circuit using an (n / 2)-input multiplexer can be easily extended to the use of

    an (n / 4)-input multiplexer.

    Fall 2010 ECE 331 - Digital System Design 37

  • Designing logic circuits using decoders

    Fall 2010 ECE 331 - Digital System Design 38

  • Using an n-output Decoder

    Use an n-output decoder to realize a logic circuit for a function with n minterms.

    Each minterm of the function can be mapped to an output of the decoder.

    For each row in the truth table, for the function, where the output is 1, sum (or OR) the corresponding outputs of the decoder.

    That is, for each minterm in the minterm expansion of the

    Fall 2010 ECE 331 - Digital System Design 39

    That is, for each minterm in the minterm expansion of the function, OR the corresponding outputs of the decoder.

    Leave remaining outputs of the decoder unconnected.

  • Using an n-output Decoder

    Example:

    Using a 3-to-8 decoder, design a logic circuit to realize the following Boolean function

    F(A,B,C) = m(2, 3, 5, 6, 7)

    Fall 2010 ECE 331 - Digital System Design 40

    F(A,B,C) = m(2, 3, 5, 6, 7)

  • Using an n-output Decoder

    Example:

    Using two 2-to-4 decoders, design a logic circuit to realize the following Boolean function

    F(A,B,C) = m(0, 1, 4, 6, 7)

    Fall 2010 ECE 331 - Digital System Design 41

    F(A,B,C) = m(0, 1, 4, 6, 7)