运行测试台时出现奇怪的错误,我以前从未见过。我正在尝试用 4 个寄存器模拟一个 8 位计算器。该计算器有 8 位指令,用于加、减、相等分支、立即加载和打印到监视器。我已经检查以确保我没有处于任何无限循环中。我在网上进行了研究,似乎没有任何具体原因导致我出现此错误。
我对循环、内存泄漏进行了三次检查,还尝试增加堆栈帧。到目前为止都没有成功。使用命令 ghdl -a、-e 和 -r 来分析、编译和运行。
'''
architecture structural of calculator_tb is
component calculator is
port(
I : in std_logic_vector(7 downto 0); --instruction input
clk : in std_logic
);
end component calculator;
signal I : std_logic_vector(7 downto 0);
signal clk : std_logic;
begin
calculator_0 : calculator port map(I, clk);
process
file instruction_file : text is in "instructions.txt"; --Instructions in text(ASCII) file.
variable instruction_line : line;
variable intruction_vector : bit_vector(7 downto 0);
begin
while (not(endfile(instruction_file))) loop --Loop to the end of the text file.
wait for 1 ns;
clk <= '0';
readline(instruction_file, instruction_line); --Read in instruction line
read(instruction_line, intruction_vector); --merge instruction to bit vector
I <= to_stdlogicvector(intruction_vector); --Convert bit vector to std_logic_vector and pass instruction to the calculator input.
--Create a rising edge for the clock.
wait for 1 ns;
clk <= '1';
end loop;
assert false report "end of test" severity note;
end process;
end architecture structural;
''''
The runtime error I receive is:
无效的内存访问(悬空访问或堆栈太小)