modelsim 中的 -svinputport 选项

-svinputport option in modelsim

我正在使用 modlesim 进行设计,在此我们传递了一个选项 -svinputport=var,这个选项有什么用?在编译每个设计文件之前,我们正在传递 `default_nettype none。这两者是否依赖?谁能帮我举个例子。

选项说明如下

svinputport=net|var|compat|relaxed
                     Select the default kind for an input port that is
                     declared with a type, but without the var keyword.
                     Select 'net' for strict LRM compliance, where the
                     kind always defaults to wire. Select 'var' for
                     non-compliant behavior, where the kind always defaults
                     to var. Select 'compat', where only types compatible with
                     net declarations default to wire. The default is 'relaxed',
                     where only a type that is a 4-state scalar or 4-state single
                     dimension vector type defaults to wire.

问题(2)

非常感谢您的详细解释。我对此还有一个疑问。当我 运行 以下代码时,我收到警告:

`default_nettype none

module test(
input  reg sig1,
output logic sig2);
reg [1:0] ab;
endmodule

xmvlog: *W,NODNTW (test.sv,4|14): 不允许隐式网络端口 (sig1),因为 `default_nettype 声明为 'none'; 'wire' 改为使用 [19.2(IEEE 2001)]。为什么它将输入 reg sig1 引用为隐式网络端口,我已经明确地将其声明为 reg?根据它正在更改为 wire 的消息,该语句将类似于“input wire reg sig1”吗?

我们可以声明输入reg a吗?在 systemverilog(具有 reg 类型的输入端口)中?这是否隐含地等同于输入线 reg a; (如果我不使用 `default_nettype none)

Verilog 到处都是隐式默认值。当你写

module m(a);
  initial $disaply(a);
endmodule

这与

隐式相同
   //    direction kind type  range  signal
module m(inout     wire logic [0:0]  a);
  initial $disaply(a);
endmodule

对于 inoutinput 方向,如果您省略 类型 ,则默认为 wire 或取自 `default_nettype 环境。 none 设置会产生错误。但是,output 的默认 kind 不同。只要将 datatype 添加到 output,默认的 kind 就会变为 var,这类似于非港口申报。有关详细信息和示例,请参阅 this post

但是,SystemVerilog/Superlog 的早期版本有 inputinout,它们的 种类 默认值与 output 相同。 -svinputport=var 开关是为一个非常大的微处理器开发人员客户添加的,我无法提及他们的名字,他们不想更改他们的代码。 =net 选项是我上面提到的行为,也是当前 LRM 的定义方式。

其他两个选项是 var/net 选项的混合体,主要针对使用 default_nettype none 选项且不想在端口声明中看到错误的懒人。