end// Check that the response queue is empty from earlier runsclear_response_queue();m_priority=this_priority;if(m_sequencer!=null)beginintegerhandle;uvm_tr_streamstream;if(m_parent_sequence==null)beginstream=m_sequencer.get_tr_stream(get_name(),"Transactions");handle=m_sequencer.begin_tr(this,get_name());m_tr_recorder=uvm_recorder::get_recorder_from_handle(handle);endelsebeginstream=m_sequencer.get_tr_stream(get_root_sequence_name(),"Transactions");handle=m_sequencer.begin_child_tr(this,(m_parent_sequence.m_tr_recorder==null)?0:m_parent_sequence.m_tr_recorder.get_handle(),get_root_sequence_name());
// with the other sequencer(s) using the sequencer unregister_sequence() // method.functionvoidkill();if(m_sequence_process!=null)begin// If we are not connected to a sequencer, then issue// kill locally.if(m_sequencer==null)beginm_kill();// We need to drop the objection if we raised it...if(get_automatic_phase_objection())beginm_safe_drop_starting_phase("automatic phase objection");endreturn;end// If we are attached to a sequencer, then the sequencer// will clear out queues, and then kill this sequencem_sequencer.kill_sequence(this);// We need to drop the objection if we raised it...
//// Empties the response queue for this sequence.virtualfunctionvoidclear_response_queue();response_queue.delete();endfunctionvirtualfunctionvoidput_base_response(inputuvm_sequence_itemresponse);if((response_queue_depth==-1)||(response_queue.size()<response_queue_depth))beginresponse_queue.push_back(response);return;endif(response_queue_error_report_disabled==0)beginuvm_report_error(get_full_name(),"Response queue overflow, response was dropped",UVM_NONE);endendfunction
end// Check that the response queue is empty from earlier runsclear_response_queue();m_priority=this_priority;if(m_sequencer!=null)begininthandle;if(m_parent_sequence==null)beginhandle=m_sequencer.begin_tr(this,get_name());m_tr_recorder=uvm_recorder::get_recorder_from_handle(handle);endelsebeginhandle=m_sequencer.begin_tr(.tr(this),.stream_name(get_root_sequence_name()),.parent_handle((m_parent_sequence.m_tr_recorder==null)?0:m_parent_sequence.m_tr_recorder.get_handle()));m_tr_recorder=uvm_recorder::get_recorder_from_handle(handle);endend
// This function is for Clean up any sequencer queues after exiting; if we// were forcibly stopped, this step has already taken placefunctionvoidclean_exit_sequence();if(m_sequencer!=null)beginm_sequencer.m_sequence_exiting(this);end// remove any routing for this sequence even when virtual sequencers (or a null sequencer is involved)// once we pass this point nothing can be routed to this sequence(id)foreach(m_sqr_seq_ids[seqrID])beginuvm_sequencer_bases=uvm_sequencer_base::all_sequencer_insts[seqrID];s.m_sequence_exiting(this);endm_sqr_seq_ids.delete();// Release the state mutex to allow for re-use (not recommended)m_sequence_state_mutex.put(1);endfunction
return;endfunctionfunctionvoidm_kill();do_kill();foreach(children_array[i])begini.kill();endif(m_sequence_process!=null)beginm_sequence_process.kill;m_sequence_process=null;endm_sequence_state=UVM_STOPPED;if((m_parent_sequence!=null)&&(m_parent_sequence.children_array.exists(this)))m_parent_sequence.children_array.delete(this);clean_exit_sequence();endfunction//-------------------------------// Group -- NODOCS -- Sequence Item Execution//-------------------------------// Function -- NODOCS -- create_item//// Create_item will create and initialize a sequence_item or sequence// using the factory. The sequence_item or sequence will be initialized// to communicate with the specified sequencer.// @uvm-ieee 1800.2-2020 auto 14.2.6.1protectedfunctionuvm_sequence_itemcreate_item(uvm_object_wrappertype_var,
// Empties the response queue for this sequence.// @uvm-ieee 1800.2-2020 auto 14.2.7.8virtualfunctionvoidclear_response_queue();response_queue.delete();endfunctionvirtualfunctionvoidput_base_response(inputuvm_sequence_itemresponse);if((response_queue_depth==-1)||(response_queue.size()<response_queue_depth))beginresponse_queue.push_back(response);return;endif(response_queue_error_report_enabled)beginuvm_report_error(get_full_name(),"Response queue overflow, response was dropped",UVM_NONE);endendfunction
// remove_sequence_from_queues// ---------------------------functionvoiduvm_sequencer_base::remove_sequence_from_queues(uvm_sequence_basesequence_ptr);inti;intseq_id;seq_id=sequence_ptr.m_get_sqr_sequence_id(m_sequencer_id,0);// Remove all queued items for this sequence and any child sequencesi=0;dobeginif(arb_sequence_q.size()>i)beginif((arb_sequence_q[i].sequence_id==seq_id)||(is_child(sequence_ptr,arb_sequence_q[i].sequence_ptr)))beginif(sequence_ptr.get_sequence_state()==UVM_FINISHED)`uvm_error("SEQFINERR",$sformatf("Parent sequence '%s' should not finish before all items from itself and items from descendent sequences are processed. The item request from the sequence '%s' is being removed.",sequence_ptr.get_full_name(),arb_sequence_q[i].sequence_ptr.get_full_name()))
endwhile(i<arb_sequence_q.size());// remove locks for this sequence, and any child sequencesi=0;dobeginif(lock_list.size()>i)beginif((lock_list[i].get_inst_id()==sequence_ptr.get_inst_id())||(is_child(sequence_ptr,lock_list[i])))beginif(sequence_ptr.get_sequence_state()==UVM_FINISHED)`uvm_error("SEQFINERR",$sformatf("Parent sequence '%s' should not finish before locks from itself and descedent sequences are removed. The lock held by the child sequence '%s' is being removed.",sequence_ptr.get_full_name(),lock_list[i].get_full_name()))lock_list.delete(i);m_update_lists();endelsebegini++;endendendwhile(i<lock_list.size());// Unregister the sequence_id, so that any returning data is droppedm_unregister_sequence(sequence_ptr.m_get_sqr_sequence_id(m_sequencer_id,1));endfunction// stop_sequences// --------------functionvoiduvm_sequencer_base::stop_sequences();uvm_sequence_baseseq_ptr;seq_ptr=m_find_sequence(-1);while(seq_ptr!=null)beginkill_sequence(seq_ptr);seq_ptr=m_find_sequence(-1);