3

Given the following module declaration:

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

And assuming that myinterface has parameters, how do I specify them?

The interface instantiation happens only in the testbench, but now I want to synthesize the DUT, so the TB disappears.

2 Answers 2

3

This is an oversight in the SystemVerilog LRM. There's no syntax to specify a required set of parameters for an interface in a module header.

You might check your synthesis tool to see if they provide any way of specifying parameter overrides for the top-level synthesis instance.

Sign up to request clarification or add additional context in comments.

Comments

0

You specify the parameter when you instantiate the interface; you do not specify it in the port list of the module. Given

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

All you need is

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

because somewhere else you have

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

3 Comments

Correct. But in my case the interface instantiation happens at testbench level. As now I am moving the design to synthesis, the TB is removed and there is no interface instantiation. I am starting to think that the only possibility here is to create a wrapper specifically for the synthesis.
How do you even connect modules in physical world if the interface is not instantiated there? It needs to be seen by the synthesis and other tools. It was not correct to instantiate it in the test bench in the first place.
The synthesis tool is smart enough to fetch info from the definition of the interface. It's enough to specify the modport, but not required to instantiate the interface, as long as its default parameters are provided. In fact the synthesis succeeded.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.