Regarding get_next_item implementation in uvm_sequencer base class

task uvm_sequencer::get_next_item(output REQ t);
REQ req_item;

// If a sequence_item has already been requested, then get_next_item()
// should not be called again until item_done() has been called.

if (get_next_item_called == 1)
uvm_report_error(get_full_name(),
“Get_next_item called twice without item_done or get in between”, UVM_NONE);

if (!sequence_item_requested)
m_select_sequence();

// Set flag indicating that the item has been requested to ensure that item_done or get
// is called between requests
sequence_item_requested = 1;
get_next_item_called = 1;
m_req_fifo.peek(t);
endtask

The above task is implemented in the baseclass of uvm_sequencer. they have implemented the get_next_item method using peek method(if you see the above code). peek is a method which gives the copy of the value and the value will be remained in the mailbox. the size of req_fifo is 1. once a packet has been put inside the req_fifo until i get the packet out i cannot put any other packet. if this is the case, how the hand shaking between driver and sequencer is happening for multiple packets. can anyone give me clarity.?

In reply to Salman devarenti :

Read the UVM Cookbook chapter on pipelined drivers on how to handle multiple packets simultaneously.

In reply to cgales:

No, my question is how the driver getting the next packet when the previous packet still there in req_fifo. Peek is a mailbox method. Peek method will give copy of the packet but the packet will be left there inside req_fifo. When a packet is already there inside the req_fifo, how the driver is getting another new packet (using peek method we can’t get the packet out. It’s just takes the copy of packet).

In reply to Salman devarenti :

As the Cookbook chapter points out, you don’t use get_next_item() when you want to get multiple sequence items. You use get() which will remove the item from the queue.

If you use get_next_item(), you need to use item_done() to remove the item from the queue.

In reply to cgales:
Thanks mate…! It is helpful.