英文:
Use of Item in coverpoint
问题
在下面的代码中,有人可以解释一下 "item" 指的是什么吗?
covergroup cg(bit ip);
coverpoint txn_type {
bins T0 = {0};
bins T1 = {1};
bins T2 = {2} with (((item || (!item)) && ip) == 1);
}
endgroup
英文:
In the below code, can someone please explain what "item" refers to?
covergroup cg(bit ip);
coverpoint txn_type {
bins T0 = {0};
bins T1 = {1};
bins T2 = {2} with (((item || (!item)) && ip) == 1);
}
endgroup
答案1
得分: 2
请参考IEEE标准1800-2017,查阅第19.5.1.1节 使用covergroup表达式的Coverpoint bin:
with 子句指定仅包括满足给定表达式的 covergroup_range_list 中的值(即表达式求值为真,如12.4节所述)。在表达式中,名称 item 用于代表候选值。候选值与coverpoint的类型相同。
将 item
视为在 with
结构中隐式声明的变量。在您的代码中,item
代表coverpoint变量 txn_type
。
英文:
Always start with the IEEE Std, 1800-2017. Refer to section 19.5.1.1 Coverpoint bin with covergroup expressions:
> The with clause specifies that only those values in the
> covergroup_range_list that satisfy the given expression (i.e., for
> which the expression evaluates to true, as described in 12.4) are
> included in the bin. In the expression, the name item shall be used to
> represent the candidate value. The candidate value is of the same type
> as the coverpoint.
Think of item
as an implicitly-declared variable used in the with
construct. In your code, item
represents the coverpoint variable, txn_type
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论