# How many bins are created for b4\[\] = {\[79:99\],\[110:130\],140}

**URL:** <https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080>\
**Category:** SystemVerilog\
**Tags:** Coverage-bins, SystemVerilog, SystemVerilog-FunctionalCoverage\
**Created:** [December 7, 2022, 5:00pm UTC](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080 "2022-12-07T17:00:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SUNODH](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/sunodh/32/4411_2.png) [@SUNODH](https://verificationacademy.com/forums/u/SUNODH)\
**Post date:** [December 7, 2022, 5:00pm UTC](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080/1 "2022-12-07T17:00:34Z")

</div>

Hi

I have a doubt about how many bins are created for the below cover point

```verilog

bins b4[] = {[79:99],[110:130],140}

```

Are 3 bins only created  
b[0] for 79:99,  
b[1] for [110:130],  
b[2] for 140, or  
Total (21+21+1)43 bins created ?

and what if it is a fixed bin like

```verilog

bins b1[3] = {[79:99],[110:130],140}
bins b1[4] = {[79:99],[110:130],140}

```

how these values are spread out among bins?

---

<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:** [December 7, 2022, 9:13pm UTC](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080/2 "2022-12-07T21:13:51Z")

</div>

_In reply to [SUNODH](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080):_

When you have an open bracket set of bins, each range get expanded into a set of individual values with each value getting a bin. b4 creates 43 bins. And if there were duplicate values, they would get removed. In other words only one bin for a particular value gets created.

When you have a fixed size set of bins, the ranges also get expanded into a set of individual values in the order they appear. Duplicate values get retained in the order they appear.

b1[3] would be 3 bins with the first having the first 14 values 79-92, the second getting the next 14 values 93-99 & 110-116, and the third getting the last 15 values 117-130 & 140.

b1[4] would be 4 bins with 10, 10, 10, and 13 values each.

---

<div class="post-metadata">

**Author:** ![SUNODH](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/sunodh/32/4411_2.png) [@SUNODH](https://verificationacademy.com/forums/u/SUNODH)\
**Post date:** [December 8, 2022, 6:22am UTC](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080/3 "2022-12-08T06:22:11Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080/2):_

Hi dave,

if we consider

```verilog

b1[5] = {[79:99],[110:130],140} :: 8,8,8,8,11 :: b1[1]<79-86>, b1[2]<87-94>, b1[3]<95-99,110-112>, b1[4]<113-120>, b1[5]<121-130,140> :: 5 bins
b2[6] = {[79:99],[110:130],140} :: 7,7,7,7,7,8 :: b1[1]<79-85>, b1[2]<86-92>, b1[3]<93-99>, b1[4]<110-116>, b1[5]<117-123>, b1[6]<124-130,140> :: 6 bins

```

It implies bins are spread like below  
**Total no of vaues / bins == integer**  
for b1 43/5 == 8, b2 43/6 == 7  
Is this understanding correct?  
Correct me if I am wrong

Thanks

---

<div class="post-metadata">

**Author:** ![UVM\_LOVE](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/uvm_love/32/1684_2.png) [@UVM\_LOVE](https://verificationacademy.com/forums/u/UVM_LOVE)\
**Post date:** [December 8, 2022, 7:08am UTC](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080/4 "2022-12-08T07:08:46Z")

</div>

_In reply to [SUNODH](https://verificationacademy.com/forums/t/how-many-bins-are-created-for-b4-79-99-110-130-140/41080/3):_

For b4, I just calculate it as the below,

b4[4] =  
79~88 =\> 10  
89~98 =\> 10  
99, 110~118 =\>10  
119~128,129,130,140 =\> 13

Total 43.
