# Cross coverage valid bins with mutual exclusive coverpoints

**URL:** <https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259>\
**Category:** Coverage\
**Tags:** cross-coverage-bins, Coverage\
**Created:** [March 4, 2020, 6:36pm UTC](https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259 "2020-03-04T18:36:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ingamara](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/i/47e85d/32.png) [@ingamara](https://verificationacademy.com/forums/u/ingamara)\
**Post date:** [March 4, 2020, 6:36pm UTC](https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259/1 "2020-03-04T18:36:55Z")

</div>

I have this example for 6 coverpoints that can take same 6 values, but never the same value between them at a certain point (mutually exclusive). These values are not necessarily consecutive.

For example (where the bins specifically does not have value 3):

```verilog

bit [3:0] a0,a1,a2,a3,a4,a5;

covergroup cg;
  p0: coverpoint a0{
    bins v[] = {0,1,2,4,5,6};
  }
  p1: coverpoint a1
  {
    bins v[] = {0,1,2,4,5,6};
  }
  p2: coverpoint a2{
    bins v[] = {0,1,2,4,5,6};
  }
  p3: coverpoint a3{
    bins v[] = {0,1,2,4,5,6};
  }
  p4: coverpoint a4{
    bins v[] = {0,1,2,4,5,6};
  }
  p5: coverpoint a5{
    bins v[] = {0,1,2,4,5,6};
  }  
  CRS: cross p0,p1,p2,p3,p4,p5;

endgroup

```

With 2 values its simple but for more than 2 values it seems trickier. I suppose also there is a big penalty of performance of coverage between so many coverpoints.

What is the best way to make the cross coverage exclude the bins that are not mutual exclusive / or make only the valid bins that contain the mutual exclusive values ( for example valid crosses are {0,1,2,4,5,6},{6,1,5,4,2,0}…etc, where any value is not repeated 2 or more times.

---

<div class="post-metadata">

**Author:** ![rgarcia07](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/r/a87d85/32.png) [@rgarcia07](https://verificationacademy.com/forums/u/rgarcia07)\
**Post date:** [March 5, 2020, 1:06pm UTC](https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259/2 "2020-03-05T13:06:35Z")

</div>

_In reply to [ingamara](https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259):_

Maybe you could specify the bins you want to ignore in the cross using the the **with** clause something like this

```verilog
  CRS: cross p0, p1, p2, p3, p4, p5 {

    ignore_bins same = CRS with ((p0 == p1) || (p0 == p2) || (p0 == p3) || (p0 == p4) || (p0 == p5) ||
                                      (p1 == p2) || (p1 == p3) || (p1 == p4) || (p1 == p5) ||
                                      (p2 == p3) || (p2 == p4) || (p2 == p5) ||
                                      (p3 == p4) || (p3 == p5) ||
                                      (p4 == p5)    
                                     );

  }

```

I think this basically leaves only the unique combinations in this case since v has 6 numbers 1_2_3_4_5\*6 = 6! = 720 (I could be wrong), I tried with 3 coverpoints with v = {0,1,2} and it seemed to work.  
I know it does not look pretty, maybe there is a more efficient way to exclude them.

You can have a look to the 1800-2017 LRM section **19.6.1.2 Cross bin with covergroup expressions** to get more details

HTH,  
-R

---

<div class="post-metadata">

**Author:** ![ingamara](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/i/47e85d/32.png) [@ingamara](https://verificationacademy.com/forums/u/ingamara)\
**Post date:** [April 17, 2020, 2:43pm UTC](https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259/3 "2020-04-17T14:43:18Z")

</div>

_In reply to [rgarcia07](https://verificationacademy.com/forums/t/cross-coverage-valid-bins-with-mutual-exclusive-coverpoints/37259/2):_

Thanks, I did not find something better.
