An Overview of UVM End-of-Test Mechanisms

I am exploring different ways to end a UVM test. One method that has come often from studying different blogs from Verification Academy and other sites is to use the Phase Ready to End. I have some questions regarding the implementation of this method.

I am using this method in scoreboard class, where my understanding is after my usual run phase is finished, it will call the phase ready to end method and implement it. The reason I am using it my scoreboard’s run_phase finishes early, and there are some data into queues that need to be processed. So I am trying to prolong this scoreboard run_phase using this method. Here are is some pseudo-code that I have used.

function void phase_ready_to_end(uvm_phase phase);
if (phase.get_name() != “run”) return;
if (queue.size() != 0) begin
phase.raise_objection(.obj(this));
fork
begin
delay_phase(phase);
end
join_none
end
endfunction

task delay_phase(uvm_phase phase);
wait(queue.size() == 0);
phase.drop_objection(.obj(this));
endtask
Here are some of the ungated thoughts in my mind on which I need guidance and help.

to the best of my understanding the phase_ready_to_end is called at the end of run_phase and when it runs it raises the objection for that scoreboard run_phase and runs delay_phase task.

That Delay Phase task is just waiting for the queue to end, but I am not seeing any method or task which will pop the items from the queue. Does I have to call some method to pop from the queue or as according to the 1st point above the raised objection will start the run phase so there is no need for that and we have to wait for a considerable amount of time?

I see you already asked this question on StackOverflow (system verilog - UVM End of test Objection Mechanism and Phase Ready to End Implementation - Stack Overflow). Let’s continue the conversation there.

sure

Hi Tudor,
Thanks for a great posting about [An Overview of UVM End-of-Test Mechanisms,
I made a simple example to try to understand end-of-test mechanism.

I’m trying to finish the forever statement in run_phase(). but It never finish the simulation and also no time consume during the simulation. Can’t I consume the time during the simulation with forever?
How do I finish the simulation with forever statment?

I see that the question on StackOverflow has an accepted answer, so 'm guessing this is solved, right?

1 Like

Yes, I checked it. Thank you.