In my TB, I have an array of uvm_agents, whose analysis ports all broadcast to the same write analysis imp port function in the singleton scoreboard. These uvm_agents are of the same type and their analysis port packet is of same type too.
Running into this case, where two agents happen to monitor transactions in the same cycle, and the scoreboard's write_ imp port function gets confused within these two callers.
something like below (a typical scoreboard setup with analysis imp port):
`uvm_analysis_imp_decl(_req)
class my_scoreboard extends uvm_scoreboard;
...
uvm_analysis_imp_req #(req_item, my_scoreboard) req_imp_port;
function void write_req(req_item t);
int num = t.req_id;
// printing num
...
endfunction
....
endclass
So in my scenario, say agent[0] and agent[1] both see a packet respectively (called T0 and T1), in the same cycle; the write_req function is invoked for T0 and T1 respectively, so 2 times, it seems to get confused on the function's context, and confusing the value of local var 'num' in the two calls.
I am trying to use automatic keyword to the write_ imp port function as a solution, but wondering is write_ imp port function generally a static function? Also wondering if there is a better solution.