我正在阅读vhdl中的文本文件。有很多示例,但是我很好奇为什么这个最小的展示示例在GHDL中不起作用。它在ModelSim中工作(由Mentor完成)。
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use STD.textio.all;
entity test is
end test;
architecture behavioral of test is
file input : text;
begin
process
variable line_in : line;
begin
file_open(input, "input.txt");
while not endfile(input) loop
readline(input, line_in);
end loop;
wait for 100 ns;
end process;
end behavioral;
我得到的输出是:
./test:error: cannot open file "input.txt"
这意味着没有文件/无法打开,但是该文件以正确的访问权限存在(在Modelsim中得到证明)。我也尝试使用完整的文件名。
我在Linux上使用GHDL 0.37,带有以下标志:--ieee=synopsys --std=08
我固定了!我已替换为:
file input : text;
...
file_open(input, "input.txt");
带有此:
file input : text open read_mode is "input.txt";
现在可以在GHDL中使用
但是,我仍然不知道为什么以前的版本不起作用,我很感谢这里出现的任何评论。