Stoping a sequencer and starting it again in UVM

Hello. I’m new in UVM so I have a task to do a test ,which should do the following:
1-Running a sequence with hyperframes
2-Asserting the reset in the middle of the process and disabling the reference model of the DUT which I’m testing
3-After some delay, De-asserting the reset and starting the same sequence
How should I do this? I’ve tried to interrupt the sequence with fork-join_any:
fork
begin
env.seq.start(env.sequencer)
end

begin
Delay;
end
join_any
RESET

When I de-asserted and needed to run the sequence again is comes with an error that the sequencer is still running. I’ve tried with env.seq.kill method after the join_any ,but again didn’t worked out. Is there any way to stop the sequencer or something else? Thanks in advance

In reply to ivan.krastev:

You need to stop sequences on sequencer before killing the fork.

fork 
begin
env.seq.start(env.sequencer)
end
begin
#delay;
end
join_any
env.sequencer.stop_sequences();
RESET

In reply to rohitk:

Stopping sequnces might not be the recommended way in sequnce execution. The sequnce should come to its end. If you replace your join_any by join it should work.
BTW I’m a litlle bit confused where you have your sequence. It should be started in your test and not in your env.

In reply to chr_sue:

Yes ,but the problem is that I’ve configured number of frames to be 20 for example. If I let them transmit on the first stage, there will be no traffic after the de-assertion of the reset. And the other thing is that I need to see if the registers are reseting properly in a case of unplanned reset (like this one). There is no point of replacing join_any with join ,because I don’t want to let the sequence to finish. My idea is to let for example 6-7 frames till the delay, reseting and then either continue with the others or start over again.

In reply to ivan.krastev:

OK, I understood. But you should never start a sequence from your environment. You should always run a test and the test starts your sequence. One of the main ideas and benefits of thhe UVM is the seperation from test and testbench. The env is your testbench. The test configures your testbench to your needs and starts the test.

In reply to chr_sue:

That’s what I’m doing. The code I wrote is in the test, not in the env. I’m just pointing that the sequence is part of the env class.

In reply to rohitk:

Hey man, I’ve tried this approach and after stop_sequences() it gave me UVM_FATAL :

“Item_done() called with no outstanding requests.”,
" Each call to item_done() must be paired with a previous call to get_next_item()."

In reply to ivan.krastev:

OK. I see.
If you are using get_next_item you need always an item_done.
If you call e simple get you do not need to call anything. Only in case you wanat to give back a response you can call put.

In reply to chr_sue:

I’m not sure what are you suggesting - to call item_done directly from the sequence or to use something like a semaphore ?

In reply to ivan.krastev:

You are calling get_next_item/item_done in the driver, but you can simply call get in the driver, then you do not need a item_done

In reply to chr_sue:

Yes, but the thing is I’m not allowed to change the env. Can I make something only in the test?

In reply to ivan.krastev:

I’m thinking of something. I can “kill” the sequence and with that I’m kind of stopping it. Is there a way to “resume” it later ?

In reply to ivan.krastev:

You can suspend and resume the sequencer. See the UVM Refernce Guide (uvm_component).

In reply to chr_sue:

Thank you for the fast responses :)