Class uvm_sequence_library
class my_seq_lib extends uvm_sequence_library #(my_item);
uvm_object_utils(my_seq_lib)
uvm_sequence_library_utils(my_seq_lib)
function new(string name="");
super.new(name);
init_sequence_library();
endfunction
...
endclass
Name |
Default value |
Description |
---|---|---|
REQ |
uvm_sequence_item |
|
RSP |
REQ |
Name |
Type |
Description |
---|---|---|
selection_mode |
Specifies the mode used to select sequences for execution If you do not have access to an instance of the library, use the configuration resource interface. The following example sets the config_seq_lib as the default sequence for the 'main' phase on the sequencer to be located at "env.agent.sequencer" and set the selection mode to <UVM_SEQ_LIB_RANDC>. If the settings are being done from within a component, the first argument must be this and the second argument a path relative to that component. uvm_config_db #(uvm_object_wrapper)::set(null,
"env.agent.sequencer.main_phase",
"default_sequence",
main_seq_lib::get_type());
uvm_config_db #(uvm_sequence_lib_mode)::set(null,
"env.agent.sequencer.main_phase",
"default_sequence.selection_mode",
UVM_SEQ_LIB_RANDC);
Alternatively, you may create an instance of the sequence library a priori, initialize all its parameters, randomize it, then set it to run as-is on the sequencer. main_seq_lib my_seq_lib;
my_seq_lib = new("my_seq_lib");
my_seq_lib.selection_mode = UVM_SEQ_LIB_RANDC;
my_seq_lib.min_random_count = 500;
my_seq_lib.max_random_count = 1000;
void'(my_seq_lib.randomize());
uvm_config_db #(uvm_sequence_base)::set(null,
"env.agent.sequencer.main_phase",
"default_sequence",
my_seq_lib);
|
|
min_random_count |
int unsigned |
Sets the minimum number of items to execute. Use the configuration mechanism to set. See selection_mode for an example. |
max_random_count |
int unsigned |
Sets the maximum number of items to execute. Use the configuration mechanism to set. See selection_mode for an example. |
sequence_count |
int unsigned |
Specifies the number of sequences to execute when this sequence library is started. If in <UVM_SEQ_LIB_ITEM> mode, specifies the number of sequence items that will be generated. |
select_rand |
int unsigned |
The index variable that is randomized to select the next sequence to execute when in UVM_SEQ_LIB_RAND mode Extensions may place additional constraints on this variable. |
select_randc |
bit[15:0] |
The index variable that is randomized to select the next sequence to execute when in UVM_SEQ_LIB_RANDC mode Extensions may place additional constraints on this variable. |
type_name |
string |
Name |
Description |
---|---|
valid_rand_selection |
Constrains select_rand to be a valid index into the sequences array |
valid_randc_selection |
Constrains select_randc to be a valid index into the sequences array |
valid_sequence_count |
Constrains sequence_count to lie within the range defined by min_random_count and max_random_count. |
Name |
Actual Type |
Description |
---|---|---|
this_type |
Constructors
Functions
- virtual function int unsigned select_sequence ( int unsigned max ) [source]
Generates an index used to select the next sequence to execute. Overrides must return a value between 0 and max , inclusive. Used only for <UVM_SEQ_LIB_USER> selection mode. The default implementation returns 0, incrementing on successive calls, wrapping back to 0 when reaching max . Select_sequence
- static function void add_typewide_sequence ( uvm_object_wrapper seq_type ) [source]
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. Add_typewide_sequence
- static function void add_typewide_sequences ( uvm_object_wrapper seq_types ) [source]
Registers the provided sequence types with this sequence library type. The sequence types will be available for selection by all instances of this class. Sequence types already registered are silently ignored. Add_typewide_sequences
- function void add_sequence ( uvm_object_wrapper seq_type ) [source]
Registers the provided sequence type with this sequence library instance. Sequence types already registered are silently ignored. Add_sequence
- virtual function void add_sequences ( uvm_object_wrapper seq_types ) [source]
Registers the provided sequence types with this sequence library instance. Sequence types already registered are silently ignored. Add_sequences
- virtual function void remove_sequence ( uvm_object_wrapper seq_type ) [source]
Removes the given sequence type from this sequence library instance. If the type was registered statically, the sequence queues of all instances of this library will be updated accordingly. A warning is issued if the sequence is not registered. Remove_sequence
- virtual function void get_sequences ( uvm_object_wrapper seq_types ) [source]
Append to the provided seq_types array the list of registered sequences . Get_sequences
- virtual function void do_print ( uvm_printer printer ) [source]
Do_print
Tasks
- virtual function execute ( uvm_object_wrapper wrap ) [source]
Execute
The uvm_sequence_library is a sequence that contains a list of registered sequence types. It can be configured to create and execute these sequences any number of times using one of several modes of operation, including a user-defined mode.
When started (as any other sequence), the sequence library will randomly select and execute a sequence from its sequences queue. If in <UVM_SEQ_LIB_RAND> mode, its select_rand property is randomized and used as an index into sequences . When in <UVM_SEQ_LIB_RANDC> mode, the select_randc property is used. When in <UVM_SEQ_LIB_ITEM> mode, only sequence items of the REQ type are generated and executed--no sequences are executed. Finally, when in <UVM_SEQ_LIB_USER> mode, the select_sequence method is called to obtain the index for selecting the next sequence to start. Users can override this method in subtypes to implement custom selection algorithms.
Creating a subtype of a sequence library requires invocation of the uvm_sequence_library_utils macro in its declaration and calling the init_sequence_library method in its constructor. The macro and function are needed to populate the sequence library with any sequences that were statically registered with it or any of its base classes.