Hi,
I’m getting about 98% coverage when I write my coverage in monitor. However, I’m getting only about 2% coverage for the same signal when I create a separate class for coverage as a subscriber. Could someone please spot the issue. Below are the coverage and monitor class.
class uart_coverage extends uvm_subscriber#(uart_transaction);
`uvm_component_utils(uart_coverage)
uart_transaction t1;
covergroup uart_cg;
data_cp: coverpoint t1.out_data;
endgroup
function new(string name="", uvm_component parent);
super.new(name, parent);
uart_cg=new;
endfunction
function void write(T t);
t1= uart_transaction::type_id::create("t1");
uart_cg.sample();
endfunction
endclass
Monitor:
class uart_monitor_after extends uvm_monitor;
`uvm_component_utils(uart_monitor_after)
uvm_analysis_port #(uart_transaction) mon_ap_after;
virtual uart_if vif;
uart_transaction u_tx_cg;
function void build_phase(uvm_phase phase);
super.build_phase(phase);
mon_ap_after=new(.name ("mon_ap_after"),.parent(this));
if (!uvm_config_db #(virtual uart_if)::get(null, "uvm_test_top", "uart_if", vif))
`uvm_error("Monitor_before","Interface not found")
endfunction: build phase
task run_phase(uvm_phase phase);
uart_transaction u_tx_after;
begin
forever
begin
u_tx_after = uart_transaction::type_id::create("u_tx_after", this);
@(posedge vif.frame_end);
begin
u_tx_after.out_data = vif.rx_out;
mon_ap_after.write(u_tx_after);
end
end
end
endtask: run_phase
endclass