# Iff in covergroup

**URL:** <https://verificationacademy.com/forums/t/iff-in-covergroup/37443>\
**Category:** Coverage\
**Tags:** Coverage\
**Created:** [April 15, 2020, 4:33pm UTC](https://verificationacademy.com/forums/t/iff-in-covergroup/37443 "2020-04-15T16:33:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tech\_savvy](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/t/d2c977/32.png) [@tech\_savvy](https://verificationacademy.com/forums/u/tech_savvy)\
**Post date:** [April 15, 2020, 4:33pm UTC](https://verificationacademy.com/forums/t/iff-in-covergroup/37443/1 "2020-04-15T16:33:16Z")

</div>

Can we use iff for covergroup?  
Can construction of covergroup be prevented with the use of iff?

---

<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:** [April 15, 2020, 4:59pm UTC](https://verificationacademy.com/forums/t/iff-in-covergroup/37443/2 "2020-04-15T16:59:06Z")

</div>

_In reply to [tech\_savvy](https://verificationacademy.com/forums/t/iff-in-covergroup/37443):_

I don’t think this is allowed for covergroups but for coverpoints if you check the 2017 IEEE LRM sections:  
**19.3 Defining the coverage model: covergroup**  
_covergroup\_declaration ::= // from A.2.11  
covergroup covergroup\_identifier [( [ tf\_port\_list] ) ] [coverage\_event] ;  
{ coverage\_spec\_or\_option }  
endgroup [: covergroup\_identifier]  
coverage\_spec\_or\_option ::=  
{attribute\_instance} coverage\_spec  
| {attribute\_instance} coverage\_option ;  
coverage\_option ::=  
option.member\_identifier = expression  
| type\_option.member\_identifier = constant\_expression  
coverage\_spec ::=  
cover\_point  
| cover\_cross  
coverage\_event ::=  
clocking\_event  
| with function sample ( [tf\_port\_list] )  
| @@( block\_event\_expression )  
block\_event\_expression ::=  
block\_event\_expression or block\_event\_expression  
| begin hierarchical\_btf\_identifier  
| end hierarchical\_btf\_identifier  
hierarchical\_btf\_identifier ::=  
hierarchical\_tf\_identifier  
| hierarchical\_block\_identifier  
| [hierarchical\_identifier. | class\_scope] method\_identifier_

There is no mention of **iff** \*\*

**19.5 Defining coverage points**  
The expression within the _ **iff** _ construct specifies an optional condition that disables coverage for that _ **coverpoint** _. If the guard expression evaluates to false at a sampling point, the coverage point is ignored.  
For example:

```verilog
covergroup g4;
coverpoint s0 iff(!reset);
endgroup

```

In the preceding example, coverage point s0 is covered only if the value reset is false.  
Maybe you need to explain what you want to achieve so people can provide you with more help

HTH,

-R

---

<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 15, 2020, 5:10pm UTC](https://verificationacademy.com/forums/t/iff-in-covergroup/37443/3 "2020-04-15T17:10:15Z")

</div>

_In reply to [tech\_savvy](https://verificationacademy.com/forums/t/iff-in-covergroup/37443/2):_

The **iff** construct is used with a **coverpoint** or **bin** expression to enable or disable sampling. It does not affect cevergroup or bin construction. If you want to prevent construction, simply use a procedural **if** statement around the covergroup’s **new** () constructor.
