Here is my code and the issue I’m facing is this
so lets say in first edge I get wvalid and wstall sampling and my ior_txn.cmd_delay gets a value of 5 and after I put it in write method it gets hit for 1 time in coverage database. But in next posedge when my rvalid and rstall sampling happens write method is called again and even though cmd delay is not executing the value for cmd delay gets updated again and I get a score of 2 for value 5 in database instead of 1. Is there any way to control specific pkts of sequence item in write method?
task collect_data();
forever begin
@(cmd_vif.monitor_cb);
//cmd_channel
if(cmd_vif.monitor_cb.wvalid == 1'b1) begin
cmd_valid_cyc++;
if(cmd_vif.monitor_cb.wstall == 1'b0) begin
cmd_stall_cyc++;
ior_txn.cmd_delay = cmd_valid_cyc - cmd_stall_cyc;
stall_en=1;
`uvm_info(get_name(),$sformatf("CMD delay is %0d",ior_txn.cmd_delay),UVM_HIGH)
end
end
//rsp3_channel
if(rsp3_vif.monitor_cb.rvalid == 1'b1) begin
rsp3_valid_cyc++;
if(rsp3_vif.monitor_cb.rstall == 1'b0) begin
rsp3_stall_cyc++;
stall_en =1 ;
ior_txn.rsp3_delay = rsp3_valid_cyc - rsp3_stall_cyc;
ior_txn.rsp3_direction = dir;
`uvm_info(get_name(),$sformatf("RSP3 delay is %0d in %s direction",ior_txn.rsp3_delay,ior_txn.rsp3_direction.name()),UVM_HIGH)
end
end
stall_ap.write(ior_txn);
end
endtask