require_extension('C');
require_extension('D');
require_fp;
-WRITE_RVC_FRS2S(f64(MMU.load_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()))));
+WRITE_RVC_FRS2S(f64(MMU.load_uint64(insn.rvc_rs1s(), insn.rvc_ld_imm()))); //RVC_RS1S
if (xlen == 32) {
require_extension('F');
require_fp;
- WRITE_RVC_FRS2S(f32(MMU.load_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()))));
+ WRITE_RVC_FRS2S(f32(MMU.load_uint32(insn.rvc_rs1s(), insn.rvc_lw_imm()))); //RVC_RS1S
} else { // c.ld
- WRITE_RVC_RS2S(MMU.load_int64(rv_add(RVC_RS1S, insn.rvc_ld_imm())));
+ WRITE_RVC_RS2S(MMU.load_int64(insn.rvc_rs1s(), insn.rvc_ld_imm())); //RVC_RS1S
}
require_extension('C');
-WRITE_RVC_RS2S(MMU.load_int32(rv_add(RVC_RS1S, insn.rvc_lw_imm())));
+WRITE_RVC_RS2S(MMU.load_int32(insn.rvc_rs1s(), insn.rvc_lw_imm())); // RVC_RS1S
require_extension('D');
require_fp;
-WRITE_FRD(f64(MMU.load_uint64(rv_add(RS1, insn.i_imm()))));
+WRITE_FRD(f64(MMU.load_uint64(insn.rs1(), insn.i_imm()))); // RS1
require_extension('Q');
require_fp;
-WRITE_FRD(MMU.load_float128(rv_add(RS1, insn.i_imm())));
+WRITE_FRD(MMU.load_float128(rv_add(RS1, insn.i_imm()))); // XXX TODO: adjust to SV
require_extension('F');
require_fp;
-WRITE_FRD(f32(MMU.load_uint32(rv_add(RS1, insn.i_imm()))));
+WRITE_FRD(f32(MMU.load_uint32(insn.rs1(), insn.i_imm()))); // RS1
-WRITE_RD(MMU.load_int8(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_int8(insn.rs1(), insn.i_imm())); // RS1
-WRITE_RD(MMU.load_uint8(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_uint8(insn.rs1(), insn.i_imm())); // RS1
require_rv64;
-WRITE_RD(MMU.load_int64(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_int64(insn.rs1(), insn.i_imm())); // RS1
-WRITE_RD(MMU.load_int16(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_int16(insn.rs1(), insn.i_imm())); // RS1
-WRITE_RD(MMU.load_uint16(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_uint16(insn.rs1(), insn.i_imm())); // RS1
-WRITE_RD(MMU.load_int32(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_int32(insn.rs1(), insn.i_imm())); // RS1
require_rv64;
-WRITE_RD(MMU.load_uint32(rv_add(RS1, insn.i_imm())));
+WRITE_RD(MMU.load_uint32(insn.rs1(), insn.i_imm())); // RS1
#include "sv_mmu.h"
#define sv_load_func(type, ext) \
+sv_reg_t sv_mmu_t::load_##type(reg_spec_t const& spec, sv_reg_t const& offs) { \
+ reg_t reg = proc->s.READ_REG(spec); \
+ sv_reg_t addr = proc->s.rv_add(reg, offs); \
+ type##_t v = mmu_t::load_##type(addr); \
+ return proc->s.adjust_load(sv_reg_t(v), sizeof(type##_t), ext); \
+} \
sv_reg_t sv_mmu_t::load_##type(reg_t const& addr) { \
type##_t v = mmu_t::load_##type(addr); \
return proc->s.adjust_load(sv_reg_t(v), sizeof(type##_t), ext); \
sv_mmu_t(simif_t* sim, processor_t* proc) : mmu_t(sim, proc) {}
#define sv_load_func_decl(type) \
+ sv_reg_t load_##type(reg_spec_t const& reg, sv_reg_t const& offs); \
sv_reg_t load_##type(reg_t const& addr);
// load value from memory at aligned address; zero extend to register width