【问题标题】:verilog HDLCompiler 806 error near <=<=附近的verilog HDLCompiler 806错误
【发布时间】:2016-04-13 06:09:57
【问题描述】:

所以我在 verilog 中有这段代码,但我不知道问题出在哪里? 在“如果”的陈述中,在条件中,在寄存器中,我不知道请帮助我

这里是代码和错误信息:

module top(
    input [31:0] din,
    output [31:0] dout
    );

reg [4:0] i, j;
reg [31:0] max =0;
reg [4:0] cnt;
reg [4:0] comp;


for(i=0; i<=31; i=i+1) begin
    if(din[i]== 1'b0) begin
        comp <= comp;
        end

        else if(din[i]==1 & din[i+1]==1) begin
            cnt<=cnt+1;
            if(cnt>comp) begin
                comp<=cnt;
                end else begin
                    comp<=comp;
                    end
                end 
            end

不断出现的问题是:

INFO:HDLCompiler:1845 - 将 Verilog 文件“D:/ProiecteISE/verilog proj/teme 2016/tema1/top.v”分析到库工作中 错误:HDLCompiler:806 -“D:/Proiecte ISE/verilog proj/teme2016/tema1/top.v”第 34 行:“

如果我删除“;”在有错误的行中,它看起来像这样:

module top(
    input [31:0] din,
    output [31:0] dout
    );

reg [4:0] i, j;
reg [31:0] max =0;
reg [4:0] cnt;
reg [4:0] comp;


for(i=0; i<=31; i=i+1) begin
    if(din[i]== 0) begin
        comp <= comp
        end
        else if(din[i]==1 & din[i+1]==1) begin
            cnt<=cnt+1
            if(cnt>comp) begin
                comp<=cnt
                end else begin
                    comp<=comp
                    end
                end 
            end





endmodule

只得到一个错误

INFO:HDLCompiler:1845 - 将 Verilog 文件“D:/Proiecte ISE/verilog proj/teme 2016/tema1/top.v”分析到库工作中 错误:HDLCompiler:806 -“D:/Proiecte ISE/verilog proj/teme 2016/tema1/top.v”第 34 行:“

【问题讨论】:

  • 请不要在未格式化的 cmets 中添加大量额外信息。相反,请edit 问题以易于阅读的方式包含额外内容。
  • 感谢您的建议,这是我的第一个问题
  • 自己解决了,我应该在“for”之前插入“alwasy@(*) begin”

标签: verilog hdl


【解决方案1】:

首先,您需要用分号来终止每个分配/操作,因此删除它们并不是正确的解决方法。

错误是抱怨它不理解&lt;= 符号。这是因为您使用的分配样式仅在 always 或 initial 块内有效。

如果您希望执行组合逻辑(此时您应该使用阻塞赋值 =),则将您的 for 循环包裹在 always@(*) 中,或者如果您正在执行顺序逻辑,则将 always@(posedge clk) 块包裹。

例如:

always@(*) begin
    for(i=0; i<=31; i=i+1) begin
         ....
    end
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多