Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
System verilog 什么';uvm_sqr_if_base::peek()和uvm_sqr_if_base::get_next_item()之间的区别是什么?_System Verilog_Uvm - Fatal编程技术网

System verilog 什么';uvm_sqr_if_base::peek()和uvm_sqr_if_base::get_next_item()之间的区别是什么?

System verilog 什么';uvm_sqr_if_base::peek()和uvm_sqr_if_base::get_next_item()之间的区别是什么?,system-verilog,uvm,System Verilog,Uvm,在系统Verilog UVM中,TLM端口中用于序列和驱动程序之间通信的接口(UVM_sqr_if_base)提供了灵活性。对于拉取请求,我将在此表中总结四个选项: blocking item_done get_next_item() yes no try_next_item() no no get() yes yes peek() ye

在系统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\u next\u 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样式

编辑:

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

  // 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.
//任务:获取下一项
//
//从序列中检索下一个可用项。电话将被阻塞
//直到有物品可用。此呼叫将执行以下步骤:
//
//1-在请求、解锁和相关序列之间进行仲裁-选择
//基于当前定序器仲裁的最高优先级序列
//模式。如果没有可用的序列,请等待请求解锁
//相关顺序,然后重新仲裁。
//2-所选序列将从等待授予返回
//3-调用所选序列
//4-所选序列项是随机的
//5-调用所选序列
//6-返回并引用项目
//
//一旦调用,必须调用以指示
//完成对定序器的请求。这将删除该请求
//来自定序器FIFO的项目。
vs

//任务:peek
//
//如果sequencer FIFO中有请求项,则返回当前请求项。如果没有
//项目在FIFO中,则调用将被阻止,直到sequencer有一个新的
//请求。如果序列器FIFO为空,将执行以下步骤:
//
//1-在请求、解锁和相关序列之间进行仲裁-选择
//基于当前定序器仲裁模式的最高优先级序列。
//如果没有可用的序列,请等待相关的请求
//排序,然后重新仲裁。
//
//2-所选序列将从
//3-调用所选序列
//4-所选序列项是随机的
//5-调用所选序列
//
//一旦检索到请求项并将其置于sequencer FIFO中,
//对peek的后续调用将返回相同的项。该物品将保留在
//先入先出,直到获取或调用。

Peek绝对是TLM1风格。它使您有机会查看队列中的下一个项目,而无需将其从队列中移除。这意味着您尚未承诺启动该项目。Peek可用于两种不同的场景

  • 一对多:您可以有多个驱动程序,或者在一个驱动程序中有多个线程进行查看,然后决定是否要获取序列项,或者忽略该项。
    peak
    允许您在决定使用
    get
    提交之前查看项目的内容
  • 多对一:可以将多个序列器连接到同一个驱动程序。驱动程序将从其所有连接中查看一眼,并决定要提交给哪个sequencer
  •   // 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.