返回介绍

28.3.1 Obtaining assertion handles

发布于 2020-09-09 22:55:59 字数 1996 浏览 825 评论 0 收藏 0

SystemVerilog extends the VPI module iterator model (i.e., the instance) to encompass assertions, as shown in Figure 28-1.

The following steps highlight how to obtain the assertion handles for named assertions.

Figure 28-1 — Encompassing assertions

Note: Iteration on assertions from interfaces is not shown in Figure 28-1 since the interface object type is not currently defined in VPI. However the assertion API permits iteration on assertions from interface instance handles and obtaining static information on assertions used in interfaces (see Section 28.3.2.1).

1) Iterate all assertions in the design: use a NULL reference handle (ref) to vpi_iterate(), e.g.,

itr = vpi_iterate(vpiAssertion, NULL);

while (assertion = vpi_scan(itr)) {
    /* process assertion */
}

2) Iterate all assertions in an instance: pass the appropriate instance handle as a reference handle to vpi_iterate(), e.g.,

itr = vpi_iterate(vpiAssertion, instanceHandle);
while (assertion = vpi_scan(itr)) {
    /* process assertion */
}

3) Obtain the assertion by name: extend vpi_handle_by_name to also search for assertion names in the appropriate scope(s), e.g.,

vpiHandle = vpi_handle_by_name(assertName, scope)

4) To obtain an assertion of a specific type, e.g. cover assertions, the following approach should be used:

vpiHandle assertion;

itr = vpi_iterate(vpiAssertionType, NULL);

while (assertion = vpi_scan(itr)) {
    if (vpi_get(vpiAssertionType, assertion) == vpiCoverType) {
        /* process cover type assertion */
    }
}

NOTES

  1. As with all VPI handles, assertion handles are handles to a specific instance of a specific assertion.
  2. Unnamed assertions cannot be found by name.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文