Comparison between std_logic_vectors

E

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 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
 
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!!
 

Welcome to EDABoard.com

Sponsor

Back
Top