# How to generate multiple resets in virtual sequence during simulation

**URL:** <https://verificationacademy.com/forums/t/how-to-generate-multiple-resets-in-virtual-sequence-during-simulation/31249>\
**Category:** UVM\
**Tags:** UVM, on-the-fly-reset, virtual-sequence, Multiple-Sequences, asyncronous-reset\
**Created:** [November 23, 2015, 2:38pm UTC](https://verificationacademy.com/forums/t/how-to-generate-multiple-resets-in-virtual-sequence-during-simulation/31249 "2015-11-23T14:38:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![8Blades](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/8/4491bb/32.png) [@8Blades](https://verificationacademy.com/forums/u/8Blades)\
**Post date:** [November 23, 2015, 2:38pm UTC](https://verificationacademy.com/forums/t/how-to-generate-multiple-resets-in-virtual-sequence-during-simulation/31249/1 "2015-11-23T14:38:59Z")

</div>

I have a specific requirement in the below code.

```verilog
task normal_seq::body();
begin
  reset_seq.start(null,this); // reset sequence
  begin
    normal_seq1.start(null,this); // sequences following reset sequence. 
    normal_seq2.start(null,this);
    normal_seq3.start(null,this);
    normal_seq4.start(null,this);
    normal_seq5.start(null,this);
  end
end
endtask

```

I wanted to have multiple resets during simulation with random delays. and if reset is detected, then normal\_seq1 should start executing after each reset.

```verilog
task normal_seq::body();
fork
  repeat(5) begin
  #($urandom_range(25,20)) 
  reset_seq.start(null,this); // reset sequence
  end
  begin
    normal_seq1.start(null,this); // sequences following reset sequence. 
    normal_seq2.start(null,this);
    normal_seq3.start(null,this);
    normal_seq4.start(null,this);
    normal_seq5.start(null,this);
  end
join
endtask

```

Problem is i am not finding a way to return my normal sequence flow to normal\_seq1 each time reset is detected. Could you please suggest a way to do it.

Thanks

---

<div class="post-metadata">

**Author:** ![electron1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/electron1/32/2235_2.png) [@electron1](https://verificationacademy.com/forums/u/electron1)\
**Post date:** [December 2, 2015, 11:23am UTC](https://verificationacademy.com/forums/t/how-to-generate-multiple-resets-in-virtual-sequence-during-simulation/31249/2 "2015-12-02T11:23:47Z")

</div>

_In reply to [8Blades](https://verificationacademy.com/forums/t/how-to-generate-multiple-resets-in-virtual-sequence-during-simulation/31249):_

As per my understanding, you are wanting to generate reset randomly within you simulation and you wanted to start your normal\_seqeunces from #1 to #5.

For this requirement

```verilog

task normal_seq::body();

repeat(5) begin
  fork
    begin
      reset_seq.start(null,this); // reset sequence
      #($urandom_range(25,20)) 
    end
    begin
      normal_seq1.start(null,this); // sequences following reset sequence. 
      normal_seq2.start(null,this);
      normal_seq3.start(null,this);
      normal_seq4.start(null,this);
      normal_seq5.start(null,this);
    end
  join_any
  disable fork;
end
endtask

```

From body task, you can do above thing, But this is not recommended, you should have implement your driver which can release your transaction (item\_done) whenever it detects reset from interface.
