等待语句和在 SystemVerilog 中使用 while 循环有什么区别?

What is the difference between a wait statement and using a while loop in SystemVerilog?

我想知道在设置标志之前使用等待语句或传统循环等待设置标志有什么区别。

wait (flag === 1); //Implementation 1

while ( flag != 1); //Implementation 2

wait 语句阻塞当前进程,直到表达式变为真。

如果表达式为真(flag 为假),您编写的 while 循环将变为无限 zero-delay 循环。这将挂起模拟。