Sequence kill

Hi UVM forum,
I encountered a problem that relate to killing a sequence, more correct why do I need it.
here is a snippet of the code inside a sequence, the problem will be described at the end of this post.


task body();
  start_do();
endtask;

task start_do()
  forever begin
    fork
      send_do()
    join
  end
endtask

task send_do();
  fork
    begin
      seq_a.start(null); // write to RAL
    end

    begin
      for (int idx=0; idx<8; idx++) begin
        automatic i=idx;
        fork
          seq_b[i].start(seqr_b[i]); //toggle some interface array
        join_none
      end
      wait fork;
    end
  join_any
  disable fork;
endtask

class seq_a extends uvm_sequence;
...
task body();
  m_ral.reg_name_1.write(stats, value);
  wait_some_time();
  ....
  m_ral.reg_name_n.write(stats, value);
endtask
endclass

class seq_b extends uvm_sequence #(seq_item);
...
task body();
  forever begin
    `uvm_do(req)
  end
endtask
endclass


The first iteration in method start_do() work as expected.
In the 2nd iteration I get UVM_FATAL says “sequence seq_a already started”
I had to kill all the sequences using


....
disable fork;
seq_a.kill()
endtask : send_do()

Why is that? Shouldn’t the “disable fork” port kill every thing inside the “fork … join any”?

In reply to shimonc:

Once the seq starts it should properly end with item_done else the sequencer will not be able to start the next sequence item… so the the sequence might be stopped abruptly … Please check

In reply to Subrahmanyam:

You should never discontinue a sequence execution by leaving out a item_done.
A sequence should never have a foreach loop in the body task. You should always generate a reasonable number of seq_items. This stops a sequence automatically.

You can start a only start a virtual sequence on a null object sequencer.
In this piece of code:

seq_a.start(null); // write to RAL

seq_a is not a virtual sequence, it is aregister sequence and should genearte seq_items.