Difference between put() and item_done() in seq_item_port

Hi,

In ovm 2.0, there’s the seq_item_port instead of seq_item_prod_if.

Some examples show seq_item_port.item_done(rsp) and some show seq_item_port.put(rsp) as the way to return the response.

Are they different in any way?

Thanks,

Srishan.

Hi Srishan,

Calling

seq_item_port.item_done(rsp)

sets a flag in the sequencer to indicate that it is OK to send the next req sequence item. This is required if the driver pulled the current req item by calling

seq_item_port.get_next_item(req)

If instead, the driver pulls the req item by calling

seq_item_port.get(req)

item_done() is called implicitly before the get task returns.

If the driver subsequently wants to send a response back to the sequencer, it needs to call

seq_item_port.put(rsp)

Regards,
Dave

There are a couple of different driver use models supported. One is a TLM-style that uses get() to retrieve an item and put() to send back a response. Get() is functionally equivalent to get_next_item() immediately followed by item_done(). The other use model is to use get_next_item() plus an explicit call to item_done().

Get() includes a call to item_done(), and it instructs the sequencer to allow the next sequence to run right away. In some driver architectures you may want to start the next sequence only after the current item completes. In that case you will want to use get_next_item() plus a separate call to item_done().

Item_done() takes a response argument and calls put_response() to send a response argument back to the sequence. Only if you use get() will you need to call put (put is an alias for put_response).

– Mark

I have a question according to that.

I have a directed tests, which sends an item via the sequencer to the driver.

env.agent.sequencer.execute_item(item);

The driver gets the item and puts a response:

seq_item_port.get_next_item(req);
$cast(rsp, req.clone());
rsp.set_id_info(req);
//do something
seq_item_port.item_done(rsp);

I guess from the $cast line that rsp is the same item type like req. Please correct me, if I am wrong.
Then, is it possible to access the response from the testcase out of the sequencer?
If yes, how do I do that?
If not, is there a way to send the data from the driver to the test?

Thanks for your answers in advance.

Edit: I found a solution that works for me: (after having a closer look at the source code of the sequencer class)

rsp=env.agent.sequencer.last_rsp();

Directed Testing isn’t documented very well , is it? :(