Is there a way to conditionally ignore coverpoints?

In reply to Bandaru sateesh:

In reply to shruti308:
I think we can do with “iff” expression.find the below snippet


bit [3:0]a,b;
reg valid;
covergroup coverage;
BIN :coverpoint a iff (valid) //covers a if valid is high.
BIN1: coverpoint b iff(!valid)//covers b if valid is low.
endgroup.

Anyone,correct me if i was wrong.

That is not correct the iff clause only affects the sampling conditions of the coverpoint.
I think maybe setting the weight of the coverpoint might work as mentioned in previous posts

  covergroup my_cov (ref int weight_data_cp);
    coverpoint addr;
    coverpoint data {
    	option.weight = weight_data_cp;
    }
  endgroup
// when creating the covergroup
    int weight_data_cp;
    weight_data_cp = 0;
    my_cov = new(weight_data_cp);

HTH,
-R