首页 文章

使用default_nettype none时,SystemVerilog将端口类型从连接更改为逻辑会出错

提问于
浏览
0

我正在将我的设计从Verilog转换为SystemVerilog,默认情况下我有 'default_nettype none 指令 . 这是我的设计:

`default_nettype none

module my_design 
#(
parameter INPUT_WIDTH  = 16,
parameter OUTPUT_WIDTH = 2*INPUT_WIDTH
)
(
    input  wire signed [INPUT_WIDTH-1 : 0 ]  x_in,
    input  wire signed [INPUT_WIDTH-1 : 0 ]  y_in,
    output wire signed [OUTPUT_WIDTH-1 : 0]  z_out
);

哪个编译没有任何问题 . 但是,当我将线路更改为逻辑时,如下所示:

module my_design 
#(
parameter INPUT_WIDTH  = 16,
parameter OUTPUT_WIDTH = 2*INPUT_WIDTH
)
(
    input  logic signed [INPUT_WIDTH-1 : 0 ]  x_in,
    input  logic signed [INPUT_WIDTH-1 : 0 ]  y_in,
    output logic signed [OUTPUT_WIDTH-1 : 0]  z_out
);

我的所有端口信号都出现以下错误:

ERROR: [VRFC 10-1103] net type must be explicitly specified for 'x_in' 
when default_nettype is none

这对我来说很奇怪,因为我已经明确地对所有端口进行了十分转换 . 我正在使用 Vivado Simulator 2018.2 . 我使用以下命令编译上面的代码:

xvlog --sv -f files.f

而files.f只包含我的设计和测试文件 .

1 回答

  • 2

    输入端口隐式 wire 具有隐式 logic 数据类型的网络类型 . SystemVerilog选择这些默认值与Verilog向后兼容 .

    因此,您的原始Verilog输入声明是一个明确的 wire ,具有隐式的 logic 数据类型 . 您将其更改为具有显式 logic 数据类型的隐式 wire nettype . 但结果在功能上是相同的 . 您需要添加回 wire 关键字 .

    以下都是功能相同的:

    input signed [INPUT_WIDTH-1 : 0 ]  x_in, // implicit wire logic
     input logic signed [INPUT_WIDTH-1 : 0 ]  x_in, // implicit wire
     input wire signed [INPUT_WIDTH-1 : 0 ]  x_in, // implicit logic
     input wire logic signed [INPUT_WIDTH-1 : 0 ]  x_in, // explicit
    

相关问题