Defining specific bins

Hello Forum Moderators,
I have a variable ‘io_size’ defined as bit[18:0] io_size
The intent is to define a separate bin for multiple of 512 upto 256K (Eg: 512 , 1024 , … 256K )
Here is my 1st attempt ::

 covergroup cov1; // embedded covergroup
  coverpoint io_size
  {
    // bins p1_five_one_two[] = {[1:(256*1024)]} with ( item % 512 == 0 );  // Alternative 
       bins p1_five_one_two[] = {[512:262144]} with ( item % 512 == 0 );
  }  
 endgroup

To my surprise this ends up creating 256 bins ( instead of expected 512 bins ) ::
p1_five_one_two_00200
p1_five_one_two_00400
p1_five_one_two_00600

p1_five_one_two_1fc00
p1_five_one_two_1fe00
p1_five_one_two_20000 // Last bin is actually the 256th bin

The expectation was that the last bin would be p1_five_one_two_40000

(2) I then divided the range in 2 separate dynamic bins in my 2nd attempt

 covergroup cov1; // embedded covergroup  
  coverpoint io_size
  {
    bins p1_five_one_two[] = {[512:131072]}    with ( item % 512 == 0 );
    bins p2_five_one_two[] = {[131584:262144]} with ( item % 512 == 0 ); 
  }  
 endgroup

This too creates 256 bins ( instead of expected 512 bins ) ::
p2_five_one_two_20200
p2_five_one_two_20400
p2_five_one_two_20600

p2_five_one_two_3fc00
p2_five_one_two_3fe00
p2_five_one_two_40000 // Last bin is actually the 256th bin

(3) I then defined 2 separate coverpoints ( one for half range ) ::

 covergroup cov1; // embedded covergroup
  
  Lower:coverpoint io_size
  {
    bins p1_five_one_two[] = {[512:131072]}    with ( item % 512 == 0 ); 
  }  
  Upper:coverpoint io_size
  {
    bins p2_five_one_two[] = {[131584:262144]} with ( item % 512 == 0 ); 
  }  
 endgroup

Finally this ends up creating 512 bins as per expectations ( 256 for Lower , 256 for Upper )
p1_five_one_two_00200
p1_five_one_two_00400
p1_five_one_two_00600

p1_five_one_two_1fc00
p1_five_one_two_1fe00
p1_five_one_two_20000 // 256 bins for Lower

p2_five_one_two_20200
p2_five_one_two_20400
p2_five_one_two_20600

p2_five_one_two_3fc00
p2_five_one_two_3fe00
p2_five_one_two_40000 // 256 bins for Upper

I would like to know why the initial two attempts did not end up generating 512 bins ?
Did I miss out on anything ?

Thanks in Advance

Thanks for sharing the detailed observation.

I run your code on EDA Playground to verify the behavior, and here’s what I found:

  1. Single Coverpoint with One Dynamic Bin Array
covergroup cov1;
  coverpoint io_size {
    bins p1_five_one_two[] = {[512:262144]} with ( item % 512 == 0 );
  }
endgroup
  • All 512 bins are actually created
  • From p1_five_one_two_00200 [512] to p1_five_one_two_40000 [262144]

  1. Two Dynamic Bin Arrays in One Coverpoint
covergroup cov1;
  coverpoint io_size {
    bins p1_five_one_two[] = {[512:131072]}    with ( item % 512 == 0 );
    bins p2_five_one_two[] = {[131584:262144]} with ( item % 512 == 0 );
  }
endgroup
  • All 512 (p1_five_one_two ->256 and p2_five_one_two ->256)bins are actually created
  • For p1_five_one_two : p1_five_one_two_00200[512] to p1_five_one_two_20000 [131072]
  • And for p2_five_one_two : p1_five_one_two_20200[131584] to p1_five_one_two_40000[262144]

  1. Two Separate Coverpoints
covergroup cov1;
  Lower: coverpoint io_size {
    bins p1_five_one_two[] = {[512:131072]} with ( item % 512 == 0 );
  }
  Upper: coverpoint io_size {
    bins p2_five_one_two[] = {[131584:262144]} with ( item % 512 == 0 );
  }
endgroup
  • Total 512 bins creates (256 for Lower, 256 for Upper)
  • Lower coverpoint : p1_five_one_two_00200[512] to p1_five_one_two_20000[131072]
  • Upper coverpoint : p1_five_one_two_20200[131584] to p1_five_one_two_40000[262144]
1 Like