Ожидание события (wait)

Конструкция wait ожидает, пока указанное условие станет истинным, блокируя выполнение дальнейших выражений этого процедурного блока.

Пример

module wait_tb;
  integer count = 0;
  
  initial begin 
    $monitor("Time [%0t]: count = %0d", $time, count);
    repeat (5)
      #2 count++;
  end
  
  initial begin
    wait(count == 'd3);
    $display("{3} count has reached till %0d at time = %0t", count, $time);
    $finish;
  end
  
  initial begin
    wait(count == 'd4);
    $display("{4} count has reached till %0d at time = %0t", count, $time);
    $finish;
  end
endmodule

Результат исполнения

Time [0]: count = 0
Time [2]: count = 1
Time [4]: count = 2
{3} count has reached till 3 at time = 6
Time [6]: count = 3

Last updated