# Cross coverage with ignore bin

**URL:** <https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529>\
**Category:** SystemVerilog\
**Tags:** System-Verilog, SystemVerilog, cover-groups\
**Created:** [April 9, 2015, 12:03pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529 "2015-04-09T12:03:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidharth.sankar77](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/5f8ce5/32.png) [@sidharth.sankar77](https://verificationacademy.com/forums/u/sidharth.sankar77)\
**Post date:** [April 9, 2015, 12:03pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/1 "2015-04-09T12:03:32Z")

</div>

Hi,  
I have cover point as given below.

```verilog
covergroup cg1 ;
 cA: coverpoint myenumA {
   bins a_bin[] = {[1:2]};
 } 
 cB: coverpoint myenumB {
  bins b1 = {[1:33]};
  bins b2 = {[34:50]};
 } 
 cC: coverpoint myenumC {
 bins c1 = {[1:33]};
  bins c2 = {[34:50]};
 }  

 cD: coverpoint myenumD {
 bins d1 = {[1:33]};
  bins d2 = {[34:50]};
 }  
endgroup

```

I want to get cross coverage of cA,cB ,cC and cD for bin a\_bin value 1 or 2 i.e cross of a\_bin[1]/a\_bin[2] x cB x cC x cD . and ignore cross of bins b1 of cB with bins c2 of cC  
How to do it?  
please help.

---

<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:** [April 9, 2015, 4:04pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/2 "2015-04-09T16:04:08Z")

</div>

You can use the **intersect** operator:

```verilog

cross cA, cB, cC, cD {
  ignore_bins my_ignore = binsof(cA) intersect {1, 2} &&
    binsof(cB) intersect { cB.b1 } && binsof(cC) intersect { cC.c1 };
}

```

I’m not sure if instead of _intersect { 1, 2 }_ you could say _intersect { cA.a\_bin }_, so you’re just going to have to try it out. Would be nice of you to post the conclusion, too.

More info in section **19.6.1 Defining cross coverage bins** of the SV-2012 LRM.

---

<div class="post-metadata">

**Author:** ![sidharth.sankar77](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/5f8ce5/32.png) [@sidharth.sankar77](https://verificationacademy.com/forums/u/sidharth.sankar77)\
**Post date:** [April 10, 2015, 12:35pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/3 "2015-04-10T12:35:48Z")

</div>

_In reply to [Tudor Timi](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/2):_

Hi Todor,  
Thanks for the help.  
When I am using binsof(cB) intersect { cB.b1 } , I am getting hierarchical name component lookup failed at cB.

---

<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:** [April 10, 2015, 12:44pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/4 "2015-04-10T12:44:03Z")

</div>

_In reply to [sidharth.sankar77](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/3):_

This is a limitation of your simulator then, since the code I posted is based on the example from the LRM. You can just get away with copying the ranges for _b1_ and so on in the cross definition. I know it’s not nice since you have the same thing defined in two places, but it’s the only thing you can do until your simulation vendor implements the full SV standard.

---

<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:** [April 10, 2015, 3:08pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/5 "2015-04-10T15:08:38Z")

</div>

_In reply to [Tudor Timi](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/4):_

sidharth.sankar77,

Can you post a complete short example to see if you’ve made any mistakes. Also, I do not think the first term “binsof(cA) intersect {1, 2} &&” because that would be true for any bin tuple.

---

<div class="post-metadata">

**Author:** ![prashant.kaushik](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/prashant.kaushik/32/3007_2.png) [@prashant.kaushik](https://verificationacademy.com/forums/u/prashant.kaushik)\
**Post date:** [May 21, 2015, 10:47am UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/6 "2015-05-21T10:47:58Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/5):_

I can figure out only first part, for which information is complete.

```verilog
cross cA, cB, cC, cD {
  // Your requirement is (a_bin[0] or a_bin[1]) x cB x cC x cD.
  // i.e either a_bin[0] x cB x cC x cD 
  // or a_bin[1] x cB x cC x cD should be considered. 
  //         
  // So, it seems me there must a condition (Decoding) for it. 
  // This conditions should be passed while creating this cg.
  ignore_bins my_ignore = { (<condition>) ? binsof(cA) intersect {0} : binsof(cA) intersect {1} }; 
}

```

---

<div class="post-metadata">

**Author:** ![Arjun\_Suresh\_Kumar](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/arjun_suresh_kumar/32/1874_2.png) [@Arjun\_Suresh\_Kumar](https://verificationacademy.com/forums/u/Arjun_Suresh_Kumar)\
**Post date:** [June 11, 2021, 2:28pm UTC](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/7 "2021-06-11T14:28:53Z")

</div>

_In reply to [sidharth.sankar77](https://verificationacademy.com/forums/t/cross-coverage-with-ignore-bin/30529/6):_

This approach will work.

cross cA, cB, cC, cD {  
ignore\_bins my\_ignore = binsof(cA) intersect {1, 2} && binsof(cB.b1) && binsof(cC.c1);  
}
