Coverage class - how to best pass in the variable being covered

covergroup cg_pixel(string name) with function sample(pixel_t item, stage_enum_t stage, color_enum_t color):
   option.per_instance = 1;
   option.name = name;
   ср_с: coverpoint item.pixel__color[stage][color];
   cp_x:coverpoint item.pixel_x[stage] ;
   ср_у: coverpoint item.pixel_y[stage];
   cp_z: coverpoint item.pixel_z[stage];
   cp_t:coverpoint item.pixel_texture[stage];
   cp_f: coverpoint item.pixel_feature|stage];
   cp_v: coverpoint item. pixel _visibility[stage];

   // Simple cross with simple logical ignore_bin
   cx_tfv: cross cp_t, cp_f, cp_v {
   ignore_bins not_visible = cx_tfv with (cp_v = DISABLE || cp_t = TEXNONE || cp_f == OFF);
   }
endgroup // cg pixel

This approach shows cover group “with function sample(…” as a way to pass things to the sample. I this what you were looking for? Please see my example Building Sparse Cross Coverage Bins for arrays of enum'ed datatypes

TomT…