--There should be a file aabc_file.txt containing integer
library ieee;
use ieee.std_logic_1164.all;
use std.textio.all;
entity read_integer is
end read_integer;
architecture behavioral of read_integer is
signal d_out: integer;
signal clk: std_logic := '0';
begin
reading:
process
constant filename: string := "aabc_file.txt";
file f: text open read_mode is filename;
variable L: line;
variable data_read: integer;
variable char: character;
variable len: integer;
begin
while not endfile(f) loop
readline(f, L);
len := L'length;
while len > 0 loop
read (L, data_read);
len := L'length;
if len > 0 then
read (L, char);
len := L'length;
end if;
wait until rising_edge(clk);
d_out <= data_read;
report "data_read = " & integer'image(data_read);
end loop;
end loop;
wait until rising_edge(clk);
wait;
end process;
CLOCK:
process
begin
wait for 5 ns;
clk <= not clk;
if Now > 250 ns then
wait;
end if;
end process;
end behavioral;
No comments:
Post a Comment