Coverage collector using interface handle

Hi…i want to sample & gather coverage of some DUT internal signals using virtual interface along with coverage of DUT inputs. I extended uvm_subscriber to declare coverage collector. I wrote 2 covergorups. One covergroup is sampled when write function is called from monitor to gather coverage on input transactions. In other covergroup, i am using virtual interface handle to write coverpoint & sampling on each negedge of internal signal data_valid as shown below. I want to start gathering coverage when an internal signal is asserted & stop gathering when deasserted.

  1. How can i implement this in coverage collector class ?
  2. How can i get a combined coverage report on both covergroups in report_phase ?

covergroup cg_dut@(negedge vif.data_valid);
PKT_DATA: coverpoint vif.pkt_data{
bins data1={[0:50]};
bins data2={[51:100]};
bins data3={[101:150]};
bins data4={[151:200]};
bins data5={[201:255]};

		}

endgroup

In reply to shekher201778:

I recommend making the covergroup part of the interface.

You should use your tool’s coverage reporting tools to report the complete coverage of your design and testbench instead of trying to collect coverage in the report_phase().