如何 运行 模拟一定数量的时钟周期

How to run simulation for a set amount of clock cycles

大家好, 我是 VHDL 的新手。我有一个可行的设计,但是我的模拟会一直保持 运行,直到我取消模拟。在测试台中,如何在 x 个时钟周期后停止模拟?这是在时钟过程中完成的吗?

clk_process :process
  begin
     clk <= '0';
     wait for clk_period/2;  
     clk <= '1';
     wait for clk_period/2;  
end process;

拜托,谢谢!

在 VHDL-2008 中:

if now >= clk_period * x then 
   std.env.stop;
end if;

在早期的修订版中(尽管在 2008 年仍然有效!):

assert now < clk_period * x report 
    "Stopping simulation : this is not a failure!" severity failure;

Janick Bergeron 的书 "Writing Testbenches"!

实际上推荐了后一种好奇心(滥用断言)

时钟进程对他们来说是一个很好的地方,但是用于模拟控制的单独进程(可能对时钟敏感)可能是稍微干净的设计。