使用forever 和always 语句 [英] Use of forever and always statements
问题描述
以下两个代码都生成一个时钟.我需要知道除了时钟生成之外是否还有任何使用永久循环的用途?我只在时钟生成中遇到过永远.如果只是为了这个目的,那不是没用吗?
Both the following codes generate a clock. I need to know if there is any use of forever loop other than clock generation? I have only come across forever in clock generation. If it only serves this purpose, isn't it useless?
initial begin
clk = 0;
forever begin
#5 clk = ~clk;
end
end
initial begin
clk = 0 ;
always begin
# 5 clk = ~clk;
end
end
推荐答案
是的,forever
循环在测试台中广泛用于设计验证,特别是在行业标准方法、UVM 及其前身(如 VMM).它们用于验证组件,例如驱动程序和监视器,这些组件广泛使用 SystemVerilog 类中的任务.
Yes, forever
loops have widespread usage in testbenches for design verification, particulalry in the industry standard methodology, UVM, and its predecessors (such as VMM). They are used in verification components such as drivers and monitors which make extensive use of tasks in SystemVerilog classes.
这篇关于使用forever 和always 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!