非阻塞驱动程序定序器模型

Nonblocking driver-sequencer model

我通常有一个典型的driver-sequencer通信机制如下:

// somewhere in driver run_phase
seq_item_port.get(req_item);
$cast(rsp_item, req_item.clone());
// ... execute the item
seq_item.port.put(rsp_item);

在执行项目时,可能有一个条件要求驱动程序暂停执行,直到满足特定事件。当事件发生时,驱动程序可以恢复并完成执行。 在暂停期间,驱动程序应该能够执行其他 sequence_item 由 sequencer.

传输的

显然,上面的代码无法处理这种情况。所以我想我需要排序器和驱动程序之间的某种非阻塞机制。 由于我以前从未这样做过,所以我想知道是否有示例或标准用法 model/mechanism 来执行此操作。

您必须在驱动程序和序列器 运行 的序列中实现这种类型。

在驱动程序中,您需要进行一些分叉。因为我不能确切地知道你想做什么,所以我会写一些通用的东西:

class some_driver;
  task run_phase(uvm_phase phase);
    forever begin
      seq_item_port.get(req);
      $cast(rsp, req.clone());
      fork
        if (<some_condition_here>) begin
          drive(req);
          seq_item.port.put(rsp);
        end
      join_none
    end
  endtask
endclass

<some_condition> 可能取决于被驱动的项目、系统状态或两者。您的驱动程序将愉快地从音序器中获取项目并按照自己的节奏驱动它们。

在 运行 的序列中,您还必须通过分叉来实现并行性:

class some_sequence;
  task body();
    // item1 has to be finished completely before going further
    start_item(item1);
    finish_item(item1);
    get_response(item1);

    // item2 has to start before item3, but it doesn't matter which is done first
    start_item(item2);
    finish_item(item2);

    start_item(item3);
    finish_item(item3);

    fork
      begin
        get_response(item2);
        get_response(item3);
      end
    join
  endtask
endclass

你可以实现各种疯狂的场景。同样,这一切都非常通用,但它应该是实现您自己的代码的起点。