Difference between get() and get_next_item()?

Hi Friends,

What is the difference between using the ovm_get_port.get() method and set_item_prod_if.get_next_item() method? Which one is to be used in what scenario?

Please resolve.

1 Like

Hi Vivek,
The main difference between get() and **get_next_item()**is the way the request handled. In **get_next_item()**the request are pushed to FIFO and hence we should call **item_done()**to clear the request. And more over the **get_next_item()**is implemented for sequencer-driver interface. And I prefer to use **get_next_item()**if given choice between get() and **get_next_item().**In case of **get()**we need to send the response item through put().

Hi Vivek,
The main difference between get() and **get_next_item()**is the way the request handled. In **get_next_item()**the request are pushed to FIFO and hence we should call **item_done()**to clear the request. And more over the **get_next_item()**is implemented for sequencer-driver interface. And I prefer to use **get_next_item()**if given choice between get() and **get_next_item().**In case of **get()**we need to send the response item through put().

Thanks a lot Vishwajeet!

When you say that “In get_next_item() the request are pushed to FIFO”, does it mean that get_next_item() can get more than one packet to be sent to the DUT before we call item_done()?

Hi Vivek,
I doubt, As per the implementation they make use of tlm_fifo. And they flag an error if the **get_next_item()**is called more than once before calling item_done().

There is not very much difference between get() and get_next_item(). The only difference is that get() will automatically call item_done() for you after it gets the next item.

With get_next_item(), you must call item_done() yourself. Your sequences will be blocked until item_done() is called.

You do not need to call put() unless you are returning a response form the driver. If you use get_next_item(), you must send the response through item_done(). One way is not “better” than the other. They both require two calls when sending a response. Actually, if there is no response, then get() will only require one call.

I prefer to use get() because of its similarity to other TLM functions. get_next_item(), in my opinion, is just there for backward compatibility, or for the occasional case where you want to keep your sequences blocked while your driver executes some code.

-Kurt

In reply to kurts:

Hi Kurt,

Could you clarify this : both get and get_next_item can send responses back to sequence. Correct?

Diff is get_next_item requires the code to add item_done.

There is no difference in terms of “blocking” - such as “trying to get” vs “actually get”…
Correct?

In reply to UVM_beginner:

Another question related to get_response. In case of burst transactions, does the id in get_response(rsp,id), have a unique number of each item of the burst? And this id is set in the driver using rsp.set_id_info(req). Correct?

I am trying to understand pipelined driver/sequence handshake, with delayed responses.