【问题标题】:Simple code yielding error even though syntax seems correct (ISE VERILOG)即使语法看起来正确,简单的代码也会产生错误(ISE VERILOG)
【发布时间】:2021-04-04 06:06:13
【问题描述】:

我在 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 "=".

【问题讨论】:

    标签: verilog xilinx xilinx-ise


    【解决方案1】:

    删除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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-02
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 1970-01-01
      • 2014-12-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多