Hello!
Optimally I want to make a run_phase loop until meet to expected coverage (for example 100%) cross over classes.
So far my code does not work. What should I make it?
Here is my code example.
class apb_test extends uvm_test;
`uvm_component_utils(apb_test)
.......// bla bla bla
extern function new(string name="apb_test", uvm_component parent);
extern virtual function void build_phase(uvm_phase phase);
extern virtual function void end_of_elaboration();
extern task run_phase(uvm_phase phase);
endclass
task apb_test::run_phase(uvm_phase phase);
apb_seq seq;
apb_subscriber sub;
seq = apb_seq::type_id::create("seq");
phase.raise_objection(this, "Starting apb_seq main phase");
repeat (40) begin // I want to change this to while() using coverage
//$display("%t Starting sequence apb_seq run_phase",$time);
seq.start(env.apb_agnt.seqr);
end
// For testing to get coverage value from subscriber class.
`uvm_info(get_type_name(), $sformatf("Coverage is: %0.2f%%", sub.cov), UVM_MEDIUM)
#100ns;
phase.drop_objection(this, "Finishing apb_seq in main phase");
phase.phase_done.set_drain_time(this, 50);
endtask
The Error Msg was
Error-[NOA] Null object access
apb_test.sv, 63 (`uvm_info(get_type_name(), $sformatf(“Coverage is: %0.2f%%”, sub.cov), UVM_MEDIUM))
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.