Query related to getting response back from DUT

Hi,
I am doing sequence layering (upper layer and lower layer), lower layer sequencer is connected with lower driver. This Driver is connected with DUT. The request send to the DUT by driver (seq_item_port.get(req)) from lower sequencer. Now DUT will give response after executing the request to the driver. Now driver will put the response to the lower sequencer through seq_item_port.put(rsp). This transaction flow is happening finely for a simple transaction like for giving one request and getting one response. But the problem I am facing is, I want to give one request, now the DUT will give two or more consecutive responses. I am able to get first response, after getting this response the driver ↔ sequencer communication is ended. Because of that I am not able to receive the further responses. How can I keep alive my sequence until getting all responses?? Is this possible with reponse_handler (Reponse API)?

Code Snippet:
//////////////////////////////////////////////////////////////////////////////
// Lower Sequence
///////////////////////////////////////////////////////////////////////////////

class lower_seq extends uvm_sequence # (lower_packet);

    upper_packet upp_pkt, rsp_upp;
    lower_packet low_pkt, rsp_low;

task body();
	upper_sqr.get (upp_pkt);
	start_item(low_pkt);
	.......
	finish_item(low_pkt);


	// Response

	get_response (rsp_low);
	rsp.print();
	
	///putting reponse to upper layer
	upper_sqr.put (rsp_upp);
endtask

endclass

//////////////////////////////////////////////////////////////////////////////
// Lower Driver (Driver)
///////////////////////////////////////////////////////////////////////////////

class driver extends uvm_driver # (lower_packet);

task run_phase();

	lower_packet low_pkt, rsp;
	forever
	begin
		seq_item_port.get(low_pkt);//sumit
		
		// drive to DUT task
		send_to_DUT (low_pkt);
	
		// Response
		$cast(rsp, low_pkt.clone()); 
    		rsp.set_id_info(low_pkt);

	        //collecting reponse from DUT  
		rsp_to_low_sqr (rsp);

		// put to lower sequencer
		seq_item_port.put(rsp);
	end
endtask


task send_to_DUT (lower_packet low_pkt);
	.......
	.......
endtask


task rsp_to_low_sqr (lower_packet rsp);
	
	wait(intf.valid)
	#10;
	while (intf.valid)
	rsp.payload = intf.data;  // here i haven't show full logic
endtask

endclass

According to my code the DUT will give data while valid is high, here DUT will give 3 or more data payloads respecting to the valid signal. But once I have received first data payload from DUT, my driver is not taking other data payload from DUT (i.e once the seq_item_port.put (rsp) is reached, driver thinks my transaction completed, it never takes my next data payload from DUT respecting to the intf.valid signal )
My aim: I have to collect the data payload from DUT for each valid signal (intf.valid ) high duration and send this response to lower sequencer respectively.

Please help me to get rid of this problem…Thank you.

In reply to vadivelan014:

Hi,

As per you snippet you are only collecting 1 valid response. You need to collect the all valid response in rsp_to_low_sqr and then only put your resp in seq_item_port.

Is there any other signal from DUT which says response is completed! if so then you can do

task rsp_to_low_sqr (lower_packet rsp);
wait(intf.valid)
#10;
while (intf.resp_comp !=0)begin // I assumed here that if resp_comp 0 after valid is high it will end of resp. 
  while (intf.valid)
  rsp.payload = intf.data; // here i haven't show full logic
  @intf.cb //prevent 0 delay loop
end
endtask

if your DUT does not provide such signal then you have to predict the expected response from DUT and collect it then proceed further.

I hope it will help.

Regards,
Vinay Jain.

There is no limit on the number of responses that your driver can send back to the sequencer using the seq_item_port.put(rsp) call. You can code your sequence to call get_response(rsp) as many times as needed to get the expected number of responses.

Just beware that the number of responses sent by the driver need to match the number of responses expected by the sequence, otherwise you will have a mismatch and things will get out of sync.

In reply to cgales:

Thank you for reply vinay and cgales…In my case there is no indication signal about response, i.e. how many responses is coming from DUT. so i can’t use vinay’s idea here. but as per cgales suggetion i put the get_response(rsp) inside the “while(1)” loop to get all responses for one request.

It (sequence) is collecting all responses from Driver. But the problem is, I want to start new sequence respect to one of the response field value. I could’t achieve this because of that while(1) loop. I thing this loop is always looking for response. So how can i start the new request respect to response field value?? Thanks in advance…

Code Snippet:
Inside the sequence…

task body();

while(1)
begin
get_response(rsp);

if(rsp.re_transmit == 1)
begin
start_item(req);


finish_item(req);
end
end
endtask

In reply to Vinay Jain:

Thank You vinay… In may case there is no indication about reponses like when it is coming or how many responses are coming for single request…I followed cgales idea…it works in my code…