Comparison between std_logic_vectors

E

eneko

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

Mike Treseler

eneko said:
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
 
E

eneko

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top