Why ignore_bins is not considering 'iff' condition?

Hi,

I am providing transaction as GREEN and green_signal_enable == 1.
In the above case ignore_green should not be generated in coverage report but it is generating it.
Below Code is ran in vcs_2014.03-2.

colour_type : coverpoint cov_item.colour_type iff(cov_colour_type_flag){
   bins red = {transaction::RED};
   bins green = {transaction::GREEN};
   bins yellow = {transaction::YELLOW};
   ignore_bins ignore_green = {transaction::GREEN} iff(config.green_signal_enable == 0);
   option.weight = 0;
}

Please suggest where I am wrong,how can I solve this ignore_bins.

Thanks,
Naveen

The iff construct used in a covergroup is only a sampling filter - it does not affect the construction of bins. Technically, an ignore_bin is never sampled so the iff construct would have no effect, but some tools do count the ignore_bin for debugging purposes.

A better option would be to use a new 1800-2012 feature for programmable bin construction as explained in this blog.

A suggestion based on your example is:

module top;
  typedef enum {BLACK, RED, GREEN, YELLOW } colour_e;
   colour_e colour_type, enabled_colours[$];
   
   covergroup ct_cg;
      coverpoint colour_type {
	 bins colours[] = enabled_colours; 
      }
   endgroup 
   ct_cg ct;
   bit 	       enable_green = 0;
   
   initial begin
      enabled_colours.push_back(RED);
      if (enable_green) enabled_colours.push_back(GREEN);
      enabled_colours.push_back(YELLOW);
      ct = new();
      ct.sample();
      colour_type = RED;
      ct.sample();
      colour_type = GREEN;
      ct.sample();
      colour_type = YELLOW;
      ct.sample();
   end
endmodule