I have found a solution. If I want to interpret the data directly in 8-bit parts, I need to use a character type file and convert it to integers using the POS attribute. Then I can convert these integers to bit vectors. Here is how I did it:
LIBRARY ieee; USE ieee.std_logic_1164.ALL; USE ieee.numeric_bit.ALL; LIBRARY std; USE std.textio.all; ... TYPE t_char_file IF FILE OF character; TYPE t_byte_arr IS ARRAY (natural RANGE <>) OF bit_vector(7 DOWNTO 0); SIGNAL read_arr_byte : t_byte_arr(0 to 199); ... read_file: PROCESS (start) IS FILE file_in : t_char_file OPEN read_mode IS "./38478.bin"; -- open the frame file for reading VARIABLE char_buffer : character; BEGIN IF start'EVENT AND start = '1' THEN FOR i IN read_arr_byte'RANGE LOOP read(file_in, char_buffer); read_arr_byte(i) <= bit_vector(to_unsigned(character'POS(char_buffer), 8)); END LOOP; -- i file_close(file_in); END IF; END PROCESS read_file;
source share