当不在sequence组件中时,提起和撤销objection的方式:
当不在sequence中可以使用phase来控制验证平台的开启和关闭。
task my_driver::main_phase(uvm_phase phase);
my_transaction tr;
phase.raise_objection(this); //提起objection
vif.data <= 8'b0;
vif.valid <= 1'b0;
while(!vif.rst_n)
@(posedge vif.clk);
for(int i = 0; i < 2; i++) begin
tr = new("tr");
assert(tr.randomize() with {pload.size == 200;});
drive_one_pkt(tr);
end
repeat(5) @(posedge vif.clk);
phase.drop_objection(this); //撤销objection
endtask
在sequence组件中,提起和撤销objection的方式:
在sequence中可以使用starting_phase来控制验证平台的开启和关闭。
class case0_sequence extends uvm_sequence #(my_transaction);
my_transaction m_trans;
function new(string name= "case0_sequence");
super.new(name);
endfunction
virtual task body();
if(starting_phase != null)
starting_phase.raise_objection(this); //提起objection
#100;
`uvm_info("sequence0", "body is called!!!", UVM_LOW)
if(starting_phase != null)
starting_phase.drop_objection(this); //撤销objection
endtask
`uvm_object_utils(case0_sequence)
endclass