I just want to..lets say read byte by byte (7 downto 0) chunks from binary file.
Once i read them, i want to put them in big array of bytes. Here is how i do it:
so as u see from the code, what i do is just read 10 chunks from binary file, when startread is LOW, and once it changes to HIGH, i just display the first chunk out of the array.
Now, functionally it seems to work...however i get weird thing in a waveform of modelsim.
Check the attached picture.
You see ?(103) there? so it is the correct byte which is in the file... BUT, i supposed to see it normally not in such a weird way in the waveform... so it seems like it does the job, but for some reason not displayed correctly there..
it shows weird symbols.. and when i change display Radix to Hex, or Dec it displays X'es...
any ideas?
thanks!
Once i read them, i want to put them in big array of bytes. Here is how i do it:
Code:
-- Reading image data from the file and putting it into array
read_to_memory: process (startread)
subtype word is std_logic_vector(7 downto 0);
type storage_array is
array (natural range 0 to 9) of word;
variable storage : storage_array;
variable index : natural;
type load_file_type is file of word;
file load_file : load_file_type open read_mode is "mem.dat";
begin
index := 0;
if startread = '0' then
for i in 0 to 9 loop
read(load_file, storage(i));
index := index + 1;
end loop;
else
pixelcolor <= storage(0);
end if;
end process read_to_memory;
so as u see from the code, what i do is just read 10 chunks from binary file, when startread is LOW, and once it changes to HIGH, i just display the first chunk out of the array.
Now, functionally it seems to work...however i get weird thing in a waveform of modelsim.
Check the attached picture.
You see ?(103) there? so it is the correct byte which is in the file... BUT, i supposed to see it normally not in such a weird way in the waveform... so it seems like it does the job, but for some reason not displayed correctly there..
it shows weird symbols.. and when i change display Radix to Hex, or Dec it displays X'es...
any ideas?
thanks!