Problem running a reactive sequence in a forever loop

Hi All,

I tried to write a reactive sequence that constantly monitors a pin on the output of the DUT and take some sequence of actions when it sees one. However, I cannot figure out how to push the sequence into the background and make it always observe the pin (kind of like a monitor). Here is the simplified version of what I have :


// Inside the driver
virtual task run_phase(uvm_phase phase);
    super.run_phase(phase);
    forever begin
	my_item m_dummy;
	my_item m_tx_item;
	m_tx_item = new("m_tx_item");
	@(vif.clk);
	seq_item_port.get_next_item(m_dummy);
	m_tx_item.signal = vif.signal;
	m_tx_item.set_id_info(m_dummy);
	seq_item_port.item_done(m_tx_item);
    end
endtask : run_phase


// Inside the sequence
    virtual task body();
	my_item m_rx_item;
	my_item m_dummy;
	m_dummy = new("m_dummy");
	fork
	    forever begin
		start_item(m_dummy);
		finish_item(m_dummy);
		get_response(m_rx_item);
		
		if(m_rx_item.signal) begin
	            // Do some tasks
		    break;
	        end
	    end
	join_none
	wait fork;
    endtask : body



// Starting of the sequence 
    my_sequence m_seq;
    m_seq = new("m_sequence");
    m_seq.start(env.my_agent.my_sqr);

The above code does not do what I want it to do. Looks like it is just running infinitely and blocking other sequences from running (I’m not sure how this is happening as I have exclusive sequencer created just for this purpose)

I’ve tried placing the forever loop around the code that starts the sequence instead of in the sequence itself, but this was leading to a SEQREQZMB error.

The above sequence does not drive anything as of now (hence dummy items) but will drive something in the future and hence to keep to simple, I’m writing a reactive sequence.
I’d appreciate if anyone can give me a better suggestion.

Thank you

In reply to szy0014:

You have a few weaknesses in your implementation. The most important one is using a signal in the sequence.
See a solution for your problem here:
https://verificationacademy.com/cookbook/sequences/slave

In reply to chr_sue:

Thanks chr_sue. That’s a good guide.

In reply to szy0014:

Hi Chr_sue, Do you have example of slave driver/sequence, using monitor feedback/input for request instead of Driver? Please share if you have any further examples of reactive slaves. Thank you.

In reply to megamind:

I do not understand why you want to do simple things complicated. The driver/sequencer have a built-in response handling mechanism. The monitor does not. You have to implement this mechanism on your own. This is significant effort and might create risk.

In reply to chr_sue:

I understood what you are saying, and I believe that makes sense unless I think further and come up with some more questions on this if in case. Please let me think through if reactive slave with driver sensing the bus transactions is all I really need. Thank you.