Response_handler()

I’m trying to use the response_handler() function in a sequence to automatically select and send another request transaction.

I’m getting the following error…

# ** Error: (vsim-3728) ../../lib/fadl//fmrd_slave_seq_lib.sv(74): Enabling a native task or DPI import task 'this.start_item' instead of a function.
#         Region: /fadl_pkg::fmrd_load_datasets_seq
# ** Error: (vsim-3728) ../../lib/fadl//fmrd_slave_seq_lib.sv(74): Enabling a native task or DPI import task 'this.finish_item' instead of a function.
#         Region: /fadl_pkg::fmrd_load_datasets_seq

Here’s my attempt to use the response_handler() function. Line 74 is the `ovm_send() call at the end of the function.

virtual function void response_handler(ovm_sequence_item response);
      fmrd_req_item read_request;
      fmrd_rsp_item read_response;
      dword_t data_from_memory[];

      fadl_addr_t a;
      fadl_burstlen_t blength;
      fadl_data_t d[];

      // Get read request
      $cast(response, read_request);
      
      // Create read response
      `ovm_create(req);
      //`ovm_create(read_response);

      a  = read_request.get_addr();
      blength = read_request.get_burstlen();
      read_response.set_addr(a);

      req.randomize();
      `ovm_send(req);
   endfunction // response_handler

(Note that I’m not certain my casting works correctly as I’ve hit another error before getting that far. Feel free to comment, but that’s not my main question.)

Does anyone know what this error means? and if I can send requests via the `ovm_send() macro inside the response_handler()? I’m pretty stuck as the error message is a bit cryptic.

Thanks… Greg

I’m trying to use the response_handler() function in a sequence to automatically select and send another request transaction.

virtual function void response_handler(ovm_sequence_item response);
...
`ovm_send(req);
endfunction

I’m getting the following error…

# ** Error: (vsim-3728) ../../lib/fadl//fmrd_slave_seq_lib.sv(74): Enabling
a native task or DPI import task 'this.start_item' instead of a function.

Hi Greg,
Unfortunately the `ovm_send expands out to a task call, and you can’t run a time-consuming task from within a function (e.g. response_handler()).

The response_handler() needs instead to communicate somehow (in zero time) with your main sequence body() task to get it to send the required followup item.

Note: you can enable a task from within a function, by calling it from inside a fork…join_none block. But that might bring its own scheduling problems. I’d use some kind of signalling between your response_handler() and body() instead.

Hope that helps. Yes, error messages from macros are often as cryptic…

I’d use some kind of signalling between your response_handler() and body() instead.

Thanks Gordon, that turned out to be the easiest solution. I setup the body() task to do the macro call and the response_handler() signals the body() task when it needs the macro called. Fixed the issue.

Interesting followup situation I’m now having. It seems the sequencer doesn’t want to route the responses back to the sequence. In my case, the DUT is making sending a response back to the sequencer and then the sequence chooses a corresponding request to send. It’s basically mixing up the request/response order because I need the DUT to determine the request.

Since I’m generating a response with no corresponding request, the sequence_id isn’t being set correctly and I’m not sure how to get around that.

# OVM_FATAL @ 300: ovm_test_top.u_rxif_tb.pm_slave.sequencer [SQRPUT] Driver put a response with null sequence_id
# OVM_INFO @ 300: ovm_test_top.u_rxif_tb.pm_slave.sequencer [Sequencer] Dropping response for sequence -1, sequence not found

Anyone have ideas? I’m still unfamiliar with the details of the inner workings of the OVM when it’s handling responses like this. It’s possible I haven’t correctly set the use_response_handler() bit, so I’m trying to figure out how to correctly do that.

Greg

HI brown,

There is some workaround to get rid of your problem.

From sequence initially send some dummy sequence item (Have some field in sequence item indicates it is dummy) which has no meaning. Driver just sees this item and it will send the appropriate response. Based on response, sequence body can decide what next request item should contain.