S
sr
Guest
When I try to compile the below package , it gives me the error
"Actual for formal f is not a file" whenever readline or writeline is called
when compiling in Modelsim.
Am I doing something wrong here? Can someone please help me out.
Thanks,
SR
library IEEE;
use IEEE.std_logic_1164.all;
use STD.textio.all;
package classio is
procedure read_v1d (variable f: in text; v : out std_logic_vector);
procedure write_v1d (variable fut text; v : in std_logic_vector);
end package classio;
---------------
package body classio is
procedure read_v1d (variable f:in text; v : out std_logic_vector) is
variable buf: line;
variable c : character;
begin
readline(f, buf);-- This line causes the error
for i in v'range loop
read(buf, c);
case c is
when 'X' => v (i) := 'X';
when 'U' => v (i) := 'U';
when 'Z' => v (i) := 'Z';
when '0' => v (i) := '0';
when '1' => v (i) := '1';
when '-' => v (i) := '-';
when 'W' => v (i) := 'W';
when 'L' => v (i) := 'L';
when 'H' => v (i) := 'H';
when others => v (i) := '0';
end case;
end loop;
end procedure read_v1d;
procedure write_v1d (variable f: out text; v : in std_logic_vector) is
variable buf: line;
variable c : character;
begin
for i in v'range loop
case v(i) is
when 'X' => write(buf, 'X');
when 'U' => write(buf, 'U');
when 'Z' => write(buf, 'Z');
when '0' => write(buf, character'('0'));
when '1' => write(buf, character'('1'));
when '-' => write(buf, '-');
when 'W' => write(buf, 'W');
when 'L' => write(buf, 'L');
when 'H' => write(buf, 'H');
when others => write(buf, character'('0'));
end case;
end loop;
writeline (f, buf); --This line causes the error!
end procedure write_v1d;
end package body classio;
"Actual for formal f is not a file" whenever readline or writeline is called
when compiling in Modelsim.
Am I doing something wrong here? Can someone please help me out.
Thanks,
SR
library IEEE;
use IEEE.std_logic_1164.all;
use STD.textio.all;
package classio is
procedure read_v1d (variable f: in text; v : out std_logic_vector);
procedure write_v1d (variable fut text; v : in std_logic_vector);
end package classio;
---------------
package body classio is
procedure read_v1d (variable f:in text; v : out std_logic_vector) is
variable buf: line;
variable c : character;
begin
readline(f, buf);-- This line causes the error
for i in v'range loop
read(buf, c);
case c is
when 'X' => v (i) := 'X';
when 'U' => v (i) := 'U';
when 'Z' => v (i) := 'Z';
when '0' => v (i) := '0';
when '1' => v (i) := '1';
when '-' => v (i) := '-';
when 'W' => v (i) := 'W';
when 'L' => v (i) := 'L';
when 'H' => v (i) := 'H';
when others => v (i) := '0';
end case;
end loop;
end procedure read_v1d;
procedure write_v1d (variable f: out text; v : in std_logic_vector) is
variable buf: line;
variable c : character;
begin
for i in v'range loop
case v(i) is
when 'X' => write(buf, 'X');
when 'U' => write(buf, 'U');
when 'Z' => write(buf, 'Z');
when '0' => write(buf, character'('0'));
when '1' => write(buf, character'('1'));
when '-' => write(buf, '-');
when 'W' => write(buf, 'W');
when 'L' => write(buf, 'L');
when 'H' => write(buf, 'H');
when others => write(buf, character'('0'));
end case;
end loop;
writeline (f, buf); --This line causes the error!
end procedure write_v1d;
end package body classio;