task body(); ip_transaction ip_tr; byteunsigned data_q[]; int data_size; foreverbegin p_sequencer.ip_tr_port.get_next_item(ip_tr);//从ip_sqr中获取ip_tr `uvm_info(get_type_name(),"get a ip_tr",UVM_LOW); data_size = ip_tr.pack_bytes(data_q)/8; req=new("req"); assert(req.randomize() with {req.pload.size()==data_size;}); foreach(data_q[i]) begin req.pload[i] = data_q[i]; end `uvm_send(req); `uvm_info(get_type_name(),"mac_sequence send a item",UVM_LOW); p_sequencer.ip_tr_port.item_done();//使用完ip_tr,调用item_done() end endtask
task pre_body(); // reference to Synopsys UVM LAB if(get_parent_sequence()==null && starting_phase!=null) begin starting_phase.raise_objection(this); `uvm_info(get_type_name(),$sformatf("%s starting phase raise %s phase",get_sequence_path(),starting_phase.get_name()),UVM_LOW); end endtask task post_body(); if(get_parent_sequence()==null && starting_phase!=null) begin starting_phase.drop_objection(this); `uvm_info(get_type_name(),$sformatf("%s starting phase drop %s phase",get_sequence_path(),starting_phase.get_name()),UVM_LOW); end endtask