等待特定的持续时间
仅使用 for <timeout>
子句,可以获得持续特定持续时间的无条件等待。这是不可综合的(没有真正的硬件可以如此简单地执行此行为),但经常用于在测试平台内调度事件和生成时钟。
此示例在仿真测试平台中生成 100 MHz,50%占空比时钟,用于驱动被测设备:
constant period : time := 10 ns;
...
process
begin
loop
clk <= '0';
wait for period/2;
clk <= '1';
wait for period/2;
end loop;
end process;
此示例演示了如何使用文字持续时间等待对测试平台激励/分析过程进行排序:
process
begin
rst <= '1';
wait for 50 ns;
wait until rising_edge(clk); --deassert reset synchronously
rst <= '0';
uut_input <= test_constant;
wait for 100 us; --allow time for the uut to process the input
if uut_output /= expected_output_constant then
assert false report "failed test" severity error;
else
assert false report "passed first stage" severity note;
uut_process_stage_2 <= '1';
end if;
...
wait;
end process;