# Systemverilog: cross Coverage and Ignore bins

**URL:** <https://verificationacademy.com/forums/t/systemverilog-cross-coverage-and-ignore-bins/39168>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, cross-coverage-bins, Coverage, cross-coverage, systemverilog-coverage\
**Created:** [June 9, 2021, 6:19pm UTC](https://verificationacademy.com/forums/t/systemverilog-cross-coverage-and-ignore-bins/39168 "2021-06-09T18:19:46Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [June 10, 2021, 6:25am UTC](https://verificationacademy.com/forums/t/systemverilog-cross-coverage-and-ignore-bins/39168/2 "2021-06-10T06:25:14Z")

</div>

_In reply to [Chakrakirthi](https://verificationacademy.com/forums/t/systemverilog-cross-coverage-and-ignore-bins/39168):_

You had a couple of issues with the posted code. The bins cannot all be named   
c1, and the 4th bin should have the range   
[2:120]. Then the bins you should ignore are

```verilog
covergroup cg_XY;
   cp_x: coverpoint X {bins x_b[] = {[1:20]};}
   cp_y: coverpoint Y {bins y_b[] = {[1:14]};}
   cp_XY: cross cp_x, cp_y {
      bins c1 = binsof(cp_x.x_b) intersect {1} && binsof(cp_y.y_b) intersect {1};
      bins c2 = binsof(cp_x.x_b) intersect {1} && binsof(cp_y.y_b) intersect {[2:14]};
      bins c3 = binsof(cp_x.x_b) intersect {2} && binsof(cp_y.y_b) intersect {[3:14]};
      bins c4 = binsof(cp_x.x_b) intersect {[2:20]} && binsof(cp_y.y_b) intersect {1};
      ignore_bins c5 = binsof(cp_x.x_b) intersect {2} && binsof(cp_y.y_b) intersect {2};
      ignore_bins c6 = binsof(cp_x.x_b) intersect {[3:20]} && binsof(cp_y.y_b) intersect {[2:14]};
   }
endgroup

```

Using the   
 **with** construct might be easer to read and closer to what your requirements look like.

```verilog
covergroup cg_XY;
   cp_x: coverpoint X {bins x_b[] = {[1:20]};}
   cp_y: coverpoint Y {bins y_b[] = {[1:14]};}
   cp_XY: cross cp_x, cp_y {
      bins c1 = cp_XY with (cp_x==1 && cp_y> 1);
      bins c2 = cp_XY with (cp_x==2 && cp_y> 2);
      bins c3 = cp_XY with (cp_x==1 && cp_y==1);
      bins c4 = cp_XY with (cp_x >1 && cp_y==1);
      ignore_bins c5 = cp_XY with (cp_x==2 && cp_y==2);
      ignore_bins c6 = cp_XY with (cp_x >2 && cp_y >1);
   }
endgroup

```

---

_[View the full topic](https://verificationacademy.com/forums/t/systemverilog-cross-coverage-and-ignore-bins/39168)._
