Forum Discussion
Altera_Forum
Honored Contributor
13 years agoYou can either read text file or generate data stream directly in testbench.
Here is example of reading text file:
-- read input stimulus
process(reset,clk)
file file_in : text open read_mode is "filename.txt";
variable line_in : line;
variable input_tmp : integer := 0;
begin
if(reset = '1')then
data_in <= (others => '0');
elsif(rising_edge(clk))then
if not endfile(file_in)then
readline(file_in,line_in);
read(line_in,input_tmp);
data_in <= std_logic_vector(to_signed(input_tmp,16));
end if;
end if;
end process;