在 SystemVerilog 中,(.*) 是什么意思?
In SystemVerilog, what does (.*) mean?
我有一个测试平台声明为
module test_circuit
logic a,b,c;
logic y;
circuit UUT (.*); //what does this line mean?
initial begin
//something here
end
endmodule
我还没有找到任何教程来告诉我它的含义。我看过语言参考手册,它说它是 'wildcard pattern',但没有详细说明。
否则...在任何搜索引擎中都很难搜索到特殊字符,而且我找到的结果似乎只与其他语言有关。
它实际上在 SystemVerilog LRM 中有相当广泛的描述。查看第 23.3.2.4 节使用通配符命名端口连接 (.*) 连接模块实例。引用本节第一部分:
SystemVerilog can implicitly instantiate ports using a .* wildcard syntax for all ports where the instance port name matches the connecting port name and their data types are equivalent. This eliminates the requirement to list any port where the name and type of the connecting declaration match the name and equivalent type of the instance port.
将此反映到您的示例中:假设模块 circuit
具有端口 a
、b
、y
和 d
。
您可以按照 LRM 的第 23.3.2.2 节中的描述完全明确地连接它们。如果名称或宽度不匹配,这是必需的:
circuit UUT
(.a (a),
.b (b),
.c (c),
.y (y));
您还可以使用隐式命名端口连接(LRM 的第 23.3.2.3 节):
circuit UUT
(.a,
.b,
.c,
.y);
但是,如果您不想输入所有端口,最快的方法是确保信号的名称和类型在层次结构中匹配。然后,您可以简单地使用通配符命名端口连接:
circuit UUT
(.*);
请记住,最后一种方法可能会使调试您的 RTL 变得困难,因为它在高电平上变得更难跟踪信号。
奖励:除了 LRM,还可以看看 Sutherland & Mills 的论文 Synthesizing SystemVerilog - Busting the Myth that SystemVerilog is only for Verification。第 7 节对不同类型的端口连接以及点名和点星连接的优点进行了很好的总结。
除了Silicon1602的回答,你也可以这样做,也就是说变量aa
连接到端口a
,其他端口连接到同名变量:
circuit UUT
(.a(aa),
.*);
我有一个测试平台声明为
module test_circuit
logic a,b,c;
logic y;
circuit UUT (.*); //what does this line mean?
initial begin
//something here
end
endmodule
我还没有找到任何教程来告诉我它的含义。我看过语言参考手册,它说它是 'wildcard pattern',但没有详细说明。
否则...在任何搜索引擎中都很难搜索到特殊字符,而且我找到的结果似乎只与其他语言有关。
它实际上在 SystemVerilog LRM 中有相当广泛的描述。查看第 23.3.2.4 节使用通配符命名端口连接 (.*) 连接模块实例。引用本节第一部分:
SystemVerilog can implicitly instantiate ports using a .* wildcard syntax for all ports where the instance port name matches the connecting port name and their data types are equivalent. This eliminates the requirement to list any port where the name and type of the connecting declaration match the name and equivalent type of the instance port.
将此反映到您的示例中:假设模块 circuit
具有端口 a
、b
、y
和 d
。
您可以按照 LRM 的第 23.3.2.2 节中的描述完全明确地连接它们。如果名称或宽度不匹配,这是必需的:
circuit UUT
(.a (a),
.b (b),
.c (c),
.y (y));
您还可以使用隐式命名端口连接(LRM 的第 23.3.2.3 节):
circuit UUT
(.a,
.b,
.c,
.y);
但是,如果您不想输入所有端口,最快的方法是确保信号的名称和类型在层次结构中匹配。然后,您可以简单地使用通配符命名端口连接:
circuit UUT
(.*);
请记住,最后一种方法可能会使调试您的 RTL 变得困难,因为它在高电平上变得更难跟踪信号。
奖励:除了 LRM,还可以看看 Sutherland & Mills 的论文 Synthesizing SystemVerilog - Busting the Myth that SystemVerilog is only for Verification。第 7 节对不同类型的端口连接以及点名和点星连接的优点进行了很好的总结。
除了Silicon1602的回答,你也可以这样做,也就是说变量aa
连接到端口a
,其他端口连接到同名变量:
circuit UUT
(.a(aa),
.*);