在VHDL中,在调用stop之前刷新输出缓冲区或报告消息,然后停止刺激器而不是完成模拟器

问题描述

在VHDL中,有没有一种方法可以在调用stop之前刷新输出缓冲区? (通常,他们希望您摆弄模拟器调用标志来做到这一点……我更愿意使用代码解决此问题)

换句话说,我想要$ stop,而不是$ finish,而是在调用stop之前刷新输出缓冲区;

示例:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;
use std.env.stop;

entity testit is
   port(
      clk : in std_logic
   );
end entity;

architecture rtl of testit is
begin

    process(clk) 
    if (rising_edge(clk)) then
        report "message 1" & LF;
        --<- insert Command to wait until "message 1" is flushed to console
        stop;
    end if;
    end process;

end architecture;
end process;

我得到的问题是在VHDL模拟中发出停止指令之前,报告“消息1”没有输出到模拟屏幕上……这使我的模拟日志毫无用处……(我正在使用vivado内置的模拟器)

我意识到,我可以在报告语句的末尾添加关键字“ severity致命”,但是,我之所以不能这样做,是因为它杀死了我在vivado中的仿真波形。因此,我需要使“报告”非致命,并在其后放置stop关键字。但是,这会导致其他问题。...

有人知道从测试台代码发出模拟器停止并打印消息的其他方法吗?这样波形窗口将保持打开状态,并且模拟器不会退出。

解决方法

我发现这在VHDL-2008中可以打印消息,刷新输出缓冲区并$ stop模拟器:

library ieee;
use ieee.std_logic_1164.all;
use std.textio.all;
use std.env.stop;

entity test_stop is
    port(
        clk :in  std_logic
    );
end entity;


architecture sim of sim_amm_m is

    procedure print(s: in string) is
        variable L :line;  
    begin
        write(L,string'(s & LF));
        writeline(output,L);
        flush(output);
    end procedure;
    
begin

    process(clk)
    begin    
        if (rising_edge(clk)) then      
            print("STOP CONDITIION");    
            stop; 
        end if;
    end process;
                             
end architecture;

此外,您还可以用它来完成仿真,但在运行交互式仿真时,也将关闭波形查看器:

   print("FINISH CONDITIION");    
   finish;

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...