Hello, so I am just learning UVM and I thought that you can declare set_drain_time in both start_of_simulation_phase(…) and run_phase(…), but if I declare my set_drain_time in the start_of_simulation_phase, it will give me a Null Object access.
This is the full error message:
Error-[NOA] Null object access
…/ex07/ex07_test1.sv, 40
The object at dereference depth 0 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.
Here are my start_of_simulation_phase and run_phase:
// Set some drain time before ending the simulation
// function void start_of_simulation_phase(uvm_phase phase);
// uvm_objection obj = phase.get_objection();
// obj.set_drain_time( this, 100ns ); // <- Line 40 is referring to this
// endfunction : start_of_simulation_phase
task run_phase(uvm_phase phase);
serial_sequence seq;
uvm_objection obj = phase.get_objection(); // If I comment this line and the line below out, and put these
obj.set_drain_time( this, 100ns ); // into the start_of_simulation_phase, I get the error
seq = serial_sequence::type_id::create();
phase.raise_objection(this);
if (m_env.m_serial_agent.m_sequencer != null)
seq.start(m_env.m_serial_agent.m_sequencer);
phase.drop_objection(this);
endtask : run_phase
My take is that obj has not being constructed in the start_of_simulation_phase, but where is that obj being constructed at all?
What could be the reason to this?