我试图通过最后一个稳定版本的伊韦里罗格 11.0用testbench编译verilog代码,下面是一个示例:
iverilog -o example example.v tb_example.v// example.v
module example(
input [1:0] input1, [1:0] input2, // problem is here
output [1:0] output1
);
// ...
endmodule// tb_example.v
module tb_example(
);
reg [1:0] input1;
reg [1:0] input2;
wire [1:0] output1;
example uut(input1, input2, output1);
// ...
endmodule尽管在vivado中编译没有问题,但上面的代码不能由iverilog编译,并给出了以下语法错误:
example.v:2: syntax error
example.v:1: Errors in port declarations.当我将example.v中的输入声明行更改为:
input [1:0] input1, input2, // still one line but second bit declaration removed或者这样说:
input [1:0] input1,
input [1:0] input2, // seperate lines这是没有问题的,它可以由iverilog编译,没有错误。
所以如果问题解决了,我为什么要问这个?因为首先,我不明白这可以在vivado中编译,而不是由iverilog编译;其次,我需要用testbenches控制像这样编写的多个文件(用一行多个位编写多个端口),而且很难全部更改它们。那么,我是遗漏了什么还是iverilog不支持这一点?
发布于 2021-12-25 00:55:15
这在Verilog中是合法的,但似乎是伊韦里罗格的一个bug。重要的不是您是否将它写在单独的行上,而是iverilog在任何类型声明之前都需要一个端口方向。因此,您必须使用您的解决方案之一或如下方法:
input [1:0] input1, input [1:0] input2,https://stackoverflow.com/questions/70476815
复制相似问题