Generic sequence call on different sequencers

Hi,

I need to implement new infrastructure, will describe the requirements.
An associative array: key = string, value = name of sequence (string) - which represents the sequence name, which can run on a specific sequencer.
The sequences will be running on different sequencers in the system (various IPs in the SoC).

How do you suggest implementing this?
I need to write a task/function which for a given string, it takes the matching string from the associative array (sequence name) and runs it on the correct sequencer.

Though on using virtual sequencer or virtual sequence.
But not sure how to re-create the proper sequence from it’s name, and launch it on the correct sequencer.

Thanks,

In reply to Michael54:
https://verificationacademy.com/forums/uvm/problem-parameterized-defines#reply-56243

You can use the UVM factory’s create_object_by_name() if you have the registered name of the sequence. If you have parameterized sequences, there is no registered string name, but you can create one with an associative array. It wasn’t clear if each sequence had a dedicated sequencer to run on or if the sequence here was selected when the task was called. I’m going to assume it’s passed to the task, but you could make another associative array to store the sequencers you want to select from.

uvm_object_wrapper seq_array[string];
  seq_array["first_seq"] = first_seq::get_type();
  seq_array["second_seq"] = second_seq::get_type();
  seq_array["third_seq#(1,2)"] = third_seq#(1,2)::get_type();
  seq_array["third_seq#(3,4)"] = third_seq#(3,4)::get_type();

task runseq(string name, uvm_sequencer_base sqr);

     uvm_sequence#(your_item_type) seq;
     if ($cast(seq,seq_array[my_name].create_object("")) && seq != null)
         seq.start(sqr);
     else
         // something bad happened
 endtask

In reply to dave_59:

Thank you for the detailed answer Dave!

Was not familiar with the UVM Factory’s “create_object_by_name”. However later in the task you used “create_object”, is it the same?

I have edited my original post, and will elaborate more.
The sequencer is not passed as an argument to the task.
It is required to support “registering of sequence and sequencer” to this component database, based on possible scenarios of a specific test.
Probably will be done before the run_phase of the test.
The component should be instantized in the ENV class.
So when monitored specific events during the simulation run, it should start one of these registered sequences, using the API functions/tasks of this component.

In reply to Michael54:

I provided a link to the definition of create_object_by_name but no example since it is relatively straightforward. The uvm_object_wrapper::create_object requires an extra step but accomplishes the same factory object creation. I prefer using the uvm_object_wrapper because it can be more efficient for repeated creation, and works for both parameterized and unparameterized classes. The UVM wrapper is known as a proxy object or lightweight object for the actual class you want to create.

  uvm_object_wrapper seq_array[string];
  uvm_sequencer_base sqr_array[string];
  seq_array["first_seq"] = first_seq::get_type();
  sqr_array["first_seq"] = first_sqr;
  seq_array["second_seq"] = second_seq::get_type();
  sqr_array["second_seq"] = second_sqr;
  seq_array["third_seq#(1,2)"] = third_seq#(1,2)::get_type();
  sqr_array["third_seq#(1,2)"] = third_seq;
  seq_array["third_seq#(3,4)"] = third_seq#(3,4)::get_type();
  sqr_array["third_seq#(3,4)"] = third_seq; // same sqr as 1,2

 
task runseq(string name);
 
     uvm_sequence#(your_item_type) seq;
     if ($cast(seq,seq_array[name].create_object("")) && seq != null)
         seq.start(sqr_array[name]);
     else
         // something bad happened
endtask