u could do by two ways
- use the sample method to trigger the cover group if the condition occurs.
i.e if(condition)
covergroup_name.sample()
- 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