如何使用系统Verilog分层接口



系统verilog中的顶级模块是否可以有接口端口?我试图定义一个层次接口,然后尝试将该接口用于顶部模块。

请检查下面的示例代码,如果我缺少,请告诉我

interface bank_inf (
inout logic [20:0] data_io,
inout logic qsb_io,
inout logic ctrl_io);
endinterface
interface channel_inf #(parameter numbanks = 7)
( bank_inf banks[numbanks-1:0] );
endinterface

interface ss1_inf #(parameter numchannels = 8, parameter numbanks = 7)
( channel_inf channels[numchannels-1:0]);
endinterface
module die1 (ss1_inf ss);
endmodule
module die2 (ss1_inf ss);
endmodule
module top (
ss1_inf ss1,
ss1_inf ss2
);
die1 inst1(ss1);
die2 inst2(ss1);
endmodule
I am getting below error:
Error-[SV-UIP] Unconnected interface port
../test.v, 22
"ss1"
The port 'ss1' of top-level module 'top' whose type is interface 'ss1_inf'
is left unconnected. It is illegal to leave the interface ports unconnected.
Please make sure that all the interface ports are connected.

从语言和模拟的角度来看,顶级模块不能有接口端口。接口端口表示对分层接口实例的引用。这些实例是存在变量分配和其他过程的地方。此外,接口可以参数化,并且指定参数化的唯一方法是通过实际实例。在端口声明中没有允许参数化的语法。

但从综合的角度来看,您为综合工具提供的最高级别可能允许接口端口。但您应该向您正在使用的特定合成工具供应商咨询。

否,顶级模块不能有接口端口。

原因是接口端口需要连接到接口实例。接口的实例化只能发生在模块内部。因此,只有在层次结构中实例化的模块才能连接到接口的实例。

$root/$单元级别不存在接口实例,因此没有接口实例顶级模块端口可以连接。

最新更新