When should we implement raise_objection(this) and drop_objection(this) in pre_body() and post_body() task respectively?

Hi,
i am trying to implement raise_objection() and drop_objection() in pre/post body. the simulator is giving fatal error message like “Null instance encountered when dereferencing ‘this.starting phase’”. Please suggest me how to implement and what is necessary ?

Example :

virtual task pre_body();
starting_phase.raise_objection(this);
endtask

virtual task post_body();
starting_phase.drop_objection(this);
endtask

Thanks
kbkdec15

Hi,

I think you should use uvm_test_done.raise/drop_objection(this).

-Baser

Hi Basheer,

Thanks for your responce.

why should use uvm_test_done.raise/drop_objection(this) or starting_phase.raise/drop_objection(this).

i am using raise/drop_objections at Test class.

Thanks
kbkdec15

Hi Every One,

Please let me clear on this concept

Very advance Thanks

Regards
kbkdec15

It is highly recommended that raise_objection() and drop_objection() only be used in the run_phase() of your test. Since the run_phase() of your test will encapsulate all of your test sequences, there is no need to use raise_objection() or drop_objection() in any part of a sequence.

Hi Kbkdec :
Can you try to use raise_objection/drop_objection inside your seq body()? like

task body;
virtual task pre_start(); // optional
if ( starting_phase ! = null ) // to mk sure your seq is not sub_seq of another seq
staring_phase.raise_objection(this);

endtask

virtual task post_start(); // optional
if (starting_phase ! = null)
starting_address.drop_objection(this);

end
endtask

In reply to aming:

Hi Aming,

thanks for replay.

tool giving following error

Unresolved reference to ‘staring_phase’ in $root.staring_phase.raise_objection.

Thanks
kbkdec15

I am sorry, There is a typo there. Would you try starting_phase instead of staring_phase?