Functional coverage

class functional_coverage;
 virtual ahb_intf intf;

 covergroup cg;
   coverpoint intf.addr{
                        bins first_addr=32'h0;
                        bins second_addr=32'h04;
                        ...............
                        bins tenth_addr=32'h20;
}
 endgroup

function new();
cg cg_inst=new();
endfunction
endclass


module tb_top;
ahb_intf intf;
functional_coverage cov;
.........
initial begin
cov=new();
cov.intf=intf;
run_test();
cov.cg.sample();
endmodule

from run_test my testcase will start and it will drive addr for 10 times to dut. and my coverage sampling for last iteration(covering only last bin tenth_addr remaining not hitting ) and its not sampling all 10 iterations(10 addresses). can someone help me to sample my coverage for all 10 iterations from tb_top file.

In reply to verificationstud:

Please use code tags making your code easier to read. I have added them for you.

Code after run_test() is never executed (unless you set_finish_on_completion to 0).

But you want to collect coverage from a monitor of you DUT interface. MetricAnalyzers | Verification Academy