# Cross Coverage using Coverpoints with fixed bins

**URL:** <https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, cross-coverage-bins, coverpoint\
**Created:** [November 13, 2017, 4:54pm UTC](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702 "2017-11-13T16:54:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![agstod](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@agstod](https://verificationacademy.com/forums/u/agstod)\
**Post date:** [November 13, 2017, 4:54pm UTC](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/1 "2017-11-13T16:54:29Z")

</div>

Is it possible to use the fixed bins created with a coverpoint for cross coverage bins?

Here is my code:

```verilog

covergroup cvgrp;
   logic [31:0] Address_pt : coverpoint tr.addr
   {
      bins ram_div [32] = {[`RAM_AddrFirst:`RAM_AddrLast]};  
   }
   
   direction_t Direction_pt : coverpoint tr.Direction 
   {
      ignore_bins undef = {UNDEFINED};
      bins READS = {READ};
      bins WRITES = {WRITE};
   }
   
   transactions : cross Address_pt, Direction_pt
   {
      bins ram_read = binsof(Address_pt.ram_div) && binsof(Direction_pt.READS);
      bins ram_write = binsof(Address_pt.ram_div) && binsof(Direction_pt.WRITES);   
   }
endgroup : cvgrp

```

What I want is for the cross to show a read/write for each of the 32 fixed bins created in **coverpoint** Address\_pt.ram\_div. But instead, the cross only shows read/write for the entire ram\_div as though it were one single bin…

Is what I want to do possible?

---

<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:** [November 14, 2017, 4:49am UTC](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/2 "2017-11-14T04:49:34Z")

</div>

_In reply to [ce\_2015](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702):_

The bins directive of a cross can only merge or ignore automatically generated cross-bins.

What you need to do is define two coverpoints with one bin instead of one coverpoint with two bins. Then define two crosses.

```verilog
covergroup cvgrp;
   Address_pt : coverpoint tr.addr
   {
      bins ram_div [32] = {[`RAM_AddrFirst:`RAM_AddrLast]};  
   }
 
   Read_pt : coverpoint tr.Direction 
   {
      bins READS = {READ};
   }
   Write_pt : coverpoint tr.Direction 
   {
      bins READS = {Write};
   }
   ram_read : cross Address_pt, Read_pt;
   ram_write : cross Address_pt, Write_pt;

endgroup : cvgrp

```

---

<div class="post-metadata">

**Author:** ![Tudor\_Timi](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/tudor_timi/32/1897_2.png) [@Tudor\_Timi](https://verificationacademy.com/forums/u/Tudor_Timi)\
**Post date:** [November 14, 2017, 2:53pm UTC](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/3 "2017-11-14T14:53:59Z")

</div>

_In reply to [ce\_2015](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/2):_

Doesn’t declaring the cross without specifying any bins do exactly what you want?

---

<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:** [November 14, 2017, 3:40pm UTC](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/4 "2017-11-14T15:40:25Z")

</div>

_In reply to [Tudor Timi](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/3):_

Yes, I missed that. I guess it depends on how they want it reported.

---

<div class="post-metadata">

**Author:** ![agstod](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/e495f1/32.png) [@agstod](https://verificationacademy.com/forums/u/agstod)\
**Post date:** [November 14, 2017, 5:15pm UTC](https://verificationacademy.com/forums/t/cross-coverage-using-coverpoints-with-fixed-bins/33702/5 "2017-11-14T17:15:34Z")

</div>

Thank you both.

Yes, Tudor Timi, declaring the cross without any bins does yield 64 bins (32 x READ, 32 x WRITE). Both Dave’s answer and your answer contained that fact that the cross cannot specify any bins in the cross if you want this to happen.
