# Toggle Coverage through Functional Coverage

**URL:** <https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582>\
**Category:** Coverage\
**Tags:** Assertion-Based-Verification, System-Verilog-Basics, Coverage, SystemVerilog-FunctionalCoverage\
**Created:** [May 13, 2020, 6:51pm UTC](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582 "2020-05-13T18:51:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashokmehta72](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ecd19e/32.png) [@ashokmehta72](https://verificationacademy.com/forums/u/ashokmehta72)\
**Post date:** [May 13, 2020, 6:51pm UTC](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582/1 "2020-05-13T18:51:24Z")

</div>

I know that Code Coverage is the right way to do toggle coverage. Doing that through Functional Coverage is a long stretch. But, for the sake of argument, I want to select a few signals and do toggle coverage through functional coverage. Will the following work?

bit[7:0] adr1;

covergroup gc @(posedge clk);  
ac: coverpoint adr1  
{  
bins ar1 = (1’b0 =\> 1’b1 || 1’b1 =\> 1’b0);  
}  
endgroup

gc gcInst = new;

Thanks.

---

<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:** [May 13, 2020, 8:09pm UTC](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582/2 "2020-05-13T20:09:11Z")

</div>

_In reply to [a72](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582):_

That gets interpreted as

```verilog
bins ar1 = (1'b0 => (1'b1 || 1'b1) => 1'b0);
// resolves to
bins ar1 = (8'h00 => 8'h01 => 8'h00);

```

Which is probably not what you are expecting. See [Bitwise toggle coverage for a bitvector | Verification Academy](https://verificationacademy.com/forums/systemverilog/bitwise-toggle-coverage-bitvector#reply-89793)

---

<div class="post-metadata">

**Author:** ![ashokmehta72](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/a/ecd19e/32.png) [@ashokmehta72](https://verificationacademy.com/forums/u/ashokmehta72)\
**Post date:** [May 13, 2020, 8:31pm UTC](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582/3 "2020-05-13T20:31:07Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582/2):_

Thanks Dave. I looked at the link you provided. I see the following:

bins tr = (1=\> 0,0 =\> 1 ;}

So, is that the solution?

---

<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:** [May 13, 2020, 8:41pm UTC](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582/4 "2020-05-13T20:41:56Z")

</div>

_In reply to [a72](https://verificationacademy.com/forums/t/toggle-coverage-through-functional-coverage/37582/3):_

You have to create an array of covergroups instances, one for each bit.
