SystemVerilog 接口 - 在模块声明后传递参数

SystemVerilog interface - Passing parameters after module declaration

给定以下模块声明:

module ( myinterface.mymodport mybus, ... );

假设 myinterface 有参数,我该如何指定它们?

接口实例化只发生在testbench中,但现在我想综合DUT,所以TB消失了。

您在实例化接口时指定参数;您没有在模块的端口列表中指定它。鉴于

interface myinterface #(parameter DATA_SIZE = 0);
...

你只需要

module mymodule (myinterface.mymodport mybus);
...

因为你在其他地方有

myinterface #(.DATA_SIZE(64)) i();

interface myinterface #(parameter DATA_SIZE = 0);
  logic [DATA_SIZE-1:0]  AWID;
  logic [31:0] AWADDR;
  modport mymodport (input AWID, AWADDR);
endinterface

module mymodule (myinterface.mymodport mybus);
  initial
    $display("mymodule");
endmodule

module top;
  myinterface #(.DATA_SIZE(64)) i();
  mymodule m (.mybus(i));
endmodule

https://www.edaplayground.com/x/528x

这是 SystemVerilog LRM 中的疏忽。没有语法来为模块头中的接口指定一组必需的参数。

您可以检查您的综合工具,看看它们是否提供任何方式来为顶级综合实例指定参数覆盖。