system-verilog - uvm_sqr_if_base::peek() 和 uvm_sqr_if_base::get_next_item() 有什么区别?
问题描述
在 System Verilog UVM 中,TLM 端口中用于序列和驱动程序之间通信的接口 ( uvm_sqr_if_base
) 提供了灵活性。对于拉取请求,我将总结此表中的四个选项:
blocking item_done
get_next_item() yes no
try_next_item() no no
get() yes yes
peek() yes no
...其中阻塞表示如果您调用该方法,但没有准备好提供数据的序列,则该任务将阻塞并等待,直到数据准备好并且可以并且将被返回。
... 其中item_done表示该方法item_done()
在成功从序列中拉出项目后也会调用。
peek()
和get_next_item()
then有什么区别?
考虑来自两个虚构驱动程序的这两个代码片段......
while(1) begin: loop1 while(1) begin: loop2
seq_item_port.get_next_item(req); seq_item_port.peek(req);
process(req); process(req);
seq_item_port.item_done(); seq_item_port.item_done();
end: loop1 end: loop2
有什么不同?为什么有两种方法可以完成同一件事?它似乎不是 TLM1 与 TLM2 风格。
编辑:
回答下面的问题。在问这个问题之前,我已经查看了源代码。事实上,语言只是略有不同,代码似乎做同样的事情。重点是什么?我错过了什么?
// Task: get_next_item
//
// Retrieves the next available item from a sequence. The call will block
// until an item is available. The following steps occur on this call:
//
// 1 - Arbitrate among requesting, unlocked, relevant sequences - choose the
// highest priority sequence based on the current sequencer arbitration
// mode. If no sequence is available, wait for a requesting unlocked
// relevant sequence, then re-arbitrate.
// 2 - The chosen sequence will return from wait_for_grant
// 3 - The chosen sequence <uvm_sequence_base::pre_do> is called
// 4 - The chosen sequence item is randomized
// 5 - The chosen sequence <uvm_sequence_base::post_do> is called
// 6 - Return with a reference to the item
//
// Once <get_next_item> is called, <item_done> must be called to indicate the
// completion of the request to the sequencer. This will remove the request
// item from the sequencer FIFO.
对比
// Task: peek
//
// Returns the current request item if one is in the sequencer FIFO. If no
// item is in the FIFO, then the call will block until the sequencer has a new
// request. The following steps will occur if the sequencer FIFO is empty:
//
// 1 - Arbitrate among requesting, unlocked, relevant sequences - choose the
// highest priority sequence based on the current sequencer arbitration mode.
// If no sequence is available, wait for a requesting unlocked relevant
// sequence, then re-arbitrate.
//
// 2 - The chosen sequence will return from <uvm_sequence_base::wait_for_grant>
// 3 - The chosen sequence <uvm_sequence_base::pre_do> is called
// 4 - The chosen sequence item is randomized
// 5 - The chosen sequence <uvm_sequence_base::post_do> is called
//
// Once a request item has been retrieved and is in the sequencer FIFO,
// subsequent calls to peek will return the same item. The item will stay in
// the FIFO until either get or <item_done> is called.
解决方案
Peek绝对来自 TLM1 风格。它使您有机会查看队列中的下一个项目,而无需将其从队列中删除。这意味着您尚未承诺启动该项目。Peeks 可用于两种不同的场景。
- 一对多:您可以有多个驱动程序,或单个驱动程序中的多个线程进行窥视,然后决定是否要获取序列项,或忽略该项。让您在
peak
决定使用get
. - 多对一:您可以将多个音序器连接到同一个驱动程序。驱动程序将从其所有连接中查看并决定它想要提交的序列器。
推荐阅读
- python - Unstack Groupby 没有使用 Pandas 将数据分组到正确的数据集中
- python - LCD 未使用新值更新
- python - 适用于 Windows 10 的 PyBluez?
- python - 如何修复函数对象不可迭代?
- python - 布尔值不可调用
- javascript - 使用 axios 将 Fileupload 和 JsonData 对象发送到 dotnet core api 时出错
- image - 停止 TinyMCE 图像工具插件将图像文件重命名为 imagetools.jpg
- php - Laravel:在另一个数据透视表中使用一个数据透视表 id
- google-bigquery - BigQuery - 无法解析输入字符串
- java - 在 Mac 上使用 Eclipse 时,GUI 未与 JavaFX 15 一起显示