SystemVerilog Covergroups

I am referring the SV LRM to understand covergroups. And I am not able to understand this particular example.
For the cross of a,b: The bins apple mentions a keyword “matches” can you help me understand what does it signify?

logic [0:7] a, b; parameter [0:7] mask;
covergroup cg;
coverpoint a
{
  bins high = {[128:255]};
  bins low[] = {[0:127]}; 
}

coverpoint b
{
  binsthree[]=bwith(item%3==0);
  bins two[] = b with (item % 2 == 0);
}

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);
}
endgroup

In reply to sfenil1804:

Let me give you more simplified example.


logic [0:2] a, b;
covergroup cg;
coverpoint a
{
  bins high = {[4:7]};   // this will create 1 bin  : high ( having 4 tuple ,  i.e. 4,5,6,7)
  bins low[] = {[0:3]};  // this will create 4 bins : low[0],low[1],low[2],low[3]
                         //  each low bin has 1 tuple ( 1 value)
}
 
coverpoint b
{
  bins three[] = b with(item%3==0);        // 3 bins : three[0],three[3],three[6]
  bins two[]   = b with (item % 2 == 0);   // 4 bins : two[0],two[2],two[4],two[6]
}
 
X: cross a,b
{
  bins apple = X with (a+b < 9) matches 3;
  bins banana = X with ( a + b < 9);
}


Here banana bin is cross coverage of ‘a’ and ‘b’ with clause which is a + b should be less than 9.


bins banana = 
<low[0],two[0]>, <low[0],two[2]> , <low[0],two[4]> , <low[0],two[6]>
<low[1],two[0]>, <low[1],two[2]> , <low[1],two[4]> , <low[1],two[6]>
<low[2],two[0]>, <low[2],two[2]> , <low[2],two[4]> , <low[2],two[6]>
<low[3],two[0]>, <low[3],two[2]> , <low[3],two[4]> ,                  // <low[3],two[6]> will not be included.

<low[0],three[0]>, <low[0],three[3]> , <low[0],three[6]>
<low[1],three[0]>, <low[1],three[3]> , <low[1],three[6]>
<low[2],three[0]>, <low[2],three[3]> , <low[2],three[6]>
<low[3],three[0]>, <low[3],three[3]> ,                                // <low[3],three[6]> will not be included.

< high,two[0] > , <high,two[2]>,  <high,two[4]> // <high,two[6]> will not be included.
//   4 tuple        3 tuple         1 tuple  


You may be wondering that how < high,two[0]> would be having 4 tuple ( 4 combination value).
it would be represented as below.


<high,two[0]> = { (4,0), (5,0), (6,0), (7,0)} // 4 tuple
<high,two[2]> = { (4,2), (5,2), (6,2)}        // 3 tuple

matches is selection policy keyword. So here it means that whichever bins has atleast 3 tuple those will be included in bins apple. That is why

<high,two[0]> and <high,two[2]> are getting included in apple.

so, for this question, apple will be
(high, three[0])
(high,two[0])
(high,two[2])

Is it correct?

In reply to juhi_p:

Correct.