raghava
Member level 2
HI VHDL experts,
I am newbie to VHDL. This task is eating away my time.
I want to read a text file(which consist raster data of an image) and store in memory pixelImage as shown below.
The code is not working.
Please correct it.
Here two for loops are not needed I think. And how to read each pixel. By reading each line then each string from that line. Is it correct.
Any help is appreciated.
******************************
procedure PrepareInput is
variable l: line;
variable s: string;
file file_in : text open read_mode is "lena_64_64.txt";
begin
for i in 0 to IR loop
for j in 0 to IC loop
readline(file_in, l);
read(l, s);
pixelImage(i*IC+j) <= s;
end loop;
end loop;
file_close(file_in);
end PrepareInput;
I am newbie to VHDL. This task is eating away my time.
I want to read a text file(which consist raster data of an image) and store in memory pixelImage as shown below.
The code is not working.
Please correct it.
Here two for loops are not needed I think. And how to read each pixel. By reading each line then each string from that line. Is it correct.
Any help is appreciated.
******************************
procedure PrepareInput is
variable l: line;
variable s: string;
file file_in : text open read_mode is "lena_64_64.txt";
begin
for i in 0 to IR loop
for j in 0 to IC loop
readline(file_in, l);
read(l, s);
pixelImage(i*IC+j) <= s;
end loop;
end loop;
file_close(file_in);
end PrepareInput;