Running a default sequence in run_phase and main_phase

Can anyone help me out please,

As i started the default sequence in the run_phase of the sequencer, it was running perfectly fine.
(uvm_object_wrapper)::set(this,“sr1.run_phase”,“default_sequence”,seq_1::type_id::get());
But as i’m trying to start that in its main_phase, it gets terminated shortly.
(uvm_object_wrapper)::set(this,“sr1.main_phase”,“default_sequence”,seq_1::type_id::get());

Here’s the link to my eda code.

In reply to stanley_sam:

You should never run a default sequence, as it is very difficult to debug (as you are finding out), and it isn’t very reusable. Instead, you should start() the sequence as part of a test. If it needs to run as a background sequence, it should be forked() as required.

The problem with what you are trying to accomplish is that there are no objections in the main_phase. Therefore, the main_phase immediately exits and your sequence is killed before it is expected. If you change the run_phase() in your test to main_phase(), you will see the sequence run correctly.

In reply to cgales:

Thank You, it got cleared to me.