How to end a test after scoreboard compare

My test terminates after last transaction is applied to DUT, through phase.drop_objection. Simulation ends before the scoreboard could compare the data. I tried to add delay before phase.drop_objection(), which allowed scoreboard to compare data.
Is there a cleaner/automatic way to drop the objection/end the simulation after comparing the data?

In reply to ak_verifsj:

My test terminates after last transaction is applied to DUT, through phase.drop_objection. Simulation ends before the scoreboard could compare the data. I tried to add delay before phase.drop_objection(), which allowed scoreboard to compare data.
Is there a cleaner/automatic way to drop the objection/end the simulation after comparing the data?

You can refer the EndOfTest mechanism in here: End of Test | UVM Cookbook

In reply to ak_verifsj:

My test terminates after last transaction is applied to DUT, through phase.drop_objection. Simulation ends before the scoreboard could compare the data. I tried to add delay before phase.drop_objection(), which allowed scoreboard to compare data.
Is there a cleaner/automatic way to drop the objection/end the simulation after comparing the data?

You’ll miss the last transaction nothing more the question is if this is important for you. If it is you define a drain_time. This is an absolute time afetr which the simulation stops. The problem is you do not know which time to set. The more elegant solution is to implement the phase_ready_to_end task. But in most cases it is not relevant missing the last ransaction.