Coverage bins in a separate class

Hello Everyone,

I wanted to keep the bins of my covergroup flexible, to facilitate reuse. Is it possible to supply bin information to coverpoint using hierarchical access? Writing an example below to explain what I want to do:


//configuration class
class my_config;
  bins bin_info;
endclass

//main class
class my_sampler;
   my_config config_h;

   covergroup my_cov;
    a: coverpoint x { bins config_h.bin_info };
   endgroup

   function new (my_config config_h);
     this.config_h = config_h;
      my_cov = new();
   endfunction
endclass

In reply to desaivs1994:

You cannot do anything like that. But you can define a covergroup outside of a class and pass arguments to the constructor or sample method to make it more re-usable.

In reply to desaivs1994:

I don’t believe this would be a good idea. A covergroup should be sampled for each sequence item. The configuration object will be created once for a test, i. e. it will not give you a lot of information.