微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

uvm_sqr_if_base::peek() 和 uvm_sqr_if_base::get_next_item() 有什么区别?

如何解决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

... 其中 blocking 表示如果调用方法,但没有序列准备好提供数据,则任务将阻塞并等待,直到数据准备好并且可以返回。

... 其中 item_done 表示该方法在成功从序列中拉出一个项目后还会调用 item_done()

那么 peek()get_next_item() 之间有什么区别?

考虑来自两个虚构驱动程序的这两个代码片段......

  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 风格。

编辑:

回答下面的问题。在问这个问题之前,我已经查看了源代码。事实上,LANGUAGE 只是略有不同,代码似乎做完全相同的事情。重点是什么?我错过了什么?

  // 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,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 可用于两种不同的场景。

  1. 一对多:您可以有多个驱动程序,或单个驱动程序中的多个线程执行peeks,然后决定他们是否要获取序列项,或忽略该项目。 peak 可让您在决定使用 get 提交之前查看项目的内容。
  2. 多对一:您可以将多个音序器连接到同一个驱动程序。驱动程序会查看其所有连接并决定要提交给哪个音序器。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。