问题遇到的现象和发生背景
使用Quartus II 时出现10170错误 always语句和if else 的嵌套出现问题
问题相关代码,请勿粘贴截图
//CUR_RD_R初始值为RD-
always @(posedge clk )begin
if(start) CUR_RD_R<=CUR_RD;
else CUR_RD_R<=RD_N; end //与5b6b编码表对应 always @(posedge clk )begin if(encode_start_r[2]) begin case(data_in_r) 5'd0:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b100111;
PRE_RD_R<=RD_P; end else begin data_out_r<=6'b011000; PRE_RD_R<=
RD_N;
end
5'd1:if(CUR_RD_R==RD_N)begin data_out_r<=6'b011101; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b100010;
PRE_RD_R<=RD_N; end 5'd2:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b101101;
PRE_RD_R<=RD_P; end else begin data_out_r<=6'b010010; PRE_RD_R<=
RD_N;
end
5'd3:begin
data_out_r<=6'b110001;
PRE_RD_R<=CUR_RD;
end
5'd4:if(CUR_RD_R==RD_N)begin data_out_r<=6'b110101; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b001010;
PRE_RD_R<=RD_N; end 5'd5:begin data_out_r<=6'b101001; PRE_RD_R<=CUR_RD; end 5'd6:begin data_out_r<=6'b011001; PRE_RD_R<=CUR_RD; end 5'd7:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b111000;
PRE_RD_R<=CUR_RD;
end
else begin
data_out_r<=6'b000111;
PRE_RD_R<=CUR_RD;
end
5'd8:if(CUR_RD_R==RD_N)begin data_out_r<=6'b111001; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b000110;
PRE_RD_R<=RD_N; end 5'd9:begin data_out_r<=6'b100101; PRE_RD_R<=CUR_RD; end 5'd10:begin data_out_r<=6'b010101; PRE_RD_R<=CUR_RD; end 5'd11:begin data_out_r<=6'b110100; PRE_RD_R<=CUR_RD; end 5'd12:begin data_out_r<=6'b001101; PRE_RD_R<=CUR_RD; end 5'd13:begin data_out_r<=6'b101100; PRE_RD_R<=CUR_RD; end 5'd14:begin data_out_r<=6'b011100; PRE_RD_R<=CUR_RD; end 5'd15:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b010111;
PRE_RD_R<=RD_P; end else begin data_out_r<=6'b101000; PRE_RD_R<=
RD_N;
end
5'd16:if(CUR_RD_R==RD_N)begin data_out_r<=6'b011011; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b100100;
PRE_RD_R<=RD_N; end 5'd17:begin data_out_r<=6'b100011; PRE_RD_R<=CUR_RD; end 5'd18:begin data_out_r<=6'b010011; PRE_RD_R<=CUR_RD; end 5'd19:begin data_out_r<=6'b110010; PRE_RD_R<=CUR_RD; end 5'd20:begin data_out_r<=6'b001011; PRE_RD_R<=CUR_RD; end 5'd21:begin data_out_r<=6'b101010; PRE_RD_R<=CUR_RD; end 5'd22:begin data_out_r<=6'b011010; PRE_RD_R<=CUR_RD; end 5'd23:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b111010;
PRE_RD_R<=RD_P; end else begin data_out_r<=6'b000101; PRE_RD_R<=
RD_N;
end
5'd24:if(CUR_RD_R==RD_N)begin data_out_r<=6'b110011; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b001100;
PRE_RD_R<=RD_N; end 5'd25:begin data_out_r<=6'b100110; PRE_RD_R<=CUR_RD; end 5'd26:begin data_out_r<=6'b010110; PRE_RD_R<=CUR_RD; end 5'd27:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b110110;
PRE_RD_R<=RD_P; end else begin data_out_r<=6'b001001; PRE_RD_R<=
RD_N;
end
5'd28:begin
data_out_r<=6'b001110;
PRE_RD_R<=CUR_RD;
end
5'd29:if(CUR_RD_R==RD_N)begin data_out_r<=6'b101110; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b010001;
PRE_RD_R<=RD_N; end 5'd30:if(CUR_RD_R==
RD_N)begin
data_out_r<=6'b011110;
PRE_RD_R<=RD_P; end else begin data_out_r<=6'b100001; PRE_RD_R<=
RD_N;
end
5'd31:if(CUR_RD_R==RD_N)begin data_out_r<=6'b101011; PRE_RD_R<=
RD_P;
end
else begin
data_out_r<=6'b010100;
PRE_RD_R<=`RD_N;
end
endcase
end
end
assign PRE_RD=PRE_RD_R;
assign data_out=data_out_r;
assign encode_end= encode_start_r[2];
运行结果及报错内容
我的解答思路和尝试过的方法
修改过顺序没有用
我想要达到的结果
希望运行出来不报错