UVM End of test

In reply to AbdulRauf1251:

Hello @chr_sue, I have implemented my scoreboard just the way, you have told me, But I am still getting the same issues with having tlm-analysis fifos too.
I don’t know why this issue keeps on coming. After the end of the simulation in the check-phase, I am printing “how many entries are left in the fifo” and
the print shows that there are some entries in the fifo that the scoreboard’s run_phase was not able to process.

Meanwhile, I thought, might be my scoreboard’s objection is from dropping quickly, I can do something additional. So I have used the task phase_ready_to_end to prolong my scoreboard’s run_phase. I have put the task implementation below, for you to refer to. Can you please see if this is the right alternative approach and whether it makes sense to investigate further on this line… (I know your previous comment that the right code shouldn’t need these extension tricks, however just in case…)

We are out of wits here, and most likely missing something basic or it’s something to do with the simulator (Vivado 2021.2). If there’s a way that we can show (only) target code to you or somebody senior on a live session, we will be glad to do that.



class scoreboard extends uvm_scoreboard;
  `uvm_component_utils(scoreboard)
   uvm_tlm_analysis_fifo #(seq_item) fifo_Rec1;
   uvm_tlm_analysis_fifo #(seq_item) fifo_Trans1;
 
   function new(string name, uvm_component parent);
     super.new(name,parent);
   endfunction
 
   function void build_phase(uvm_phase);
      fifo_Rec1 = new("fifo_Rec1", this);
      fifo_Trans1 = new("fifo_Trans1", this);
   endfunction
 
task run_phase (uvm_phase phase);
  seq_item Rec1;
  seq_item Trans1;
  thread1();
endtask
 
function void compare_data (input bit [31:0] indata1, indata2);
 if (indata1 == indata2) begin
    `uvm_info(get_type_name(), $sformatf("compare passed"), UVM_LOW)
 end
 else begin 
    `uvm_error(get_type_name(), $sformatf("compare failed with indata1 = %0h indata2 = %0h", indata1, indata2))
 end
endfunction 
 
task thread1();
   forever begin
     fifo_Rec1.get(Rec1);
     `uvm_info(get_type_name(), $sformatf("Rec1 Received this Data: %0h", Rec1.data), UVM_MEDIUN)
     fifo_Trans1.get(Trans1);
     `uvm_info(get_type_name(), $sformatf("Trans1 Received this Data: %0h", Trans1.data), UVM_MEDIUM)
     compare_data(Trans1.data,Rec1.data);  // this function two inputs and check equality
   end	
endtask

function void phase_ready_to_end( uvm_phase phase );
  if(phase.get_name()!="run") return;
  if(fifoRec1.used()!=0) begin
    phase.raise_objection( this , "not yet ready to end phase" );
    fork begin
      wait_for_fifo_to_be_empty();
      phase.drop_objection( this , "ok to end phase" );
    end
    join_none
  end
endfunction : phase_ready_to_end

task wait_for_fifo_to_be_empty();
 while(fifoRec1.used()!=0)) 
 begin
	`uvm_info(get_type_name(),$sformatf("The Remaining Entries in the FIFO are: %0d",fifoRec1.used()),UVM_LOW)
 end
endtask

endclass