Jump to content

UVM sequence library


Recommended Posts

Hi all,


I would like to give the test writer the a way to select sequence distribution from a sequence list. I'm using the uvm_sequence_library class in order to control the sequences selection in a simulation.

I saw that the index of a sequence in the library is determined by the order of sequence registration to the library (using `uvm_add_to_seq_lib macro).

Is there a custom way to control the sequences index in the library? use enum or string instead or in addition to the index?

I have multiple tests where each can register its own sequences to the sequence library and may change the index value of a sequence.




Link to comment
Share on other sites

For what you want to do, it would be so much easier not to use the uvm_sequence_library and simply put the sequences into an array, and choose an array kind that suits how you want to index it. For example

uvm_object_wrapper seq_lib[type_e]; // associative array indexed by an enum type_e

To register a sequence, you do

seq_lib[my_label] = my_sequence::get_type();

Now you can use any selection mechanism for the index, then call the factory's seq_lib[selected].create_object() to create the sequence you have selected.

Link to comment
Share on other sites

Hi dave_59,


Thanks for replying.

I'm having trouble using your suggested solution. When doing "seq_lib[selected].create_object()", the return type is a uvm_object and not the type T of the parametrized uvm_object_regisry#(T,Tname) class, where T is the sequence type.

Since I would like to use the return value inside a `uvm_do macro, it must of the actual sequence type and looks like I have to use casting, which makes the usage of the associative array irrelevant, since I have to do a "case" statement to cast the uvm_object type into a sequence type, according to the enum (associative array key).

What is the best way to execute a sequence from the array, assuming I selected a label?




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...