From 9ae33e3766ea2e53ec12a092b717c37e7ed06c07 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 14 Oct 2018 06:41:04 +0100 Subject: [PATCH] rv_xxx convert c_xxx --- riscv/insns/c_add.h | 2 +- riscv/insns/c_addi.h | 2 +- riscv/insns/c_addi4spn.h | 2 +- riscv/insns/c_addw.h | 2 +- riscv/insns/c_and.h | 2 +- riscv/insns/c_andi.h | 2 +- riscv/insns/c_beqz.h | 4 ++-- riscv/insns/c_bnez.h | 4 ++-- riscv/insns/c_fld.h | 2 +- riscv/insns/c_fldsp.h | 2 +- riscv/insns/c_flw.h | 4 ++-- riscv/insns/c_flwsp.h | 4 ++-- riscv/insns/c_fsd.h | 2 +- riscv/insns/c_fsdsp.h | 2 +- riscv/insns/c_fsw.h | 4 ++-- riscv/insns/c_fswsp.h | 4 ++-- riscv/insns/c_lw.h | 2 +- riscv/insns/c_lwsp.h | 2 +- riscv/insns/c_or.h | 2 +- riscv/insns/c_slli.h | 2 +- riscv/insns/c_srai.h | 2 +- riscv/insns/c_srli.h | 2 +- riscv/insns/c_sub.h | 2 +- riscv/insns/c_subw.h | 2 +- riscv/insns/c_sw.h | 2 +- riscv/insns/c_swsp.h | 2 +- riscv/insns/c_xor.h | 2 +- 27 files changed, 33 insertions(+), 33 deletions(-) diff --git a/riscv/insns/c_add.h b/riscv/insns/c_add.h index ab7d4d4..d9ecc32 100644 --- a/riscv/insns/c_add.h +++ b/riscv/insns/c_add.h @@ -1,3 +1,3 @@ require_extension('C'); require(insn.rvc_rs2() != 0); -WRITE_RD(sext_xlen(RVC_RS1 + RVC_RS2)); +WRITE_RD(sext_xlen(rv_add(RVC_RS1, RVC_RS2))); diff --git a/riscv/insns/c_addi.h b/riscv/insns/c_addi.h index eb98344..172475f 100644 --- a/riscv/insns/c_addi.h +++ b/riscv/insns/c_addi.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RD(sext_xlen(RVC_RS1 + insn.rvc_imm())); +WRITE_RD(sext_xlen(rv_add(RVC_RS1, insn.rvc_imm()))); diff --git a/riscv/insns/c_addi4spn.h b/riscv/insns/c_addi4spn.h index e5f3832..c4ff389 100644 --- a/riscv/insns/c_addi4spn.h +++ b/riscv/insns/c_addi4spn.h @@ -1,3 +1,3 @@ require_extension('C'); require(insn.rvc_addi4spn_imm() != 0); -WRITE_RVC_RS2S(sext_xlen(RVC_SP + insn.rvc_addi4spn_imm())); +WRITE_RVC_RS2S(sext_xlen(rv_add(RVC_SP, insn.rvc_addi4spn_imm()))); diff --git a/riscv/insns/c_addw.h b/riscv/insns/c_addw.h index 6e0ae3a..c05b5bd 100644 --- a/riscv/insns/c_addw.h +++ b/riscv/insns/c_addw.h @@ -1,3 +1,3 @@ require_extension('C'); require_rv64; -WRITE_RVC_RS1S(sext32(RVC_RS1S + RVC_RS2S)); +WRITE_RVC_RS1S(sext32(rv_add(RVC_RS1S, RVC_RS2S))); diff --git a/riscv/insns/c_and.h b/riscv/insns/c_and.h index 4d7bab6..aefdd03 100644 --- a/riscv/insns/c_and.h +++ b/riscv/insns/c_and.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RVC_RS1S(RVC_RS1S & RVC_RS2S); +WRITE_RVC_RS1S(rv_and(RVC_RS1S, RVC_RS2S)); diff --git a/riscv/insns/c_andi.h b/riscv/insns/c_andi.h index 9de5a1a..73fe0a2 100644 --- a/riscv/insns/c_andi.h +++ b/riscv/insns/c_andi.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RVC_RS1S(RVC_RS1S & insn.rvc_imm()); +WRITE_RVC_RS1S(rv_and(RVC_RS1S, insn.rvc_imm())); diff --git a/riscv/insns/c_beqz.h b/riscv/insns/c_beqz.h index 35c1196..01bec6c 100644 --- a/riscv/insns/c_beqz.h +++ b/riscv/insns/c_beqz.h @@ -1,3 +1,3 @@ require_extension('C'); -if (RVC_RS1S == 0) - set_pc(pc + insn.rvc_b_imm()); +if (rv_eq(RVC_RS1S, 0)) + set_pc(rv_add(pc, insn.rvc_b_imm())); diff --git a/riscv/insns/c_bnez.h b/riscv/insns/c_bnez.h index 1e40ea7..300de43 100644 --- a/riscv/insns/c_bnez.h +++ b/riscv/insns/c_bnez.h @@ -1,3 +1,3 @@ require_extension('C'); -if (RVC_RS1S != 0) - set_pc(pc + insn.rvc_b_imm()); +if (rv_ne(RVC_RS1S, 0)) + set_pc(rv_add(pc, insn.rvc_b_imm())); diff --git a/riscv/insns/c_fld.h b/riscv/insns/c_fld.h index 319615b..273e8c1 100644 --- a/riscv/insns/c_fld.h +++ b/riscv/insns/c_fld.h @@ -1,4 +1,4 @@ require_extension('C'); require_extension('D'); require_fp; -WRITE_RVC_FRS2S(f64(MMU.load_uint64(RVC_RS1S + insn.rvc_ld_imm()))); +WRITE_RVC_FRS2S(f64(MMU.load_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm())))); diff --git a/riscv/insns/c_fldsp.h b/riscv/insns/c_fldsp.h index 534eef7..7d55980 100644 --- a/riscv/insns/c_fldsp.h +++ b/riscv/insns/c_fldsp.h @@ -1,4 +1,4 @@ require_extension('C'); require_extension('D'); require_fp; -WRITE_FRD(f64(MMU.load_uint64(RVC_SP + insn.rvc_ldsp_imm()))); +WRITE_FRD(f64(MMU.load_uint64(rv_add(RVC_SP, insn.rvc_ldsp_imm())))); diff --git a/riscv/insns/c_flw.h b/riscv/insns/c_flw.h index 682566c..efe1c86 100644 --- a/riscv/insns/c_flw.h +++ b/riscv/insns/c_flw.h @@ -2,7 +2,7 @@ require_extension('C'); if (xlen == 32) { require_extension('F'); require_fp; - WRITE_RVC_FRS2S(f32(MMU.load_uint32(RVC_RS1S + insn.rvc_lw_imm()))); + WRITE_RVC_FRS2S(f32(MMU.load_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm())))); } else { // c.ld - WRITE_RVC_RS2S(MMU.load_int64(RVC_RS1S + insn.rvc_ld_imm())); + WRITE_RVC_RS2S(MMU.load_int64(rv_add(RVC_RS1S, insn.rvc_ld_imm()))); } diff --git a/riscv/insns/c_flwsp.h b/riscv/insns/c_flwsp.h index 79058c4..22222d2 100644 --- a/riscv/insns/c_flwsp.h +++ b/riscv/insns/c_flwsp.h @@ -2,8 +2,8 @@ require_extension('C'); if (xlen == 32) { require_extension('F'); require_fp; - WRITE_FRD(f32(MMU.load_uint32(RVC_SP + insn.rvc_lwsp_imm()))); + WRITE_FRD(f32(MMU.load_uint32(rv_add(RVC_SP, insn.rvc_lwsp_imm())))); } else { // c.ldsp require(insn.rvc_rd() != 0); - WRITE_RD(MMU.load_int64(RVC_SP + insn.rvc_ldsp_imm())); + WRITE_RD(MMU.load_int64(rv_add(RVC_SP, insn.rvc_ldsp_imm()))); } diff --git a/riscv/insns/c_fsd.h b/riscv/insns/c_fsd.h index 6f2c8f4..3b8e040 100644 --- a/riscv/insns/c_fsd.h +++ b/riscv/insns/c_fsd.h @@ -1,4 +1,4 @@ require_extension('C'); require_extension('D'); require_fp; -MMU.store_uint64(RVC_RS1S + insn.rvc_ld_imm(), RVC_FRS2S.v[0]); +MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), RVC_FRS2S.v[0]); diff --git a/riscv/insns/c_fsdsp.h b/riscv/insns/c_fsdsp.h index 27b9331..1a4d50c 100644 --- a/riscv/insns/c_fsdsp.h +++ b/riscv/insns/c_fsdsp.h @@ -1,4 +1,4 @@ require_extension('C'); require_extension('D'); require_fp; -MMU.store_uint64(RVC_SP + insn.rvc_sdsp_imm(), RVC_FRS2.v[0]); +MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), RVC_FRS2.v[0]); diff --git a/riscv/insns/c_fsw.h b/riscv/insns/c_fsw.h index 7085822..e400d72 100644 --- a/riscv/insns/c_fsw.h +++ b/riscv/insns/c_fsw.h @@ -2,7 +2,7 @@ require_extension('C'); if (xlen == 32) { require_extension('F'); require_fp; - MMU.store_uint32(RVC_RS1S + insn.rvc_lw_imm(), RVC_FRS2S.v[0]); + MMU.store_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()), RVC_FRS2S.v[0]); } else { // c.sd - MMU.store_uint64(RVC_RS1S + insn.rvc_ld_imm(), RVC_RS2S); + MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), RVC_RS2S); } diff --git a/riscv/insns/c_fswsp.h b/riscv/insns/c_fswsp.h index c5a003f..cbf9264 100644 --- a/riscv/insns/c_fswsp.h +++ b/riscv/insns/c_fswsp.h @@ -2,7 +2,7 @@ require_extension('C'); if (xlen == 32) { require_extension('F'); require_fp; - MMU.store_uint32(RVC_SP + insn.rvc_swsp_imm(), RVC_FRS2.v[0]); + MMU.store_uint32(rv_add(RVC_SP, insn.rvc_swsp_imm()), RVC_FRS2.v[0]); } else { // c.sdsp - MMU.store_uint64(RVC_SP + insn.rvc_sdsp_imm(), RVC_RS2); + MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), RVC_RS2); } diff --git a/riscv/insns/c_lw.h b/riscv/insns/c_lw.h index ef49dd9..d08bab5 100644 --- a/riscv/insns/c_lw.h +++ b/riscv/insns/c_lw.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RVC_RS2S(MMU.load_int32(RVC_RS1S + insn.rvc_lw_imm())); +WRITE_RVC_RS2S(MMU.load_int32(rv_add(RVC_RS1S, insn.rvc_lw_imm()))); diff --git a/riscv/insns/c_lwsp.h b/riscv/insns/c_lwsp.h index b3d74db..b0f2549 100644 --- a/riscv/insns/c_lwsp.h +++ b/riscv/insns/c_lwsp.h @@ -1,3 +1,3 @@ require_extension('C'); require(insn.rvc_rd() != 0); -WRITE_RD(MMU.load_int32(RVC_SP + insn.rvc_lwsp_imm())); +WRITE_RD(MMU.load_int32(rv_add(RVC_SP, insn.rvc_lwsp_imm()))); diff --git a/riscv/insns/c_or.h b/riscv/insns/c_or.h index 56436d1..7a888a1 100644 --- a/riscv/insns/c_or.h +++ b/riscv/insns/c_or.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RVC_RS1S(RVC_RS1S | RVC_RS2S); +WRITE_RVC_RS1S(rv_or(RVC_RS1S, RVC_RS2S)); diff --git a/riscv/insns/c_slli.h b/riscv/insns/c_slli.h index 24fbb13..91fff82 100644 --- a/riscv/insns/c_slli.h +++ b/riscv/insns/c_slli.h @@ -1,3 +1,3 @@ require_extension('C'); require(insn.rvc_zimm() < xlen); -WRITE_RD(sext_xlen(RVC_RS1 << insn.rvc_zimm())); +WRITE_RD(sext_xlen(rv_sl(RVC_RS1, insn.rvc_zimm()))); diff --git a/riscv/insns/c_srai.h b/riscv/insns/c_srai.h index f6638b1..171375d 100644 --- a/riscv/insns/c_srai.h +++ b/riscv/insns/c_srai.h @@ -1,3 +1,3 @@ require_extension('C'); require(insn.rvc_zimm() < xlen); -WRITE_RVC_RS1S(sext_xlen(sext_xlen(RVC_RS1S) >> insn.rvc_zimm())); +WRITE_RVC_RS1S(sext_xlen(rv_sr(sext_xlen(RVC_RS1S), insn.rvc_zimm()))); diff --git a/riscv/insns/c_srli.h b/riscv/insns/c_srli.h index f410fef..904dbf1 100644 --- a/riscv/insns/c_srli.h +++ b/riscv/insns/c_srli.h @@ -1,3 +1,3 @@ require_extension('C'); require(insn.rvc_zimm() < xlen); -WRITE_RVC_RS1S(sext_xlen(zext_xlen(RVC_RS1S) >> insn.rvc_zimm())); +WRITE_RVC_RS1S(sext_xlen(rv_sr(zext_xlen(RVC_RS1S), insn.rvc_zimm()))); diff --git a/riscv/insns/c_sub.h b/riscv/insns/c_sub.h index 1b8e373..e6ed2af 100644 --- a/riscv/insns/c_sub.h +++ b/riscv/insns/c_sub.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RVC_RS1S(sext_xlen(RVC_RS1S - RVC_RS2S)); +WRITE_RVC_RS1S(sext_xlen(rv_sub(RVC_RS1S, RVC_RS2S))); diff --git a/riscv/insns/c_subw.h b/riscv/insns/c_subw.h index 580f5b5..e777ae2 100644 --- a/riscv/insns/c_subw.h +++ b/riscv/insns/c_subw.h @@ -1,3 +1,3 @@ require_extension('C'); require_rv64; -WRITE_RVC_RS1S(sext32(RVC_RS1S - RVC_RS2S)); +WRITE_RVC_RS1S(sext32(rv_sub(RVC_RS1S, RVC_RS2S))); diff --git a/riscv/insns/c_sw.h b/riscv/insns/c_sw.h index 3073e9d..098b4b4 100644 --- a/riscv/insns/c_sw.h +++ b/riscv/insns/c_sw.h @@ -1,2 +1,2 @@ require_extension('C'); -MMU.store_uint32(RVC_RS1S + insn.rvc_lw_imm(), RVC_RS2S); +MMU.store_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()), RVC_RS2S); diff --git a/riscv/insns/c_swsp.h b/riscv/insns/c_swsp.h index b8995ab..57b1735 100644 --- a/riscv/insns/c_swsp.h +++ b/riscv/insns/c_swsp.h @@ -1,2 +1,2 @@ require_extension('C'); -MMU.store_uint32(RVC_SP + insn.rvc_swsp_imm(), RVC_RS2); +MMU.store_uint32(rv_add(RVC_SP, insn.rvc_swsp_imm()), RVC_RS2); diff --git a/riscv/insns/c_xor.h b/riscv/insns/c_xor.h index 9981c1a..6039f87 100644 --- a/riscv/insns/c_xor.h +++ b/riscv/insns/c_xor.h @@ -1,2 +1,2 @@ require_extension('C'); -WRITE_RVC_RS1S(RVC_RS1S ^ RVC_RS2S); +WRITE_RVC_RS1S(rv_xor(RVC_RS1S, RVC_RS2S)); -- 2.30.2