简体   繁体   English

错误 (10170): CRC_configurable.v(62) 附近文本的 Verilog HDL 语法错误:“整数”; 期待“结束”

[英]Error (10170): Verilog HDL syntax error at CRC_configurable.v(62) near text: "integer"; expecting "end"

I'm working with Quartus Prime Lite Edition and having a case statement with:我正在使用 Quartus Prime Lite Edition 并有一个case声明:

S2: begin
            dat[WID_DAT-1 :1] <= dat[WID_DAT-2 :0];
            dat[0] <= 0;
            crc[0] <= crc_temp[0];
            integer i;
            for (i = 1; i < WID_CRC; i = i+1) begin
                crc[i] <= crc_temp[i] ^ crc[i-1];
            end
            
            if(count != 0) begin
                r_ns <= S2;
                count <= count -1;
            end
            
            else begin
            r_ns <= S_DONE;
            done <= 1;
            end
        end

and get the error message when I Start Anlysis & Elaboration:并在我开始分析和细化时收到错误消息:

Error (10170): Verilog HDL syntax error at CRC_configurable.v(62) near text: "integer";错误 (10170): CRC_configurable.v(62) 附近文本的 Verilog HDL 语法错误:“整数”; expecting "end".期待“结束”。

Why is this so, and how should I avoid it?为什么会这样,我应该如何避免它?

You must not declare an integer in the middle of a begin/end block.您不得在begin/end块的中间声明integer You could move the integer declaration line outside of the always block (before it).您可以将integer声明行移到always块之外(在它之前)。

integer i;

always ... 
...
S2: begin
            dat[WID_DAT-1 :1] <= dat[WID_DAT-2 :0];
            dat[0] <= 0;
            crc[0] <= crc_temp[0];
            for (i = 1; i < WID_CRC; i = i+1) begin
                crc[i] <= crc_temp[i] ^ crc[i-1];
            end

Or, if you give your begin block a name, you should be able to declare the integer immediately after the begin line.或者,如果你给你的开始块一个名字,你应该能够在begin行之后立即声明integer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有条件的 Verilog For 循环给出错误:期待操作数 - Verilog For loop with no condition gives error: expecting operand 意外令牌“完成”附近的语法错误令人困惑 - Confusing syntax error near unexpected token 'done' &#39;错误:具有FOR LOOP的PL / pgSQL函数在“ AS”处或附近的语法错误 - 'ERROR: syntax error at or near “AS”' for a PL/pgSQL function with FOR LOOP Bash脚本:意外令牌“ done”附近的语法错误 - Bash scripting: syntax error near unexpected token `done' python 语法错误:在 for if 语句的末尾,不知道为什么 - python syntax error for : at end of for if statment, no idea why 语法错误:for循环中文件意外结束 - syntax error: unexpected end of file in for loop 简单Verilog for循环中的错误 - Error in simple Verilog for-loop 累积相对性能 - '不匹配的输入 '|PE|' 期待 Pine 脚本出现“行尾没有续行”错误 - Cumulative Relative Performance - 'Mismatched input '|PE|' expecting 'end of line without line continuation'' error with Pine Script ./batchTest.sh:第4行:意外令牌&#39;;&#39;附近的语法错误 ./batchTest.sh:第4行:`./test 1&gt;&;&#39; - ./batchTest.sh: line 4: syntax error near unexpected token `;' ./batchTest.sh: line 4: ` ./test 1>&;' 在寻找匹配的第27行时:语法错误:文件意外结束 - while looking for matching line 27: syntax error: unexpected end of file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM