Enabling or disabling coverage

Is there a way to enable or disable a coverage using the configuration class?
I want to use the same coverage class for block level verification and for system level verification but in system level I want to disable some coverage that are not applicable on that level.

Do you have any examples?

If you can separate the functional coverage you want to collect into distinct covergroups, your coverage class can contain multiple covergroups. You can control which covergroups get constructed and sampled using your configuration class. Note that covergroups embedded in classes must be constructed inside the the embedding class’s constructor, so you need to make sure the configuration class is set up before the coverage class gets constructed.

If you can’t make distinct covergroups, your best options is to use your tool’s command line interface to exclude individual coverpoints and crosses.

In reply to dave_59:

Hi dave,

This is how I construct the covergroups:


function new(string name = "sent_spi_coverage", uvm_component parent=null);
  super.new(name, parent);

  covergroup_1=new();
  covergroup_2=new();
  covergroup_3=new();
endfunction

I’m planning to do this but I don’t know if this is possible in function new. If this is in build_phase then I can do it there.


function new(string name = "sent_spi_coverage", uvm_component parent=null);
  super.new(name, parent);

  covergroup_1=new();
  covergroup_2=new();
  if(cfg.has_covergroup_3) covergroup_3=new();
endfunction

In reply to Reuben:

Yes it’s possible, but you’ll have to get() the handle to the cfg class inside the constructor.