I want to read from a text file and show it in the ISE environment, I have the code below, but when I run it the error:
File <ramfile_rd> does not exist.
is created, I have the test.txt
file in the folder that the codes sources exist in.
What is the problem?
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use std.textio.all ;
--use ieee.std_logic_textio.all;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_SIGNED.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
entity rd is
PORT(
clk : IN std_logic;
a : out std_logic_vector (7 downto 0)
);
end rd;
architecture Behavioral of rd is
--type Integerfiletype is file of integer ;
begin
read_from_file : process(clk)
FILE ramfile_rd : text;
variable RamFileLine_rd : line;
variable di: integer;
begin
if(clk'event and clk='1') then
file_open(ramfile_rd,"test.txt", read_mode);
read (RamFileLine_rd,di);
readline (ramfile_rd, RamFileLine_rd);
a<=conv_std_logic_vector(di,8);
file_close(ramfile_rd);
end if;
end process;
end Behavioral;