Sanity check on dynamic bins

Hi all, I’m very new to coverage and I have the following issue. Let’s say I’m defining a cover point as the following :

logic [MAX_SLOT-1:0] new_slot_alloc

covergroup fcov_slot_coverage (input int SS) @ (posedge clk);
   cp_sees_new_slot : coverpoint new_slot_alloc {
           bins new_slot[new_slot_alloc-1] = bins_queue_onehot_compute(SS);
           }
endgroup

function automatic bins_queue_onehot_t bins_queue_onehot_compute(int bin_cnt);
  bins_queue_onehot_t bins_q;
  for (int i = 0; i < MAX_SLOT; i += 1) begin
    if ( i != bin_cnt ) begin
      bins_q.push_back({MAX_SLOT{1'b1}} & 1'b1 << i);
    end
  end
  return bins_q;
endfunction

for (genvar SS = 0; SS < MAX_SLOT; SS++) begin : g_loop
     fcov_slot_coverage cg_slot = new(SS);
end

The idea behind is, to create a covergroup for every slot. The signal new_slot_alloc it’s a onehot signal by design so I essentially want to create a coverpoint contianing MAX_SLOT -1 bins and each bins has a hit value corresponding to one of the possible onehot compination in new_slot_alloc (removing the combination for the slot itself). Just a quick example, let’s say MAX_SLOT is equal to 5, for slot 0 (SS = 0) I would expect the bins to be :

  • new_slot[0] hits for 5’b00010
  • new_slot[1] hits for 5’b00100
  • new_slot[2] hits for 5’b01000
  • new_slot[3] hits for 5’b10000
    For slot 1 :
  • new_slot[0] hits for 5’b00001
  • new_slot[1] hits for 5’b00100
  • new_slot[2] hits for 5’b01000
  • new_slot[3] hits for 5’b10000
    etc…

The question is, is there a way to print the configuration of each coverpoint ? Or is there a way to sanity check this ?

Most tools have the ability to print out detailed coverage reports for each bin. Check your tool’s User Manual.

It’s not clear to me whay you need the generated covergroup instances if they are all sampling the same new_slot_alloc signal. You need to hit all combinations without excluding the slot to get 100% coverage.

You probably meant to write

bins new_slot[MAX_SLOT] = bins_queue_onehot_compute(SS);

Also, the following may be easier to read

bins_q.push_back(MAX_SLOT'(1'b1 << i));
1 Like