1

I am trying to modify the existing code using the start() method in UVM.

Basic code is below:

function void build_phase(uvm_phase phase);
 uvm_config_wrapper::set(this, "tb.chan?.rx_agent.sequencer.run_phase",
 "default_sequence",
 channel_rx_resp_seq::get_type()); 
endfunction

I implemented the code below instead of the original code, but "?" is giving an illegal expression primary error.

How do I correctly implement "?" in start() method of UVM?

ch_seq.start("tb.chan?.rx_agent.sequencer"); 
toolic
  • 5,637
  • 5
  • 20
  • 33
Carter
  • 581
  • 2
  • 6
  • 23

2 Answers2

1

The first argument of the start method of a uvm_sequence should be of type uvm_sequencer_base.

However, you passed it an argument of type string. The double quotes create a string.

I don't think you can pass a string to start like "tb.chan?.rx_agent.sequencer". Typically, you would pass a handle to a uvm_sequencer object.

Refer to the "Sequences" section of the UVM documentation.

Also, if you are trying to use ? as some sort of regular expression match character, so that it would match multiple things like chan0, chan1, etc., I think you can only pass a single instance of a sequencer to start.

If you want to start the sequence on a sequencer under the chan0 hierarchy:

ch_seq.start(tb.chan0.rx_agent.sequencer); 
toolic
  • 5,637
  • 5
  • 20
  • 33
1

You can build a list of sequencers using uvm_top.find_all() and then loop through all the sequencers starting them in parallel.

uvm_component comps[$];
uvm_sequencer_base sqrs[$];

uvm_top.find_all("tb.chan?.rx_agent.sequencer",comps);
foreach(comps[i]) begin // need to downcast each sequencer handle to pass to start argument
     sqrs.push_back(null);
     $cast(sqrs[i],comps[i])
end
foreach(sqrs[i]) fork
    int j = i;
    begin
      // create a new sequence for each sequencer
      channel_rx_resp_seq ch_seq = channel_rx_resp_seq::type_id::create();
      ch_seq.start(sqrs[j]);
    end
  join_none
dave_59
  • 7,557
  • 1
  • 14
  • 26