Comparison between std_logic_vectors

Discussion in 'VHDL' started by eneko, Nov 8, 2004.

  1. eneko

    eneko Guest

    Hello! I`ve a problem which I don´t know how resolve.
    I have two std_logic_vectors with a length of 8.
    I want to compare them getting three bytes of each.
    These three bytes must be More Significant Bits (wich aren´t 0`s) of the
    bigger number.
    Here is an example of I want to do:

    I have the numbers 43 and 15
    (43) 00101011
    (15) 00001111
    I view that the most significant bit is 43`s sixth bit, so,
    I want get (101) from 43 and (001) from 15.

    Which is the simpliest, and fastest (it can be done in cominational mode?
    Is there any function wich returns this?)

    Thanks for all!
     
    eneko, Nov 8, 2004
    #1
    1. Advertising

  2. eneko wrote:

    > I have two std_logic_vectors with a length of 8.


    Where did you find them?

    > must be More Significant Bits (wich aren´t 0`s) of the
    > bigger number.
    > Is there any function wich returns this?


    You could write one.

    A FOR loop from left to right+2
    could watch for a '1' then
    return the bit position (i).

    Another function could slice
    vector values from i downto i-2.

    -- Mike Treseler
     
    Mike Treseler, Nov 8, 2004
    #2
    1. Advertising

  3. eneko

    eneko Guest

    These two std_logic_vectors are input signals.
    Just I thought about these functions,but I thougth if it was some other
    function or way.
    Thanks for all!!
     
    eneko, Nov 8, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    4,785
  2. ohaqqi
    Replies:
    3
    Views:
    8,831
    Daniel Kho
    Oct 18, 2006
  3. Replies:
    5
    Views:
    898
  4. Andy Luotto
    Replies:
    1
    Views:
    537
  5. Richard Nicholas
    Replies:
    11
    Views:
    367
Loading...

Share This Page