The word ’ item ’ is used in Array Manipulation Methods and with clause of user-defined bins within coverpoint .
LRM Section 7.12 says
" The iterator_argument optionally specifies the name of the variable used by the with expression . If it is not specified, the name item is used by default. "
It does provide an alternative to item via optional iterator_argument written before with
LRM Section 19.5.1.1 says "In the expression, the name item shall be used to represent the candidate value. "
I tried using label instead of item ::
module top ;
bit [7:0] a ;
covergroup exp ;
a_cp : coverpoint a
{
bins mod3[] = a_cp with ( a_cp % 3 == 0 ) ; // ' label ' used instead of ' item ' !!
}
endgroup
exp inst1 = new() ;
However I observe Compilation Error with the Code .
[Q1] Does the LRM provide an alternative to ’ item ’ within with_clause ?
LRM Section 19.6.1.2 which discusses **matches** has an example where
X: cross a,b
{
bins apple = X with (a+b < 257) matches 127;
bins cherry = ( binsof(b) intersect {[0:50]} && binsof(a.low) intersect {[0:50]}) with (a==b) );
bins plum = binsof(b.two) with (b > 12) || binsof(a.low) with (a & b & mask);
}
With bins ' plum ' label ' b ' is used instead of ' item '
[Q2] LRM Section 19.5.1.1 has 2 examples ::
a: coverpoint x
{
bins mod3[] = {[0:255]} with (item % 3 == 0);
}
coverpoint b
{
bins func[] = b with (myfunc(item));
}
Both of the code have item within with_clause
**When writing with_clause for coverpoint , is it necessary to write ' item ' within it ?**