Sequence not getting arbitrated from the sequencer

Hi,

I’m seeing a case where a particular sequence is not getting arbitrated by the sequencer.
The detailed scenario is as follows,

I have sequence 1 and sequence 2 performing some register write operation. Both the sequences are run through same sequencer. But there exists some synchronization between two sequences. The two sequences run in infinite loop till some test end condition is met. But when two sequences are started in a fork join block, sequence 1 is waiting for a flag to be set by sequence 2 and sequence 2 wants to do some register writes before setting the flag. But the register write operation is not getting arbitrated by the sequencer. When I debugged in detail, I found out that register operation sits indefinitely inside arbitration queue.

Virtual sequence,
fork 
run_seq1();
run_seq2();
join

sequence1,
forever begin
  if (flag) begin
    do some register writes
    if (test_end_cond)
      break;
  end  
end

sequence2,
forever begin
  do some register writes
    flag = 1
  if (test_end_cond)
     break;
end

In sequence2, execution is stuck at register writes because, the writes are not getting arbitrated from the sequencer. In addition, sequence 1 has not generated any register operations as it is waiting for flag to be set. One observation is when I removed flag condition and allow both sequences to run parallel, the register operations are being arbitrated. Not able to identify the problem in this explained scenario.

In reply to surya_mudgal:

I think that you are getting an infinite loop in sequence1. The sequence1 forever loop has no blocking construct when flag == 0, so when it executes, there is nothing that allows sequence2 to execute.

In reply to cgales:

So the sequences rely on test_end_cond to break out of forever loop. Ideal execution would be sequence 2 would do those register writes and set the flag value. Sequence 1 will see the flag value and start executing its forever loop. The first reg.write() in sequence 2 is being blocked indefinitely and the execution is stuck at that point.

Since both the sequences are forked, I dont think, sequence 1 infinite loop should block sequence 2.

In reply to surya_mudgal:

There is no guarantee of order of execution of forked blocks.

An infinite loop will affect the entire simulation since there will be no timing event and the entire simulation won’t continue.

You want something like:


sequence1,
forever begin
  wait (flag == 1);
  begin
    do some register writes
    if (test_end_cond)
      break;
  end  
end

The wait() call is blocking and will allow other processes to continue.

In reply to cgales:

Thank you so much !! it worked.