监控同步

Monitor Synchronization

我正在尝试构建用于内存验证的分层测试平台。我在驱动程序和监视器端显示 read_data(内存中的数据)。问题是监视器只在循环开始时被触发。但我希望在 read_write =0 时触发监视器。为什么监视器不考虑所有场景? 在环境 class 中,我正在调用驱动程序、监视器和生成器的 运行 方法。 Link: http://www.edaplayground.com/x/389q

你的代码有几个问题。首先,您可能希望在您的监视器 class 中有一个 forever 循环。 运行()方法中现在的写法是等待2个时钟周期,然后等待read_write == 0,然后就结束了。

另一个问题是您在分层引用中使用了 modport 名称 monitor。 modport 不是范围,它是声明虚拟接口变量时使用的访问列表。

最后,在使用 clocking 块时,您应该只使用时钟块事件进行同步,切勿使用 raw 信号。

class monitor;

  virtual intf.monitor vintf;

  function new(virtual intf.monitor vintf);
    this.vintf=vintf;
  endfunction

  task run();
    forever
      @(vintf.mo) // No ; here. You would get stuck in an infinite loop
      begin
        $display("--------MONITOR STARTS--------");
        @(vintf.mo iff (vintf.mo.read_write==0))
      begin
      $display("--------MONITOR READDATA--------");
        $display(vintf.mo.read_data);
        $display(vintf.mo.address);
      end
      end  
  endtask 
endclass