如何从系统 verilog 接口传递具有不同极性的多个时钟块?

问题描述

我有一个系统verilog接口

interface XZY(input clk,input reset,input a,output b);
    clocking cb @(posedge clk);
        input a;
        output b;
    endclocking: cb

   modport master(clocking cb,input reset);


endinterface: XYZ

我将接口作为 virtual interface 传递给我的驱动程序。

驱动程序正在使用 moport(master)。

现在我需要访问驱动程序中时钟的 posedgenegedge

我可以通过posedge轻松访问@cb

如何访问 negedge

我是否需要为 modport 创建另一个 clocking block/negedge 并将其单独传递给驱动程序?

解决方法

如果您选择使用时钟模块作为访问接口中信号的唯一机制,则必须创建另一个时钟模块。我通常不会在验证接口中使用 modport,但您必须将时钟块添加到现有的 modport 或添加另一个。

,

我会为正沿和负沿时钟推荐一个时钟模块。您可以在 modport 中列出两个时钟块。在您的驱动程序/监视器中时,您不需要 modport。

如果您想使用相同的时钟块动态选择极性,请在此处查看我的答案:Changing clocking block clock polarity on the fly。这适用于极性模式切换;如果在同一个事务中需要两个边,我不会推荐它。