在 modelsim 的 VHDL 测试台中未检测到结束文件,测试台只是不断地自我重复

endfile not detected in the VHDL testbench in modelsim, the testbench just keeps repeating it self indefinetly

我写了一个 VHDL 代码,它应该循环遍历一个文件并关闭文件,并在文件结束并关闭文件后停止,但它只是无限期地循环读取文件

            FILE f               : TEXT;
            constant filename    : string :="input.txt";
            VARIABLE L           : LINE;
            variable al          : integer ;
            variable opcode_str  : string(5 downto 1);
            variable comma       : character;

            begin
            File_Open (f,FILENAME, read_mode);  
                while not endfile(f) loop
                readline (f, l);
                read(l, opcode_str);
                read(l, comma);
                read(l, Al);
                op_code<= read_opcode(opcode_str);      
                w_tb <=std_logic_vector(to_unsigned(Al, w_tb'length));
                  wait for 10 ns;
            end loop;
            File_Close (f);
        end process

您的流程在流程结束时没有 wait 语句。所有没有敏感列表的进程都是无限循环。

只需添加语句

wait;  -- waits forever

在流程结束时。