N
Nemesis
Hi all,
I'm writing a testbench for a project, I need to read the input data
from
a file. I'd need to repeat the same sequence more than once.
At the moment I use a process like this
read_file : process
file data: TEXT open READ_MODE is "filename";
....
begin
while (count < len1) loop
wait until falling_edge(WR_CLOCK);
SIGNAL <= std_logic_vector(to_signed(0,24));
end loop;
while not endfile(data) loop
wait until falling_edge(WR_CLOCK);
-- read reference file
readline(data, input_line);
read(input_line, int_text);
SIGNAL <= std_logic_vector(to_signed(int_text,24));
end loop;
while (count < len2) loop
wait until falling_edge(WR_CLOCK);
SIGNAL <= std_logic_vector(to_signed(0,24));
end loop;
end process
This process lasts less than the total testbench time, so it restarts 2
or 3 times, but the file is opened only the first time it runs.
I read in past articles that I can:
1) manually open/close the file,
but modelsim does not recognize file_open/file_close commands
2) create a procedure to read the file
but I don't know how to integrate this procedure with my process
Any hints?
I'm writing a testbench for a project, I need to read the input data
from
a file. I'd need to repeat the same sequence more than once.
At the moment I use a process like this
read_file : process
file data: TEXT open READ_MODE is "filename";
....
begin
while (count < len1) loop
wait until falling_edge(WR_CLOCK);
SIGNAL <= std_logic_vector(to_signed(0,24));
end loop;
while not endfile(data) loop
wait until falling_edge(WR_CLOCK);
-- read reference file
readline(data, input_line);
read(input_line, int_text);
SIGNAL <= std_logic_vector(to_signed(int_text,24));
end loop;
while (count < len2) loop
wait until falling_edge(WR_CLOCK);
SIGNAL <= std_logic_vector(to_signed(0,24));
end loop;
end process
This process lasts less than the total testbench time, so it restarts 2
or 3 times, but the file is opened only the first time it runs.
I read in past articles that I can:
1) manually open/close the file,
but modelsim does not recognize file_open/file_close commands
2) create a procedure to read the file
but I don't know how to integrate this procedure with my process
Any hints?