![]() |
|
|
|
#1 |
|
Hello,
I want to write a simple test benchmark I want to generate all possible bit combinations for bit_vector(7 downto 0) through an integer variable eg for i in 0 to 255 loop bv <= convert(8, i); -- 8 width, and i value end loop; is there some convert function for this purpose? I couldn't find it using google too much information but not what I am looking for Regards, Daniel =?ISO-8859-1?Q?Sch=FCle_Daniel?= |
|
|
|
|
#2 |
|
Posts: n/a
|
Assuming 'bv' is std_logic_vector(7 downto 0)...
And you include the IEEE numeric_std library... library IEEE; use IEEE.numeric_std.all; then.... for i in 0 to 255 loop bv <= std_logic_vector(to_unsigned(i, bv'length)); -- 8 width, and i value end loop; KJ KJ |
|
|
|
#3 |
|
Posts: n/a
|
Oops...just noticed that you wanted 'bv' to be a bit_vector....well, you can
work out that last conversion I'm sure. KJ "KJ" <> wrote in message news:OaKeg.35999$ om... > Assuming 'bv' is std_logic_vector(7 downto 0)... > > And you include the IEEE numeric_std library... > library IEEE; > use IEEE.numeric_std.all; > > then.... > for i in 0 to 255 loop > bv <= std_logic_vector(to_unsigned(i, bv'length)); -- 8 width, and i > value > end loop; > > KJ > KJ |
|
|
|
#4 |
|
Posts: n/a
|
First nclude the IEEE numeric_std library...
library IEEE; use IEEE.numeric_std.all; then.... for i in 0 to 255 loop bv <= bit_vector(to_unsigned(i, bv'length)); -- 8 width, and i value end loop; KJ KJ |
|
|
|
#5 |
|
Posts: n/a
|
Use numeric_bit instead of numeric_std package.
It defines signed and unsigned vectors of bit instead of std_logic. So type conversions from numeric_bit.unsigned to bit are allowed: bit_vector(unsigned(int_val)) works as long as numeric_bit is used. Andy KJ wrote: > First nclude the IEEE numeric_std library... > library IEEE; > use IEEE.numeric_std.all; > > then.... > > for i in 0 to 255 loop > bv <= bit_vector(to_unsigned(i, bv'length)); -- 8 width, and i value > end loop; > > KJ Andy |
|
|
|
#6 |
|
Posts: n/a
|
thx, it works fine
=?ISO-8859-1?Q?Sch=FCle_Daniel?= |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to convert string contain Hex data into integer | asifjavaid | Software | 0 | 09-09-2008 08:50 AM |
| Newbie; what is the best software to convert DVD (Vob) file to avi - divx ? | Laura25 | DVD Video | 4 | 07-12-2006 03:03 PM |
| NEWBIE - DVD burn problem - need help | Vic Baron | DVD Video | 6 | 09-29-2005 10:56 PM |
| Heeeeeeelp... Newbie with avi to dvd (or svcd) please. | Mike | DVD Video | 11 | 08-14-2004 09:04 PM |
| Newbie Pioner 3100 help | oespelan | DVD Video | 3 | 07-19-2004 04:30 AM |