How to grab the sequence in middle to stop any transactions further until ungrab()

Hi UVM experts!

Problem statement:
I want to recursively find all the sequences and then grab() them so that no txn can be initiated on any drivers in my TB until ungrabbed …

But i’m facing few challenges.

Code
I’m able to recursively find all the. sequencers in below manner


function void my_tb_env::find_all_sequencers(uvm_component comp); 
  uvm_object obj; 
  uvm_component child_comp; 
  uvm_component array[$]; 
  uvm_sequencer_base sequencer; 

  comp.get_children(array); 
  foreach(array[i]) 
  begin obj=array[i]; 

    if ($cast(child_comp, obj)) 
    begin 
      if ($cast(sequencer, child_comp)) 
      begin 
      sequencer_list.push_back(sequencer); 
      `uvm_info("FIND_SEQUENCERS", $sformatf("Found sequencers: %s", 	sequencer.get_full_name()), UVM_LOW); 
    end 
    find_all_sequencers(child_comp); // Recursive call 
    end 
  end 
endfunction

Questions 1:
How to recursively find all the current sequences running on these sequencers ? get_sequence() method in UVM1.2 is deprecated already.

Question 2:
To grab the sequence, i created a dummy sequence extended from uvm_sequence and then trying this:

foreach(sequencer_list[j]) begin
  if(!sequencer_list[j]. is_grabbed()) begin
    sequencer_list[j].grab(dummy_seq_h);
  end
end

But these are not working. Can you please suggest and help me?

Thanks

First of all, your function must be automatic. This ensures that it doesn’t use static storage and allows it to work properly when called recursively or in parallel processes. For more information on SystemVerilog functions, you can read here: SystemVerilog Functions - ChipVerify.

class method always have automatic lifetimes.

You need to explain in more detail what you mean by “not working” and what is your intent. grab()/lock() do not stop the currently executing sequence items. Sequences do not necessarily “run” on sequencers.

If the sequence is non-blocking i.e. doesn’t wait for item_done or have some internal processing then grab() won’t halt/abort those processes.

Also can you suggest better approach to grab() or halt the internal HW (rtl design) periodic events as well ?

There’s a big difference between halting and aborting. The UVM provides no builtin mechanisms to halt or pause the protocol between a sequence and driver. You can kill a sequence process, but you need to manually instrument your driver to deal with an aborted sequence.

A sequence will pause if it’s sequence has been locked or grabbed out and the current sequence it was running has finished.