How to get values of different bins of a coverpoint?

Hi,

I have a coverpoint like described below:

`define DIVIDE_BY_3(x) (x%3!=0) ? ((x+(3-(x%3)))/3) : (x/3)

mptr : coverpoint packet.mptr
{
bins range_low = {[64’h0000_0001 : DIVIDE_BY_3(64'hffff_ffff_ffff_ffff)]}; bins range_medium = {[(DIVIDE_BY_3(64’hffff_ffff_ffff_ffff) + 1) : (DIVIDE_BY_3(64'hffff_ffff_ffff_ffff) << 1)]}; bins range_high = {[((DIVIDE_BY_3(64’hffff_ffff_ffff_ffff) << 1) + 1) : (64’hffff_ffff_ffff_ffff)]};
}

Now I suspect that I am not getting proper ranges of bins through this macro(May be one reason could be size of x, which is 64). So in Coverage Report, I want to check, that all 3 bins has got which range of values.

How can I do it in QuestaSIM?

This forum is not really for too specific help. But there is a much better way to model the bins for what you want.

mptr : coverpoint packet.mptr
{
bins range[3] = { [64'h0000_0001 : 64'hffff_ffff_ffff_ffff] };
}

The range values are uniformly distributed among the 3 bins.

In reply to dave_59:

@dave_59 : Yes this is very easy solution, compared to my logic.

But does it work for variables. Like suppose, I require bins as below:

bins range[3] = {[32’h1 : config.num_of_ns]};

Now the value of this variable, may get changed before every sampling of the coverpoint.

So will the range get divided accordingly?

In reply to Karan:

The bins are set at the time of covergroup construction. That is the only time the value of the variable num_of_ns is read, and the bins will be uniformly distributed based on the value at construction. If you need bins for different ranges, you need to construct multiple covergroups. But there would be no way to merge these covergroups to get 100% coverage if you were to create a new covergroup instance for each sample.