How to define a condition for a covergroup (using iff)?

u could do by two ways

  1. use the sample method to trigger the cover group if the condition occurs.

i.e if(condition)
covergroup_name.sample()

  1. Suppose if you want to pass any value to the covergroup so that coverpoints could use that value then you can declare covergoup as the below example:
covergroup condition_cfg_cg with function sample(bit config_ind);
 
  cp_check : coverpoint value iff(config_ind == 1'b1); 
 endcovergroup