[source]

Class uvm_sequence_library

uvm_pkg::uvm_sequence_library <REQ, RSP> + m_abort : bit + max_random_count : int unsigned + min_random_count : int unsigned + select_rand : int unsigned + select_randc : bit[15:0] + selection_mode : uvm_sequence_lib_mode + sequence_count : int unsigned + type_name : string + __m_uvm_field_automation(): void + add_sequence(): void + add_sequences(): void + add_typewide_sequence(): void + add_typewide_sequences(): void + body() + create(): uvm_object + do_print(): void + execute() + get_object_type(): uvm_object_wrapper + get_sequences(): void + get_type(): type_id + get_type_name(): string + init_sequence_library(): void + m_add_typewide_sequence(): bit + m_check(): bit + m_dyn_check(): bit + m_get_config(): void + m_static_check(): bit + remove_sequence(): void + select_sequence(): int unsigned

Inheritance Diagram of uvm_sequence_library

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.

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=&quot;&quot;);
     super.new(name);
     init_sequence_library();
   endfunction
   ...
endclass
Parameters

Name

Default value

Description

REQ

uvm_sequence_item

RSP

REQ

Variables

Name

Type

Description

selection_mode

uvm_sequence_lib_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,
                                   &quot;env.agent.sequencer.main_phase&quot;,
                                   &quot;default_sequence&quot;,
                                   main_seq_lib::get_type());

uvm_config_db #(uvm_sequence_lib_mode)::set(null,
                                   &quot;env.agent.sequencer.main_phase&quot;,
                                   &quot;default_sequence.selection_mode&quot;,
                                   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(&quot;my_seq_lib&quot;);

my_seq_lib.selection_mode = UVM_SEQ_LIB_RANDC;
my_seq_lib.min_random_count = 500;
my_seq_lib.max_random_count = 1000;
void&#39;(my_seq_lib.randomize());

uvm_config_db #(uvm_sequence_base)::set(null,
                                   &quot;env.agent.sequencer.main_phase&quot;,
                                   &quot;default_sequence&quot;,
                                   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

Constraints

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.

Typedefs

Name

Actual Type

Description

this_type

uvm_sequence_library#(REQ, RSP)

Constructors

function new ( string name ) [source]

Create a new instance of this class. New

Functions

virtual function string get_type_name ( ) [source]

Get the type name of this class. Get_type_name

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

function void init_sequence_library ( ) [source]

All subtypes of this class must call init_sequence_library in its constructor. Init_sequence_library

virtual function void do_print ( uvm_printer printer ) [source]

Do_print

Tasks

virtual function execute ( uvm_object_wrapper wrap ) [source]

Execute

virtual function body ( ) [source]

Body