返回介绍

23.10 断言系统函数

发布于 2020-09-09 22:55:57 字数 1734 浏览 1172 评论 0 收藏 0

assert_boolean_functions ::=    // not in Annex A
    assert_function(expression);

assert_function ::=
    $onehot
  | $onehot0
  | $isunknown

Syntax 23-8—Assertion system function syntax (not in Annex A)

Assertions are commonly used to evaluate certain specific characteristics of a design implementation, such as whether a particular signal is “one-hot”. The following system functions are included to facilitate such common assertion functionality:

  • $onehot returns true if one and only one bit of expression is high.
  • $onehot0 returns true if at most one bit of expression is high.
  • $isunknown returns true if any bit of the expression is X or Z. This is equivalent to ^expression === ’bx.
All of the above system functions shall have a return type of bit. A return value of 1’b1 shall indicate true, and a return value of 1’b0 shall indicate false.

A function is provided to return sampled value of an expression.

$sampled ( expression [, clocking_event] )

Three functions are provided for assertions to detect changes in values between two adjacent clock ticks.

$rose ( expression [, clocking_event] )
$fell ( expression [, clocking_event] )
$stable ( expression [, clocking_event] )

The past values can be accessed with the $past function.

$past ( expression [, number_of_ticks] [, expression2] [, clocking_event] )

$sampled, $rose, $fell, $stable and $past are discussed in Section 17.7.3.

The number of 1s in a bit vector expression can be determined with the $countones function.

$countones ( expression )

$countones is discussed in Section 17.10.

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

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

发布评论

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