TLM peek 何时会失败?
When can TLM peek fail?
我正在研究 OVM 驱动程序定序器通信。我在 ovm 驱动程序中使用 try_get_item() 但它仍然卡住了。在我的音序器中,我重新定义了 try_next_item 并在 m_req_fifo.peek(t) 之前和之后打印了一条显示语句;执行 peek 之前的语句,但不执行 peek 之后的语句。我什至使用 m_req_fifo.size() 显示了 m_req_fifo 的大小,它打印出 1。为什么即使大小为 1,peek 也没有返回任何内容?下面给出修改后的try_next_item(只是增加了显示)。
After PEEK行永远不会在行行398之后执行,fifo大小为1
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
uvm_tlm_fifo::size()
不是 return FIFO 中的元素数量,而是它的容量(即它可以容纳的最大元素数量)。您要查找的函数是 uvm_tlm_fifo::used()
,其中 return 是存储元素的数量。
函数名称根本不直观,我记得我花了几个小时试图理解一些与您的代码类似的代码,直到在文档中注意到我使用了错误的方法。
我正在研究 OVM 驱动程序定序器通信。我在 ovm 驱动程序中使用 try_get_item() 但它仍然卡住了。在我的音序器中,我重新定义了 try_next_item 并在 m_req_fifo.peek(t) 之前和之后打印了一条显示语句;执行 peek 之前的语句,但不执行 peek 之后的语句。我什至使用 m_req_fifo.size() 显示了 m_req_fifo 的大小,它打印出 1。为什么即使大小为 1,peek 也没有返回任何内容?下面给出修改后的try_next_item(只是增加了显示)。 After PEEK行永远不会在行行398之后执行,fifo大小为1
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
uvm_tlm_fifo::size()
不是 return FIFO 中的元素数量,而是它的容量(即它可以容纳的最大元素数量)。您要查找的函数是 uvm_tlm_fifo::used()
,其中 return 是存储元素的数量。
函数名称根本不直观,我记得我花了几个小时试图理解一些与您的代码类似的代码,直到在文档中注意到我使用了错误的方法。