系统 verilog 中没有类型的输入
我在一个模块
的输入和输出的系统verilog代码解码示例中遇到过,没有说明它们的类型,例如logic
、wire
...
module mat_to_stream (
input [2:0] [2:0] [2:0] a,b,
input newdata,
input rst, clk,
output [2:0] [7:0] A_out, B_out);
...rest of code...
声明逻辑和不声明任何类型之间有什么区别?
I've encountered in an example for a system verilog code decleration of inputs and outputs for a module
without stating their type, e.g logic
, wire
...
module mat_to_stream (
input [2:0] [2:0] [2:0] a,b,
input newdata,
input rst, clk,
output [2:0] [7:0] A_out, B_out);
...rest of code...
What is the diffrence between stating logic
and not stating any type?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
声明逻辑和不声明任何类型之间没有区别。
相当于
SystemVerilog IEEE Std (1800-2009) 在“23.2.2.3 确定端口类型、数据类型和方向的规则”部分对此进行了描述。
There is no difference between stating
logic
and not stating any type.is equivalent to
The SystemVerilog IEEE Std (1800-2009) describes this in section: "23.2.2.3 Rules for determining port kind, data type and direction".
不为输入分配数据类型是很常见的,因为它们几乎总是
wire
。名义上相当于:
它实际上是在拾取
`default_nettypewire
,可以将其更改为uwire
以强制编译器检查唯一的驱动程序,这将因多个接线错误而失败驱动器。使用
logic
作为类型可以在wire
和reg
之间进行自动选择,这对于输出很有用,并且可以更容易地折射。输入永远不能是reg
类型。Stuart Sutherlands SNUG2013 论文,第 12 节介绍了
uwire 可用于更好地暗示设计意图。
It is very common to not assign inputs a data type, as they should almost always be
wire
.Is nominally equivalent to:
It is actually picking up
`default_nettype wire
which could be changed to sayuwire
to enforce compiler checks for unique drivers, which will fail on wiring mistakes with multiple drives.Using
logic
as a type allows the auto selection betweenwire
andreg
which is useful for outputs and allows easier refracting. Inputs can never bereg
type.Stuart Sutherlands SNUG2013 paper, section 12 covers how
uwire
could be used to better imply design intent if it was supported correctly by the tools.来自 SystemVerilog IEEE Std (1800-2017) 在“23.2.2.3 确定端口类型、数据类型和方向的规则”部分对此进行了描述
From, SystemVerilog IEEE Std (1800-2017) describes this in section: "23.2.2.3 Rules for determining port kind, data type and direction"