How time advances in uvm scoreboard

In reply to svq:

Yes, in last transaction after_txn come first and before_queue has not entry compare_data won’t execute and forever loop again block at after_fifo.get().

Btw, you can add wait after fifo like below.


task run_phase (uvm_phase phase);
 forever begin
  after_fifo.get (after_txn);  // this is an uvm tlm analysis fifo which is getting the output txn from dut via monitor)
  
  // We are make sure before_queue transaction is available before compare.
  wait (before_queue.size > 0);

  // before_queue is populated by a uvm_tlm_analysis_imp port's write methode when it receives packet from input monitor
  //if (before_queue.size())
  compare_data();
 end
endtask

And 1 more thing, if before_queue is used for expected data and after_fifo used for actual data.
Then, I think you need to check your TB because expected data must arrive before actual data.
If it not the case, you can simply wait for before_queue has entry ( like above code ).

Thanks!