4. Scheduling semantics
4.3 Event simulation
SystemVerilog 语言是根据离散事件(discrete event)执行模型定义的。
SystemVerilog描述由连接的执行线程或进程组成。进程是可以计算的对象,可以具有状态,可以响应输入上的更改以产生输出。进程是并发调度的元素,例如初始过程。进程的例子包括但不限于,primitives; initial, always, always_comb, always_latch, and always_ff procedures; continuous assignments; asynchronous tasks; and procedural assignment statements。
Event
- 在仿真得的系统描述中, net or variable 的每一次变化都被认为是一个更新事件(update event)。
- 进程对更新事件很敏感。 当更新事件被执行时,所有对该事件敏感的进程都被考虑以任意顺序进行评估。 一个过程的评估也是一个事件,称为评估事件( evaluation event)。
评估事件还包括 PLI 回调,这是执行模型中可以从仿真内核调用 PLI 应用程序例程的点。
除了事件之外,仿真器的另一个关键方面是时间。 术语仿真时间用于指代由仿真器维护的时间值,以模拟被仿真的系统描述所需的实际时间。 在本节中,术语时间可与模拟时间互换使用。
为了完全支持清晰和可预测的交互,将单个time slot(时隙)划分为多个区域,在这些区域中可以安排事件,以提供特定类型执行的顺序。
4.4 Stratified event scheduler 分层事件调度器
按时间划分。 每个Event 都有一个且只有一个仿真执行时间,在仿真过程中的任何给定时间点可以是当前时间或未来某个时间。 在特定时间的所有预定事件( scheduled events)都定义了一个时隙。 仿真的开展是通过执行并删除当前仿真时隙中的所有事件,然后按时间顺序进入下一个非空时隙。 这个过程保证了仿真器器永远不会在时间上倒退。
将time slot 划分为一组有序区域,如下所示:
a) Preponed
b) Pre-Active
c) Active
d) Inactive
e) Pre-NBA
f) NBA
g) Post-NBA
h) Pre-Observed
i) Observed
j) Post-Observed
k) Reactive
l) Re-Inactive
m) Pre-Re-NBA
n) Re-NBA
o) Post-Re-NBA
p) Pre-Postponed
q) Postponed
将 time slot 划分为有序区域的目的:在 design 和 testbench 代码之间提供可预测的交互。
4.4.1 Active region sets and reactive region sets
事件区域有两组重要的分组,用于帮助定义调度SystemVerilog活动,即 Active region set 和 Reactive region set。
Active region set events:Active ,Inactive, Pre-NBA, NBA, and Post-NBA regions .
reactive region set events:Reactive, Re-Inactive, Pre- Re-NBA, Re-NBA, and Post-Re-NBA regions.
The Active, Inactive, Pre-NBA, NBA, Post-NBA, Pre-Observed, Observed, Post-Observed, Reactive, Re-Inactive, Pre-Re-NBA, Re-NBA, Post-Re-NBA, and Pre-Postponed 区域被称为迭代iterative区域。
In addition to the active region set and reactive region set, all of the event regions of each time slot can be categorized as simulation