我试图编译一些非常基本的Verilog文件,其中模块输入/输出是由指导员提供的,并且我编写了一个数据流分配,但是我得到了指导员的语法错误。这是源文件的简化版本:
module syntax1 (
input A, B,
output C
);
assign C = A && B; // Only line that I can modify
endmodule我用verilog syntax1.v编译它并获得以下输出:
Host command: [path removed for stackoverflow]/verilog.exe
Command arguments:
syntax1.v
Tool: VERILOG-XL 08.20.001-d log file created Jan 9, 2016 17:56:34
Tool: VERILOG-XL 08.20.001-d Jan 9, 2016 17:56:34
[license is here]
Compiling source file "syntax1.v"
Error! syntax error [Verilog]
"syntax1.v", 2: input<-
Error! Input, output or inout (C) not defined in port
list [Verilog-INOPL]
"syntax1.v", 3:
Error! syntax error [Verilog]
"syntax1.v", 4: )<-
Error! Identifier (A) not declared [Verilog-IDSND]
"syntax1.v", 6:
Error! Identifier (B) not declared [Verilog-IDSND]
"syntax1.v", 6:
5 errors
End of Tool: VERILOG-XL 08.20.001-d Jan 9, 2016 17:56:34如果我更改前三行(我希望这不是我必须做的)并重新编译,它就能工作:
module syntax2 (A, B, C);
input A, B;
output C;
assign C = A && B;
endmoduleVerilog产出:
Host command: [path removed for stackoverflow]/verilog.exe
Command arguments:
syntax2.v
Tool: VERILOG-XL 08.20.001-d log file created Jan 9, 2016 17:49:02
Tool: VERILOG-XL 08.20.001-d Jan 9, 2016 17:49:02
[license is here]
Compiling source file "syntax2.v"
Highest level modules:
syntax2
0 simulation events (use +profile or +listcounts option to count)
CPU time: 0.0 secs to compile + 0.0 secs to link + 0.0 secs in simulation
End of Tool: VERILOG-XL 08.20.001-d Jan 9, 2016 17:49:03所以,要么Verilog不喜欢在参数列表中声明的输入和输出,要么我做错了什么。我看到了一些web示例,就像在syntax1.v中所做的那样,所以我认为这是一个配置问题。我是否有可能针对不同版本的Verilog进行编译?
发布于 2016-01-10 02:44:15
使用ANSI样式报头的示例代码,在IEEE Std 1364-2001 (又称Verilog-2001)和更高版本中支持。根据维基百科的HDL正弦波表,Verilog只支持IEEESTD1364-1995(又名Verilog-1995)。也许Cadence添加了Verilog-2001支持,而且维基百科上没有记录它,查找或尝试-2001、-v2k或类似的命令行选项。
你掩盖了你的道路,所以我不知道你是将Verilog安装为独立的还是通过Cadence精辟的安装。如果您有深入的经验,可以尝试使用ncverilog或irun而不是verilog运行。
您应该考虑换到另一个模拟器。现代模拟器并不局限于Verilog-1995。
如果要继续使用Verilog,则需要将标头样式更改为非ANSI样式;示例如下。注意: Verilog-1995不支持@*,因此FSM将很难编写,除非您使用脚本为您声明敏感列表。
module syntax1 ( A, B, C );
input A;
input B;
output C;
assign C = A && B; // Only line that I can modify
endmodulehttps://stackoverflow.com/questions/34699965
复制相似问题