Coverpoint for an array or queue

In reply to dave_59:

You will have to iterate over all the elements. You can either do it with one covergroup

covergroup cg with function sample(int cp);
coverpoint cp;
endgroup;
cg cvg=new();
foreach(temp_q[i]) cvg.sample(temp_q[i]);

or an array of covergroups.

event samplecg;
covergroup cg(ref int cp) @samplecg
coverpoint cp;
endgroup;
cg cvg[N];
foreach(temp_q[i]) cvg[i] = new(temp_q[i]);

Hi Dave. Is there a way to cover a queue of register address? I have a queue of 370 specific 17 bit addresses. I follow the similar approach mentioned above

covergroup

covergroup cg with function sample(bit [16:0] addr);
coverpoint addr;
endgroup;
cg cvg=new();

foreach(temp_q[i]) cvg.sample(temp_q[i]);

and loop thru the whole addr queue to sample and I received 40 auto bins. But the autobins does not match the address in the queue. I get utobins of range of address instead.