milan.km
Member level 3
hi....
I am trying to write a testbench for reading inputs from textfile then write the output in a textfile.
I know some parts of the code, but its incomplete.
I put the original code that corresponds to the clk, reading input and writing output, but some other parts should be written too.
If other people say I am grateful to have the information what other things should be observed :
here is the architecture of the testbench :
Thanks
I am trying to write a testbench for reading inputs from textfile then write the output in a textfile.
I know some parts of the code, but its incomplete.
I put the original code that corresponds to the clk, reading input and writing output, but some other parts should be written too.
If other people say I am grateful to have the information what other things should be observed :
here is the architecture of the testbench :
Code:
-- Clock process definitions
clk_process :process
begin
clk <= '0';
wait for clk_period/2;
clk <= '1';
wait for clk_period/2;
end process;
-- Stimulus process
stim_proc: process
file IN1:text ;
variable line_input:line;
variable p1:integer;
begin
file_open(IN1,"E:\OUT1.txt",read_mode);
while not endfile( IN1 ) loop
readline( IN1, line_input );
read( line_input, p1 );
p_in <=to_unsigned(p1,8);
wait for 3 ns;
end loop;
file_close(IN1);
end process;
stim_proc2: process
file OUT1:text;
variable TEMP:integer;
variable line_output:line;
begin
file_open(OUT1,"E:\OUT1.txt", write_mode);
wait for 3 ns;
TEMP:=to_integer(p_out);
write(line_output,TEMP);
writeline( OUT1 ,line_output ) ;
end loop;
file_close(OUT1);
end process;
END;