Array of cover points in a covergroup

In reply to dave_59:

In reply to kvenkatv:
This should get you started

package global_types;
typedef bit [31:0] uint;
typedef uint uint_da[];
endpackage
module bot;
import global_types::*;
uint sig;
endmodule
module top;
import global_types::*;
bit clk;
uint_da encodings = onehots();
function uint_da onehots;
onehots = new[32];
foreach (onehots[i]) onehots[i] = 32'b1 << i;
endfunction : onehots
covergroup cg(ref uint arg)  @(posedge clk);
option.per_instance = 1;
coverpoint arg {
bins b[] = encodings;
}
endgroup : cg
genvar i;
for (i = 0; i<32;i++) begin : g_regs
bot u();
end
for (i = 0; i<32;i++) begin
cg cg_inst;
initial cg_inst = new(g_regs[i].u.sig);
end
endmodule : top

Just wanted to clarify should it be cg_inst[32] instead of cg_inst?


...
  cg cg_inst[32];
  genvar i;
   for (i = 0; i<32;i++) begin : g_regs
      bot u();
   end
   for (i = 0; i<32;i++) begin
      initial cg_inst[i] = new(g_regs[i].u.sig);