在测试台进程​​中发出格式化 "if" 语句?

Issue formatting "if" statement within testbench process?

这让我发疯。这是我目前的代码:

signal SYS_CLK : std_logic := '0';     --Input
signal InputSignal : std_logic := '0';  --Input

signal SyncOutputSignal : std_logic;     --Output

------------------------------------------------------
stim_proc:process(SYS_CLK)

begin   

      if (rising_edge(SYS_CLK)) then
          if (InputSignal = '1') then
             assert (SyncOutputSignal = '0') report "Bad Pulse..." severity ERROR; 
          end if;
      end if;

end process stim_proc;   

和一张ISim波形图---> i.imgur.com/G5KvCQe.jpg

此测试的目的是确认当打开 rising_edge(SYS_CLK) 时,如果 InputSignal = '1',则发射一个脉冲 (SyncOutputSignal) 等效于 SYS_CLK的经期。

但是,每当 CLK 变高且 InputSignal 为高时,都会发出错误报告。

长话短说,我需要一种方法来告诉程序在再次测试代码中列出的断言语句之前等待下一个 InputSignal Pulse。有什么想法吗??

听起来您正在尝试检查 InputSignal 上的边沿条件。在硬件中检查边缘条件时,您可以做一件简单的事情。创建 InputSignal 的注册版本(我称之为 Reg_InputSignal)。然后更改您的 if 语句以检查 InputSignal 上的 1 和 Reg_InputSignal 上的 0。这是 InputSignal 的上升沿条件,应该只触发 1 个时钟周期的 if 语句。

architecture RTL of Entity_Name is
  signal Reg_InputSignal : std_logic := '0';
begin
stim_proc : process(SYS_CLK)
begin
  if (rising_edge(SYS_CLK)) then
    Reg_InputSignal <= InputSignal;
    if (InputSignal = '1' and Reg_InputSignal = '0') then
      assert (SyncOutputSignal = '0') report "Bad Pulse..." severity error;
    end if;
  end if;
end process stim_proc;