in my sequence i send the request in the run task, and i want to check the reaponse in the response handler task:
function void response_handler(ovm_sequence_item response) ;
cmi_src_cmd req;
assert($cast(req, response)) else
ovm_report_error(get_full_name()," received completion with unmatched type");
// verify data
if(req.CompareCompletion)
for (int i = 0 ; i < 16 ; i++)
if (req.ExpectedData[i] != req.WData[i])
ovm_report_error(get_full_name(), …));
else
$display(“cmp: %d == %d”,req.ExpectedData[i],req.WData[i]);
endfunction
i am sending the reuest from driver using :
seq_item_port.put_response(my_rsp);
but i keep getting error messages of the type :
sequencer [Sequencer] Dropping response for sequence 4, sequence not found. Probable cause: sequence exited or has been killed
can you please help me to solve it?
i must use response handler becouse i don’t want to block the reguest driver while waiting to completions, which can be out-of-order
Are you setting the sequence_id for the response correctly? You need to make sure that you copy the sequence_id from the request you are responding to.
my_rsp.set_id_info(req); // Set the rsp id = req id
yes . i’m saving that id for the response.
i thought maybe the initial sequence ( initiated by ovm_do) , was terminated after the driver get the request.
this is why the xact_id returned by rsp - does not match the latest response handler.
just to make it clear, my flow is as following:
driver get the requst.
rsp get the req_act_id.
driver generate response with the same xact_id.
the sequence response handler only print the above warning and does not enter the handler. i realized it after adding a display for the handler first line.
so my problem is that the sequence is probebly exited before its handler is being called.
The sequence still needs to be active to receive its response. The sequence will call get_response() soon after finish_item() to receive the response(s).
You will need to post more code from your sequence to show how you are trying to handle the responses for a better answer.
i try to keep the sequence alive , but now i can’t get requests back to back. the next request is received only after the former request got its response.
i need a way to get back to back requests from the sequence.
the sequence is :
…
// send xaction
finish_item(this_transfer);
if (this_transfer.NeedRsp)
begin
expected_responses++;
$display("start wait for expected_responses at %t",$time());
wait(expected_responses == 0);
$display("finish wait for expected_responses at %t",$time());
end
endtask // body
function void response_handler(ovm_sequence_item response) ;
cmi_src_cmd req;
assert($cast(req, response)) else
ovm_report_error(get_full_name()," received completion with unmatched type");
$display("in sequence: got xact_id of response = %d",req.xact_id);
// verify data
if(req.CompareCompletion)
for (int i = 0 ; i < 16 ; i++)
if (req.ExpectedData[i] != req.WData[i])
ovm_report_error(get_full_name(), $psprintf("data mismatch! index = %1d : expected = %h actual = %h @ TID = %h, SRC = %h , DST = %h . CHID = %d, Adress = %h",i,
req.ExpectedData[i] ,req.WData[i],req.TID,req.SrcID,req.DstID,req.ChId,req.Addr));
else
$display("cmp: %d == %d",req.ExpectedData[i],req.WData[i]);
expected_responses--;
endfunction
A sequence will terminate when it completes the body() phase. In order to receive a response, you must make the get_response() call part of your body, like such:
If you want to have multiple transactions in parallel, then you will need to fork off each sequence. This will allow each sequence to generate its sequence_item when dictated and still be ‘alive’ to receive the required response. Note that you can have 0 to as many responses for each sequence_item. You only need to make sure that you match the sequence_items and responses, otherwise you will have hung sequences or your response queue will overflow.
thanks .
it worked and with fork…join in my sequence i can get parallel requests.
in order to keep 1st request to be first served i added a logic for that in my driver.