# Disabling illegal\_bins using iffs

**URL:** <https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473>\
**Category:** Coverage\
**Tags:** Coverage, iff, Transition-Coverage, illegal-bins\
**Created:** [February 5, 2016, 5:07pm UTC](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473 "2016-02-05T17:07:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cmdr\_Vimes](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/94ad74/32.png) [@Cmdr\_Vimes](https://verificationacademy.com/forums/u/Cmdr_Vimes)\
**Post date:** [February 5, 2016, 5:07pm UTC](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473/1 "2016-02-05T17:07:40Z")

</div>

I have some bins that I want to be illegal depending on a parameter

I have written this:

```verilog
bins mode_a = {3'b100};
illegal_bins no_a = {3'b100} iff (DISABLE);

```

Those bins work as expected. If DISABLE is true, no\_a overrules mode\_a and make mode\_a an illegal bin. If DISABLE is false, no\_a doesn’t overrule mode\_a so mode\_a is a valid bin.

I am trying to do the same with transitional bins:

```verilog
bins mode_a_b = (3'b100 => 3'b110);
illegal_bins no_a_b = (3'b100 => 3'b110) iff (DISABLE);

```

This does not do the same thing. Regardless of whether DISABLE is true or not, no\_a\_b overrules mode\_a\_b and makes it illegal.

Any suggestions?

---

<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:** [February 7, 2016, 9:47pm UTC](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473/2 "2016-02-07T21:47:15Z")

</div>

_In reply to [Cmdr\_Vimes](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473):_  
The **iff** clause is not be used to specify bin creation. It only affects which bins are hit during each sample by evaluating a guard expression each time the sample occurs.

```verilog
bins mode_a = {3'b100};
illegal_bins no_a = {3'b100} with (DISABLE);

```

The with clause gets evaluated when the covergroup gets constructed.

Unfortunately, transition bins have very limited functionality in SystemVerilog and you might be better off covering a sequence instead of using a covergroup.

---

<div class="post-metadata">

**Author:** ![Cmdr\_Vimes](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/c/94ad74/32.png) [@Cmdr\_Vimes](https://verificationacademy.com/forums/u/Cmdr_Vimes)\
**Post date:** [February 8, 2016, 4:48pm UTC](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473/3 "2016-02-08T16:48:43Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473/2):_

In my case DISABLE is a parameter.

```verilog
bins mode_a = {3'b100};
illegal_bins no_a = {3'b100} with (DISABLE);

```

does not compile and I get an error.

In the method I’m using (iff), both coverpoints get triggered but the illegal\_bin only get triggered if the iff is true, so the value goes into the illegal\_bin and the normal bin then becomes an illegal\_bin. Is there a specific reason that it doesn’t do the same for transition bins or is it just the limited functionality?

---

<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:** [February 9, 2016, 7:41am UTC](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473/4 "2016-02-09T07:41:02Z")

</div>

_In reply to [Cmdr\_Vimes](https://verificationacademy.com/forums/t/disabling-illegal-bins-using-iffs/31473/3):_

I get a warning about the mode\_a or no\_a bin being removed, depending on the value of DISABLE, no compiler errors. It’s possible you are using a version of a tool that does not support it yet. This was an 1800-2012 feature.

There are many problems with the specification of transition bins in the LRM. Here is [one of them](https://accellera.mantishub.com/view.php?id=4735). So I would stick with something simple, otherwise use a sequence or build your own state machine.
