In reply to VE:
Why don’t you set_drain_time(…) again in your write function? And you may need to get uvm_phase from write method. You can refer the following code:
uvm_domain common = uvm_domain::get_common_domain();
/* Get run_phase if you want to set drain_time for run_phase */
uvm_phase phase = common.find(uvm_run_phase::get());
if (phase != null) begin
phase.phase_done.set_drain_time(...);
end
That’s my idea, you can try it and let me know the result.
One more thing, set_drain_time is not recommended, you can use phase_ready_to_end instead:
https://verificationacademy.com/cookbook/endoftest