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)));
require_extension('C');
-WRITE_RD(sext_xlen(RVC_RS1 + insn.rvc_imm()));
+WRITE_RD(sext_xlen(rv_add(RVC_RS1, insn.rvc_imm())));
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())));
require_extension('C');
require_rv64;
-WRITE_RVC_RS1S(sext32(RVC_RS1S + RVC_RS2S));
+WRITE_RVC_RS1S(sext32(rv_add(RVC_RS1S, RVC_RS2S)));
require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S & RVC_RS2S);
+WRITE_RVC_RS1S(rv_and(RVC_RS1S, RVC_RS2S));
require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S & insn.rvc_imm());
+WRITE_RVC_RS1S(rv_and(RVC_RS1S, insn.rvc_imm()));
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()));
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()));
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()))));
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()))));
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())));
}
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())));
}
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]);
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]);
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);
}
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);
}
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())));
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())));
require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S | RVC_RS2S);
+WRITE_RVC_RS1S(rv_or(RVC_RS1S, RVC_RS2S));
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())));
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())));
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())));
require_extension('C');
-WRITE_RVC_RS1S(sext_xlen(RVC_RS1S - RVC_RS2S));
+WRITE_RVC_RS1S(sext_xlen(rv_sub(RVC_RS1S, RVC_RS2S)));
require_extension('C');
require_rv64;
-WRITE_RVC_RS1S(sext32(RVC_RS1S - RVC_RS2S));
+WRITE_RVC_RS1S(sext32(rv_sub(RVC_RS1S, RVC_RS2S)));
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);
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);
require_extension('C');
-WRITE_RVC_RS1S(RVC_RS1S ^ RVC_RS2S);
+WRITE_RVC_RS1S(rv_xor(RVC_RS1S, RVC_RS2S));