How to split a variable width using single coverpoint?

hi,

Below is the snippet code related to coverage

bit [15:0] data_in;

covergroup cg;
INPUT_DATA0 : coverpoint data_in[3:0] { bins data0 = [4’h0:4’hF] };
INPUT_DATA1 : coverpoint data_in[7:4] { bins data1 = [4’h0:4’hF] };
INPUT_DATA2 : coverpoint data_in[11:8] { bins data2 = [4’h0:4’hF] };
INPUT_DATA3 : coverpoint data_in[15:12] { bins data3 = [4’h0:4’hF] };
endgroup:cg

In the above example, four coverpoints are used to the same variable.
Can it be possible to work around with a single coverpoint? Please suggest me, if any other possible solution.

Thanks in advance,
Jagan Kudimi

In reply to jagan413:
It’s possible. But why? It would be much more complicated (you would need to expand out the … in the example below.

covergroup cg;
  coverpoint data_in { 
         wildcard bins data0[] = {'h???0, 'h???1, ..., 'h???F},
         wildcard bins data1[] = {'h??0?, 'h??1?, ..., 'h??F?},
         wildcard bins data2[] = {'h?0??, 'h?1??, ..., 'h?F??},
         wildcard bins data3[] = {'h0???, 'h1???, ..., 'hF???}
};
endgroup:cg

Hi Dave,

Thanks for reply.

I tried your suggestion and as you said it is laborious to expand each bin. It is fine now because the width of coverpoint is 16-bit. If the width of coverpoint changes to 32-bit then it will require more effort to expand each bin.

The reason I am opting for splitting input data because as the input data width of 16-bit so it will have 2^16 combinations. I don’t want to cover 2^16 possible values. So I divided input data into four 4-bits so that each 4-bit needs to cover 2^4 possible values.

Regards,
Jagan Kudimi

In reply to jagan413:

Jagan,
Try using a covergroup with arguments and pass various data slices to different instances (You will need a wrapper class around covergroup).

Good Luck
Srini
www.verifworks.com

Thanks srini for suggesting alternate solution