Array functional coverage

I have a pair of arrays (e.g. x[40], y[40]) that I’d like to get functional coverage for. I can see how to get coverage for the individual crosses, and even use a generic covergroup to generate crosses for each of the pairs. However, what I’d like to do is be able to combine the coverage for all of these covergroups into one, so that I can see how well I’m covering the entire X-Y space, not just for each pair. So to simplify,


//generic covergroup
covergroup gc (ref int a, ref int b) @cov_evt;
  coverpoint a
    { bins [4]; }
  coverpoint b
    { bins [4]; }
  ab: cross a, b
endgroup

class xy;
  int x[2], y[2];
  gc gc0 = new(x[0], y[0]);
  gc gc1 = new(x[1], y[1]);
  ...
endclass


At the sampling event then I get all of my gcs, but each is really covering the same thing. Is there any way to combine them?

Thanks

In reply to jzingman:

Here even though you have more than one instance of coverage it will try to sample one. To get this solved use option.per_instance = 1 here.

//generic covergroup
covergroup gc (ref int a, ref int b) @cov_evt;
  coverpoint a
    { bins [4]; }
  coverpoint b
    { bins [4]; }
  ab: cross a, b
  option.per_instance = 1;
endgroup

Recompile the code and run , you could see the difference.

Regards,
Vinay Jain