Fix push/pop frame format, fix source regnums for mvsa01/mva01s

This commit is contained in:
Luke Wren 2023-03-20 02:35:18 +00:00
parent 7702c44288
commit 3b2ddee06b
4 changed files with 15 additions and 17 deletions

View File

@ -562,8 +562,8 @@ wire [4:0] zcmp_pushpop_rs1 =
uop_ctr == 4'he ? 5'd02 : // sp (stack adj) uop_ctr == 4'he ? 5'd02 : // sp (stack adj)
5'd01 ; // ra (ret) 5'd01 ; // ra (ret)
wire [4:0] zcmp_sa01_r1s = {|next_instr[9:8], ~&next_instr[9:8], next_instr[9:7]}; 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_sa01_r2s = {|next_instr[2:1], ~|next_instr[2:1], next_instr[2:0]};
wire [4:0] zcmp_mvsa01_rs1 = {4'h5, 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; wire [4:0] zcmp_mva01s_rs1 = uop_ctr[0] ? zcmp_sa01_r2s : zcmp_sa01_r1s;

View File

@ -124,16 +124,16 @@ assign df_uop_step_next = uop_ctr_nxt;
wire [3:0] zcmp_rlist = instr_in[7:4]; wire [3:0] zcmp_rlist = instr_in[7:4];
wire [3:0] zcmp_n_regs = zcmp_rlist == 4'hf ? 4'hd : zcmp_rlist - 4'h3; wire [3:0] zcmp_n_regs = zcmp_rlist == 4'hf ? 4'hd : zcmp_rlist - 4'h3;
wire [6:0] zcmp_stack_adj_base = wire [11:0] zcmp_stack_adj_base =
zcmp_rlist[3] == 1'b0 ? 7'h10 : zcmp_rlist[3] == 1'b0 ? 12'h010 :
zcmp_rlist[3:2] == 2'h2 ? 7'h20 : zcmp_rlist[3:2] == 2'h2 ? 12'h020 :
zcmp_rlist[3:0] == 4'hf ? 7'h40 : 7'h30; zcmp_rlist[3:0] == 4'hf ? 12'h040 : 12'h030;
wire [6:0] zcmp_stack_adj_extra = {1'b0, instr_in[3:2], 4'h0}; wire [11:0] zcmp_stack_adj = zcmp_stack_adj_base + {6'h00, instr_in[3:2], 4'h0};
// Note we perform all load/stores before moving the stack pointer. // 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_lw_offset = -{6'h00, {uop_ctr + 4'h1}, 2'h0} + zcmp_stack_adj;
wire [11:0] zcmp_stack_sw_offset = {6'h00, uop_ctr, 2'h0} - {5'h00, zcmp_stack_adj_base}; wire [11:0] zcmp_stack_sw_offset = -{6'h00, {uop_ctr + 4'h1}, 2'h0};
wire [4:0] zcmp_ls_reg = wire [4:0] zcmp_ls_reg =
uop_ctr == 4'h0 ? 5'd01 : // ra uop_ctr == 4'h0 ? 5'd01 : // ra
@ -149,20 +149,18 @@ 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 zcmp_stack_lw_offset[11:0], 20'h00000
}; };
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) | { wire [31:0] zcmp_push_stack_adj_instr = `RVOPC_NOZ_ADDI | rfmt_rd(5'd2) | rfmt_rs1(5'd2) | {
-zcmp_abs_stack_adj, -zcmp_stack_adj,
20'h00000 20'h00000
}; };
wire [31:0] zcmp_pop_stack_adj_instr = `RVOPC_NOZ_ADDI | rfmt_rd(5'd2) | rfmt_rs1(5'd2) | { wire [31:0] zcmp_pop_stack_adj_instr = `RVOPC_NOZ_ADDI | rfmt_rd(5'd2) | rfmt_rs1(5'd2) | {
zcmp_abs_stack_adj, zcmp_stack_adj,
20'h00000 20'h00000
}; };
wire zcmp_sa01_r1s = {|instr_in[9:8], ~&instr_in[9:8], instr_in[9:7]}; wire [4:0] zcmp_sa01_r1s = {|instr_in[9:8], ~|instr_in[9:8], instr_in[9:7]};
wire zcmp_sa01_r2s = {|instr_in[2:1], ~&instr_in[2:1], instr_in[2:0]}; wire [4:0] zcmp_sa01_r2s = {|instr_in[2:1], ~|instr_in[2:1], instr_in[2:0]};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
APP := hellow APP := hellow
SRCS = ../common/init.S $(APP).c $(EXTRA_SRCS_$(APP)) SRCS = ../common/init.S $(APP).c $(EXTRA_SRCS_$(APP))
CCFLAGS := -march=rv32imac_zicsr_zba_zbb_zbs_zcb -Os CCFLAGS := -march=rv32ima_zicsr_zba_zbb_zbs_zca_zcb_zcmp -Os
MAX_CYCLES := 1000000 MAX_CYCLES := 1000000
INCDIR := include ../common INCDIR := include ../common

View File

@ -2,7 +2,7 @@
[*] GTKWave Analyzer v3.3.103 (w)1999-2019 BSI [*] GTKWave Analyzer v3.3.103 (w)1999-2019 BSI
[*] Sat May 22 07:37:18 2021 [*] Sat May 22 07:37:18 2021
[*] [*]
[dumpfile] "tmp/ecall_simple_run.vcd" [dumpfile] "tmp/ecall_simple.vcd"
[dumpfile_mtime] "Sat May 22 07:33:26 2021" [dumpfile_mtime] "Sat May 22 07:33:26 2021"
[dumpfile_size] 1269546 [dumpfile_size] 1269546
[timestart] 314 [timestart] 314