首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

Verilog HDL

The wait statement will not block execution if its condition is true. If the condition is not true, it will wait until it becomes true.
Example:

module wait_example;
reg [7:0] a;
reg b;
initial begin
  wait (a==3)
      $display("not waiting for a==3 time %0d", $time);
  wait(b)
      $display("not waiting for b time %0d", $time);
  wait (a==4)
      $display("not waiting for a==4 time %0d", $time);
end
initial begin
  #3 a = 3;
    $display("value of a is now %0d at time %0d", a,$time);
  #1 a = 4;
    $display("value of a is now %0d at time %0d",a,$time);
  #1 b = 1;
    $display("value of b is now %0d at time %0d",b,$time);
end
endmodule
返回列表