Search code examples
verilogsystem-verilogtest-coverage

How to restrict a cross point bin based on the sum of crossed coverpoints? and what's the meaning of binsof?


I got two 3-bit signals a and b with legal values 0-4.

I'm trying to make a cross point where I only consider the coverage if the sum also is in the range 0-4. What is the preferred way to do that? I have a solution that seems to work, but I have guessed in some places ...

covergroup CG_operands @(posedge clk);
   coveproint a { illegal_bins hi = {[5:$]}; }
   coveproint b { illegal_bins hi = {[5:$]}; }
   cross a, b { illegal_bins hi = binsof(a) with (a + b > 4) }
endgroup

What does the binsof(a) part do? If I change it to binsof(a) && binsof(b) nothing seems to change in the coverage report. Is it possible to skip the binsof part completely?

Also can I make the coverpoint conditions look more like the with-condition of the cross using > 4?


Solution

  • The binsof operator is used to select a subset of bins from a coverpoint. But since you are selecting the entire coverpoint a, there's no difference between using binsof(b) or binsof(a) && binsof(b). You could write

    ab: cross a, b { ignore_bins hi = ab with (a + b > 4); }