// default implementation returns 0, incrementing on successive calls,// wrapping back to 0 when reaching ~max~.//localintunsignedm_counter=0;externvirtualfunctionintunsignedselect_sequence(intunsignedmax);//-----------------------------// Group: Sequence registration//-----------------------------// Function: add_typewide_sequence//// Registers the provided sequence type with this sequence library// type. The sequence type will be available for selection by all instances// of this class. Sequence types already registered are silently ignored.//externstaticfunctionvoidadd_typewide_sequence(uvm_object_wrapperseq_type);
`uvm_object_param_utils(uvm_sequence_library#(REQ,RSP))`uvm_type_name_decl("uvm_sequence_library #(REQ,RSP)")// @uvm-ieee 1800.2-2020 auto 14.4.2// @uvm-ieee 1800.2-2020 auto 14.4.3externfunctionnew(stringname="");//--------------------------// Group -- NODOCS -- Sequence selection//--------------------------// Variable -- NODOCS -- selection_mode//// Specifies the mode used to select sequences for execution//// If you do not have access to an instance of the library,
externvirtualfunctionvoidget_sequences(refuvm_object_wrapperseq_types[$]);// @uvm-ieee 1800.2-2020 auto 14.4.4.10externvirtualfunctionuvm_object_wrapperget_sequence(intunsignedidx);// Function -- NODOCS -- init_sequence_library//// All subtypes of this class must call init_sequence_library in its// constructor.externfunctionvoidinit_sequence_library();// Macro -- NODOCS -- uvm_sequence_library_utils//// All subtypes of this class must invoke the `uvm_sequence_library_utils// macro.////| class my_seq_lib extends uvm_sequence_library #(my_item);//| `uvm_object_utils(my_seq_lib)
// get_sequence// ------------functionuvm_object_wrapperuvm_sequence_library::get_sequence(intunsignedidx);if(idx<sequences.size())returnsequences[idx];elsebegin`uvm_error("SEQ_LIB/GET_SEQ",$sformatf("idx %0d > number of sequences in library",idx))returnnull;endendfunction// select_sequence// ---------------functionintunsigneduvm_sequence_library::select_sequence(intunsignedmax);select_sequence=counter;counter++;