always_ff语句中的for循环

时间:2018-08-03 10:00:59

标签: verilog

这是我的代码的一部分:

generate
begin
 t = branch_decision_o;
end
genvar j;end
            else
                begin
                    t = -1;
                end
            //////////find absolute value //////////////////
            if (y == 1)
                begi

always_ff@(branch_decision_o) //came from ALU -----> .comparison_result_o 
        begin

            if (t == 1) 
                begin
                    t = 1;
                n
                    abs_y = y;
                end
            else
                begin   
                    abs_y =-1 * y;
                end 
            ///////////////////////////////////////////////

            if ((sign_y != t) || (abs_y <= teta))
                begin

                        for(j = 1; j < n-1; j++ ) 
                        begin
                            wn[entry][j] <= wn[entry][j] + (t*xn[1][j]);
                        end


                end
            xn = xn << 1;
            xn[n-1] = t;
            if (xn[n-1] == 0) 
                begin 
                    xn[n-1] = -1;
                end

        end

endgenerate

因此是错误:

** Error: (vlog-13069) /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(212): near "=": syntax error, unexpected '='.
** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(212): (vlog-13205) Syntax error found in the scope following 't'. Is there missing '::'?

指的是第三行:t = branch_decision_o。

我为解决该问题做了很多尝试,但没有成功。 我试图放入“ assign”或“ <=“,但输出错误“非法参考”

我需要你的帮助

********编辑********** 我将代码中的第三行更改为:Assign t = branch_decision_o;

   ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(221): (vlog-2110) Illegal reference to net "t".
   ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(225): (vlog-2110) Illegal reference to net "t".
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(230): (vlog-2110) Illegal reference to net "abs_y".
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(234): (vlog-2110) Illegal reference to net "abs_y".
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(241): Invalid context for genvar j. A genvar can be used only inside of the generate loop that it indexes.
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(241): Invalid context for genvar j. A genvar can be used only inside of the generate loop that it indexes.
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(241): Invalid context for genvar j. A genvar can be used only inside of the generate loop that it indexes.
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(243): Invalid context for genvar j. A genvar can be used only inside of the generate loop that it indexes.
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(243): Invalid context for genvar j. A genvar can be used only inside of the generate loop that it indexes.
    ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(243): Invalid context for genvar j. A genvar can be used only inside of the generate loop that it indexes.
   ** Error (suppressible): (vlog-10008) /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(243): Too many indices (2) for array type xn (dimensionality 1).
   ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(248): (vlog-2110) Illegal reference to net "xn".
   ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(249): (vlog-2110) Illegal reference to net "xn".
   ** Error: /home/vlsi/pulpino/vsim/..//ips/riscv/riscv_ex_stage.sv(252): (vlog-2110) Illegal reference to net "xn".

0 个答案:

没有答案