即使语法看起来正确,简单的代码也会产生错误ISE VERILOG

问题描述

我在 Xilinx ISE verilog 编码方面相对很新(只有几个小时)。这是我的 uni 项目中的代码。它在 count = 0 行显示语法错误。在运行检查语法时,我没有发现任何问题。我该如何解决这个问题?

 module syncdown(clk,rst,count);
input clk,rst;
output reg [3:0] count = 1;
always @(posedge clk);
begin
if(rst)
count = 0; // wrong here 
else
count = count-1;
end
endmodule

错误

ERROR:HDLCompiler:806 - "/home/bossman/mux/syncdown.v" Line 8: Syntax error near "=".

解决方法

去掉 always 行末尾的分号:

module syncdown(clk,rst,count);
input clk,rst;
output reg [3:0] count = 1;
always @(posedge clk)
begin
if(rst)
count = 0; // wrong here 
else
count = count-1;
end
endmodule

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...