Problem Regarding Grab and Ungrab

Hi All,

I am using grab/ungrab for running a interrupt sequence. For that i write a seq “interrupt_sub_seq”. This sequence reads one of the DUT register.
There is an other sequence called interrupt_main_sequence.
Interrupt_main_sequence is parent sequence for interrupt_sub_sequence.

I want to start interrupt_sub_sequence inside interrrupt_main_sequence with seq.start command. Pseudo code is below.

// interrupt main sequence body.
task body();
forever
begin
int_event.wait_trigger();
grab(m_sequencer);
interrupt_sub_seq_obj.start(m_sequencer);
ungrab(m_sequencer);
end
endtask

// interrupt sub sequence body contains
task body;
start_item(read_item);
finish_item(read_item);
endtask

Read for DUT registers are not happening by above code.
I found that compiler entered into interrupt_sub_sequence body. But Start item doesn’t complete.

In case if i modify code of interrupt main sequence by
// interrupt main sequence body.
task body();
forever
begin
int_event.wait_trigger();
grab(m_sequencer);
start_item(read_item);
finish_item(read_item);
ungrab(m_sequencer);
end
endtask

It executes fine. and i am able to read DUT registers.

Please tell me if there is any way so that i can execute my sub_sequence with seq.start_item() command

Thanks
Ashutosh

Hi Ashutosh,

I think I understand the issue that you are running into.
First of all, grab/ungrab locks out all sequences that are not a sub-sequence of the sequence that has the grab. When you call start with the default value for the second argument, i.e., parent_sequence, the sub-sequence is treated as a root sequence and therefore is prevented from execution until ungrab is called.

This is another advantage of using the `ovm_do macros as setting of parent_sequence, p_sequencer and reseeding of sequence is handled by one call. Also ovm_do calls seq.randomize() by default so if there are any rand variables in the sequences like delays for reads/writes it will create a more interesting stimulus for the DUT.

I’d re-write your sequence as:

// interrupt main sequence body.
task body();
forever
begin
int_event.wait_trigger();
grab(m_sequencer);
`ovm_do(int_sub_seq)
ungrab(m_sequencer);
end
endtask

Hope this helps.

Umer