Fix bad predecode of a0/a1 in mvsa01/mva01s.

Fix bad pop load offset when extra sp adjust is nonzero.
This commit is contained in:
Luke Wren 2023-03-20 01:03:49 +00:00
parent e966e832d2
commit 6b8923a623
2 changed files with 7 additions and 4 deletions

View File

@ -565,7 +565,7 @@ wire [4:0] zcmp_pushpop_rs1 =
wire [4:0] zcmp_sa01_r1s = {|next_instr[9:8], ~&next_instr[9:8], next_instr[9:7]};
wire [4:0] zcmp_sa01_r2s = {|next_instr[2:1], ~&next_instr[2:1], next_instr[2:0]};
wire [4:0] zcmp_mvsa01_rs1 = {4'h4, uop_ctr[0]};
wire [4:0] zcmp_mvsa01_rs1 = {4'h5, uop_ctr[0]};
wire [4:0] zcmp_mva01s_rs1 = uop_ctr[0] ? zcmp_sa01_r2s : zcmp_sa01_r1s;
always @ (*) begin

View File

@ -129,8 +129,11 @@ wire [6:0] zcmp_stack_adj_base =
zcmp_rlist[3:2] == 2'h2 ? 7'h20 :
zcmp_rlist[3:0] == 4'hf ? 7'h40 : 7'h30;
wire [11:0] zcmp_stack_lw_offset = {6'h00, uop_ctr, 2'h0};
wire [11:0] zcmp_stack_sw_offset = zcmp_stack_lw_offset - {5'h00, zcmp_stack_adj_base};
wire [6:0] zcmp_stack_adj_extra = {1'b0, instr_in[3:2], 4'h0};
// Note we perform all load/stores before moving the stack pointer.
wire [11:0] zcmp_stack_lw_offset = {6'h00, uop_ctr, 2'h0} + {5'h00, zcmp_stack_adj_extra};
wire [11:0] zcmp_stack_sw_offset = {6'h00, uop_ctr, 2'h0} - {5'h00, zcmp_stack_adj_base};
wire [4:0] zcmp_ls_reg =
uop_ctr == 4'h0 ? 5'd01 : // ra
@ -146,7 +149,7 @@ wire [31:0] zcmp_pop_lw_instr = `RVOPC_NOZ_LW | rfmt_rd(zcmp_ls_reg) | rfmt_rs1(
zcmp_stack_lw_offset[11:0], 20'h00000
};
wire [11:0] zcmp_abs_stack_adj = {5'h00, zcmp_stack_adj_base} + {6'h00, instr_in[3:2], 4'h0};
wire [11:0] zcmp_abs_stack_adj = {5'h00, zcmp_stack_adj_base} + {5'h00, zcmp_stack_adj_extra};
wire [31:0] zcmp_push_stack_adj_instr = `RVOPC_NOZ_ADDI | rfmt_rd(5'd2) | rfmt_rs1(5'd2) | {
-zcmp_abs_stack_adj,