Re: Who can explain the bit'pos for me?



I got it. Thank you all very much ^_^

D Stanford wrote:
threeinchnail@xxxxxxxxx wrote:
Thank you, Hubble. I understand your explanation..
But I am still confused it a little bit. If I take an example of
bit_vector ("10101010"). I want to convert it to integer. According to
the function:
1. result:=0+0;
2 result:=2*0+1;
3 result:=2*1+0;

For it to function properly, bv'range must be max downto 0. It must be
sequencing from MSB to LSB.

with an input bit vector of "1100"

1. index = 0, result = 0*2 + 1 = 1
2. index = 1, result = 1*2 + 1 = 3
3. index = 2, result = 3*2 + 0 = 6
4. index = 3, result = 6*2 + 0 = 12

.



Relevant Pages