// try_next_item// -------------taskuvm_sequencer::try_next_item(outputREQt);intselected_sequence;timearb_time;uvm_sequence_baseseq;if(get_next_item_called==1)beginuvm_report_error(get_full_name(),"get_next_item/try_next_item called twice without item_done or get in between",UVM_NONE);return;end// allow state from last transaction to settle such that sequences'// relevancy can be determined with up-to-date informationwait_for_sequences();// choose the sequence based on relevancyselected_sequence=m_choose_next_request();
// try_next_item// -------------taskuvm_sequencer::try_next_item(outputREQt);intselected_sequence;uvm_sequence_requestselected_sequence_request;bitfound_item;timearb_time;if(get_next_item_called==1)beginuvm_report_error(get_full_name(),"get_next_item/try_next_item called twice without item_done or get in between",UVM_NONE);return;end// allow state from last transaction to settle such that sequences'// relevancy can be determined with up-to-date informationrepeat(m_wait_for_sequences_count)beginwait_for_sequences();
// m_safe_select_item// ---------------------taskuvm_sequencer_param_base::m_safe_select_item(inputbitget_next_item,outputREQt);processselect_process;uvm_sequence_requestselected_sequence_request;if(sequence_item_requested==0)beginm_select_sequence(selected_sequence_request);forkbeginselect_process=process::self();// re-arbitrate if the sequence was killed or finished after it won arbitration but before it was// able to send its request.foreverbeginselected_sequence_request.process_id.await();if(!m_req_fifo.is_empty())break;if(arb_completed.exists(selected_sequence_request.request_id))beginarb_completed.delete(selected_sequence_request.request_id);endm_select_sequence(selected_sequence_request);endendjoin_none// wait for thread to start to ensure it gets killed when peek returnswait(select_process!=null);endsequence_item_requested=1;if(get_next_item)get_next_item_called=1;m_req_fifo.peek(t);if((select_process!=null)&&(select_process.status!=process::FINISHED))select_process.kill();endtask
localstaticintg_sequence_id=1;localstaticintg_sequencer_id=1;protectedintm_wait_for_sequences_count;// specifies the # of times the sequencer// should call wait_for_sequences(). A// value > 1 allows sequencer stacking.// Function -- NODOCS -- new//// Creates and initializes an instance of this class using the normal// constructor arguments for uvm_component: name is the name of the// instance, and parent is the handle to the hierarchical parent.// @uvm-ieee 1800.2-2020 auto 15.3.2.1externfunctionnew(stringname,uvm_componentparent);// Variable: wait_for_sequences_count// Controls the number of wait_for_sequences calls when selecting next sequence.//// By default, the sequencers will wait for 1 ~wait_for_sequences~ call
// -----------functionvoiduvm_sequencer_base::build_phase(uvm_phasephase);super.build_phase(phase);if(!uvm_config_db#(uvm_bitstream_t)::get(this,"","wait_for_sequences_count",m_wait_for_sequences_count))void'(uvm_config_db#(int)::get(this,"","wait_for_sequences_count",m_wait_for_sequences_count));if(m_wait_for_sequences_count<1)begin`uvm_warning("UVM/SQR/WFSC",$sformatf("attempt to set wait_for_sequences_count to '%0d' will be ignored, values must be 1 or greater!",m_wait_for_sequences_count))m_wait_for_sequences_count=1;endendfunction:build_phase// do_print// --------functionvoiduvm_sequencer_base::do_print(uvm_printerprinter);super.do_print(printer);printer.print_array_header("arbitration_queue",arb_sequence_q.size());foreach(arb_sequence_q[i])