我正在开发OVM驱动程序序列器通信。我在ovm驱动程序中使用try_get_item()但它仍然卡住了。在我的音序器中,我重新定义了try_next_item并在m_req_fifo.peek(t)之前和之后打印了一个显示语句;偷看之前的声明已被执行,但不是偷看之后的声明。我甚至使用m_req_fifo.size()显示了m_req_fifo的大小,并打印出1.为什么即使在大小为1之后peek也没有返回任何内容?修改后的try_next_item(仅添加显示)如下所示。 在 第398行,其中包含fifo 1
后,行 PEEK 之后的行永远不会执行 virtual task try_next_item(output REQ t);
int selected_sequence;
time arb_time;
ovm_sequence_base seq;
if (get_next_item_called == 1) begin
ovm_report_error(get_full_name(), "get_next_item/try_next_item called twice without item_done or get in between", OVM_NONE);
return;
end
wait_for_sequences();
selected_sequence = choose_next_request();
if (selected_sequence == -1) begin
t = null;
return;
end
set_arbitration_completed(arb_sequence_q[selected_sequence].request_id);
seq = arb_sequence_q[selected_sequence].sequence_ptr;
arb_sequence_q.delete(selected_sequence);
m_update_lists();
sequence_item_requested = 1;
get_next_item_called = 1;
$display("Line 398 with fifo size %0d\n", m_req_fifo.size());
m_req_fifo.peek(t);
$display("After PEEK\n");
wait_for_sequences();
// attempt to get the item; if it fails, produce an error and return
if (!m_req_fifo.try_peek(t))
ovm_report_error("TRY_NEXT_BLOCKED", {"try_next_item: the selected sequence '",
seq.get_full_name(), "' did not produce an item during wait_for_sequences(). ",
"Sequences should not consume time between calls to start_item and finish_item. ",
"Returning null item."}, OVM_NONE);
endtask
答案 0 :(得分:0)
uvm_tlm_fifo::size()
不返回FIFO中的元素数量,但是它的容量(即它可以容纳的元素的最大数量)。您正在寻找的功能是uvm_tlm_fifo::used()
,它返回存储元素的数量。
函数名称根本不直观,我记得花了几个小时试图理解一些类似的代码,直到在文档中注意到我使用了错误的方法。