masoud.malekzadeh
Member level 1
I want to read data from text file and load it to a ram but i get these errors :
read expects 3 arguments
Type void is not an array type and cannot be indexed
i would be thankful if you help me .
here is my code :
read expects 3 arguments
Type void is not an array type and cannot be indexed
i would be thankful if you help me .
here is my code :
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use std.textio.all;
entity ICA is
port ( x_out:out std_logic_vector(31 downto 0);
w:in std_logic;
z:in std_logic;
clk: in std_logic
);
end ICA;
architecture Behavioral of ICA is
begin
process(clk)
FILE infile : TEXT IS IN "in_code.txt";
variable my_line : line;
variable int: std_logic_vector(31 downto 0 );
type ram_type is array (3 downto 0 ) of std_logic_vector(31 downto 0 );
type TEXT is file of std_logic_vector;
variable ram :ram_type;
begin
if(clk' event and clk='1') then
for i in 3 downto 0 loop
readline(infile,my_line);
read (my_line,int);
if (w='1') then
ram(i):=int ;
else
x_out<=ram(i);
end if ;
end loop ;
end if ;
end process;
end Behavioral;
Last edited by a moderator: