我试图用Python实现一个简单的基于事件的Verilog模拟器,但实际上我很难在规范中找到一些细节(ieee1364-2005第11节)。在
假设我刚刚对clk
执行了一个更新事件,它现在获得了新值1(之前是0)。根据规范,这要求我为敏感进程安排“评估事件”。在
是否必须将always @(posedge clk)
块的求值安排为活动事件还是非活动事件?我猜后者是对的?在
或者说,更笼统地说。基本上所有事件都被安排为非活动事件,但以下情况除外:
- 非阻塞分配更新为非阻塞分配事件
- 作为活动事件的连续分配
非常感谢!在
Tags:
默认情况下,所有操作都在活动的区域中运行。例外情况包括:
通过在任何现有模拟器中运行以下命令,我们可以证明
@
发生在活动区域:输出:
^{pr2}$显示报告的次数多于监视器的次数。这就排除了}的每个区域都将触发一个新的活动区域事件。在
@
在监视器或未来区域中累积的可能性。Display is正在报告每个事件区域。每个事件区域只能循环回活动区域。因此,必须在活动区域中处理@
,并且更新变量{这也可以通过了解Verilog的历史来证明。不幸的是,这并没有很好的记录。我是从80年代末90年代初使用/开发verilog的人那里学来的,总的解释是:在IEEE Std 1364-1995之前,
@
早于这两个区域,才将非活动区域和NBA区域添加到verilog中。添加这些区域是为了向非确定性模拟器添加确定性。在根据评论的反馈进行澄清
事件被激活,而不是被移动。激活的NBA事件进入if (E is an update event)
、修改对象和调度新的评估事件的真实条件(在下次输入活动区域时处理)。一旦所有的激活的事件都完成了,调度将返回while循环的顶部。NBA区域只分配值,评估实际上是在早期的活跃区域阶段进行的。根据您的例子:
while循环的每次迭代都将如下所示:
相关问题 更多 >
编程相关推荐