Uvm_reg based ISR(Interrupt service routine) sequence after grab()/lock()

HI ,

I am trying to write an IST sequence with reg-model.

My intr agent has:

task run_phase()
  while(1)
  begin
   intr_event.wait_trigger();
   ISR = new("ISR");
   ISR.regmodel = this.regmodel;
   ISR.start(null); 
  end
endtask

ISR:

my_reg_model regmodel; 

task body()
      m_sequencer = regmodel.default_map.get_sequencer();
      m_sequencer.grab(this);
      regmodel.status_reg.read(status,value); // It hung here ?????????????
      m_sequencer.ungrab(this);
endtask

Could you please let me know why this is hanging duringregmodel.status_reg.read(status,value);
How to fix this ?
Without grab it works fine !!!

Thanks,
Siraj

Hi,
I’m facing the same issue. The test hangs when the

m_sequencer.grab

statement is executed.
Need a solution for this so that we make use of register sequences for handling interrupt scenarios.
Can someone post a solution for the same.

Thanks,
Suhas

In reply to siraj:

How does your agent look like? Do you have a sequencer/driver there?
You have to execute the grab/lock in the body task of your sequence.

In reply to chr_sue:

In reply to siraj:
How does your agent look like? Do you have a sequencer/driver there?
You have to execute the grab/lock in the body task of your sequence.

The test is hanging when the “grab” command is used to grab the sequencer in the body task of the sequence.

In reply to suhas.ns:

Follow the guidelines in Stimulus/Interrupts | Verification Academy

I think i know the problem.

It should work if you pass “this” to the read() task’s parent arg like,
regmodel.status_reg.read(.status(status),.value(value), .parent(this));

The problem is you have already grabbed the sequencer from ISR sequence and then you are trying to run another sequence(ie, reg.read()) on the same sequencer, this is not right. When you pass “this” handle ,ISR will become the parent sequence. I haven’t tried this , but I am sure it should work.

In reply to siraj.mubarak:

There are a few Things wrong:
(1) m_sequencer = regmodel.default_map.get_sequencer(); get_sequencer returns uvm_sequencer and not your sequencer. You have to perform a type cast.
(2) the grab Command is always executed on a sequence and not on a sequencer.
m_sequencer.grab(this); is wrong.

In reply to chr_sue:

Thanks for the replay .
FYI, nothing wrong , It is working fine now with the steps i mentioned above…

(1)
No need to cast to local type , because I am not accessing any elements from my sequencer.
regmodel.default_map.get_sequencer().grab() is also fine.

(2)
grab/lock is defined in sequencer_base and sequence_base. so you can call them from both places.

FYI:-
sequencer:-
https://www.vmmcentral.org/uvm_vmm_ik/files3/seq/uvm_sequencer_base-svh.html#uvm_sequencer_base.grab

sequence:-
https://verificationacademy.com/verification-methodology-reference/uvm/docs_1.1b/html/files/seq/uvm_sequence_base-svh.html#uvm_sequence_base