Pass parameters to covergroups in SV Testbench
Assuming tb.gen_block_mem is a generate block, you'll have to put the covergroup in another generate block

for(genvar id=0;id&lt;MY_P;id++) begin : cg_block
 covergroup CG; 
  cp1 : coverpoint tb.gen_block_mem[id].var_x[3:0];
 endgroup : CG 
 CG cg  = new;
end : cg_block