Multi-Output Multiplexer

Discussion in 'Homework Help' started by steve2, Feb 6, 2011.

  1. steve2

    Thread Starter New Member

    Feb 6, 2011
    3
    0
    I'm trying to design a 3 bit number comparer, but I'm not sure how to output what I want since it would be the larger number.

    My algorithm is simple:

    if (a2 > b2):
    return (a2, a1, a0)
    else if (b2 > a2)
    return (b2, b1, b0)
    else if (a1 > b1):
    return (a2, a1, a0)
    else if (b1 > a1)
    return (b2, b1, b0)
    else if (a0 > b0)
    return (a2, a1, a0)
    else:
    return (b2, b1, b0)

    What type of gate could I use that would allow me to return 3 bits?

    Thanks
     
  2. narasimhan

    Member

    Dec 3, 2009
    72
    6
    A normal multiplexer is a 1 bit mux which outputs only a single bit. You can use an n-bit mux to output n bits.

    Buy I guess a 3 bit comparator requires only a few gates like AND and XNOR. In digital design morris mano book there is an example of 3-bit comparator using gates. Check it out
     
  3. steve2

    Thread Starter New Member

    Feb 6, 2011
    3
    0
    you wouldn't happen to have the page number would you?
     
  4. narasimhan

    Member

    Dec 3, 2009
    72
    6
    163-165 2nd edition morris mano "digital design". Heading is "magnitude comparator"
     
  5. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
  6. steve2

    Thread Starter New Member

    Feb 6, 2011
    3
    0
    This sort of works, but I really need the actual vector of bits. Is it possible to do?
     
  7. Georacer

    Moderator

    Nov 25, 2009
    5,142
    1,266
    Oh, I get what you want. Use the output of the suggested circuit to drive a triple 2-to-1 MUX. That will select between your two outputs.

    Is that clear?
     
Loading...