Jump to content

try_next_item


Recommended Posts

Hi,

I use uvm-1.0p1

In my driver I use try_next_item. As per the usage I also used item_done after it.

//check if request is available

seq_item_port.try_next_item(req);

//if not available

if (req == null )

....

else //drive value

....

//set item_done to close loop

seq_item_port.item_done();

But during simulation I get below error -

[uvm_test_top....sequencer] Item_done() called with no outstanding requests. Each call to item_done() must be paired with a previous call to get_next_item().

so I removed the item_done().

With this I see that the try_next_item() is blocking. It does not work the way it is mentioned.

I see that there was an issue like this before which was fixed in 1.0.

Can anybody help me?

Thanks,

Archana

Link to comment
Share on other sites

Hi There,

the "get_next_item(req)" will block until a REQ sequence_item is available in the sequencers request FIFO and then returns with a pointer to the REQ object. it works with "item_done()" as a pair.

"get_next_item(req)" Just made half of dirver-sequencer handshake, it need to be followed by an item_done() call. Then the handshake will complete.

If other ""get_next_item(req)"" call is inserted between that two calls, it will result in a protocol error and driver-sequencer deadlock.

If you removed the "item_done()", it also will result in driver-sequencer deadlock.

Here is the code snippet from UVM lib. As the Error is shown in you logfile, it means that there is no item in the request FIFO when you want complete the handshake.

// item_done

// ---------

function void uvm_sequencer::item_done(RSP item = null);

REQ t;

// Set flag to allow next get_next_item or peek to get a new sequence_item

sequence_item_requested = 0;

get_next_item_called = 0;

if (m_req_fifo.try_get(t) == 0) begin

uvm_report_fatal(get_full_name(), {"Item_done() called with no outstanding requests.",

" Each call to item_done() must be paired with a previous call to get_next_item()."});

end else begin

m_wait_for_item_sequence_id = t.get_sequence_id();

m_wait_for_item_transaction_id = t.get_transaction_id();

end

if (item != null) begin

seq_item_export.put_response(item);

end

// Grant any locks as soon as possible

grant_queued_locks();

endfunction

BTW, Pls paste more codes here for investigation

Edited by Roman
Link to comment
Share on other sites

I changed by code to

//check if request is available

seq_item_port.try_next_item(req);

//if not availablr or not the same enum type then send good parity

if (req == null) begin

......

end

else begin

......

//close req loop

seq_item_port.item_done();

end

Only if request is available the handshake needs to be completed with item_done(). If no request is available, item_done need not be called.

Link to comment
Share on other sites

I changed by code to

//check if request is available

seq_item_port.try_next_item(req);

//if not availablr or not the same enum type then send good parity

if (req == null) begin

......

end

else begin

......

//close req loop

seq_item_port.item_done();

end

Only if request is available the handshake needs to be completed with item_done(). If no request is available, item_done need not be called.

Hi,

At a first look at your code, it seems to be ok.

I just modified the uvm-1.0p1/examples/simple/sequence/basic_read_write_sequence to reproduce your issue as below, but it works well.

task run_phase(uvm_phase phase);

REQ req;

RSP rsp;

forever begin

rsp = new();

seq_item_port.try_next_item(req);

if(req != null) begin

rsp.set_id_info(req);

// Actually do the read or write here

if (req.op == BUS_READ) begin

rsp.addr = req.addr[8:0];

rsp.data = data_array[rsp.addr];

`uvm_info("my_driver",rsp.convert2string(),UVM_MEDIUM);

end else begin

data_array[req.addr[8:0]] = req.data;

`uvm_info("my_driver",req.convert2string(),UVM_MEDIUM);

end

seq_item_port.item_done();

end

else

`uvm_info("ERROR","ROMAN returned null", UVM_NONE);

seq_item_port.put(rsp);

end

endtask

endclass

Why not move to UVM1.1 Release or UVM1.1A?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...