conversion function

A

ALuPin

Hi newsgroup,

I have the following piece of code:

use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
....
subtype file_element IS std_logic_vector(7 downto 0);
type header_array IS array(53 downto 0) of file_element;
signal header : header_array;

process(..)
variable next_vector : bit_vector (0 DOWNTO 0);
variable index : integer := 0;
begin
header(index) <= conv_std_logic_vector(bit'pos(next_vector(0)), 8);

end process;


How do I have to code "header(index) <= ..." when using the library
"ieee.numeric_std.all" ?

Thank you for your opinion.

Rgds
 
N

Nicolas Matringe

(e-mail address removed) a écrit :
Hi newsgroup,

I have the following piece of code:

use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
...
subtype file_element IS std_logic_vector(7 downto 0);
type header_array IS array(53 downto 0) of file_element;
signal header : header_array; [...]
begin
header(index) <= conv_std_logic_vector(bit'pos(next_vector(0)), 8);

end process;

How do I have to code "header(index) <= ..." when using the library
"ieee.numeric_std.all" ?

Hello

Define file_element as unsigned instead of std_logic_vector, then use
to_unsigned instead of conv_std_logic_vector

Nicolas
 

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,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top