require_extension('C');
require_extension('D');
require_fp;
-MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), RVC_FRS2S.v[0]);
+MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), ((freg_t)RVC_FRS2S).v[0]);
require_extension('C');
require_extension('D');
require_fp;
-MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), RVC_FRS2.v[0]);
+MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), ((freg_t)RVC_FRS2).v[0]);
if (xlen == 32) {
require_extension('F');
require_fp;
- MMU.store_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()), RVC_FRS2S.v[0]);
+ MMU.store_uint32(rv_add(RVC_RS1S, insn.rvc_lw_imm()), ((freg_t)RVC_FRS2S).v[0]);
} else { // c.sd
MMU.store_uint64(rv_add(RVC_RS1S, insn.rvc_ld_imm()), RVC_RS2S);
}
if (xlen == 32) {
require_extension('F');
require_fp;
- MMU.store_uint32(rv_add(RVC_SP, insn.rvc_swsp_imm()), RVC_FRS2.v[0]);
+ MMU.store_uint32(rv_add(RVC_SP, insn.rvc_swsp_imm()), ((freg_t)RVC_FRS2).v[0]);
} else { // c.sdsp
MMU.store_uint64(rv_add(RVC_SP, insn.rvc_sdsp_imm()), RVC_RS2);
}
require_extension('D');
require_rv64;
require_fp;
-WRITE_RD(FRS1.v[0]);
+WRITE_RD(((freg_t)FRS1).v[0]);
require_extension('F');
require_fp;
-WRITE_RD(sext32(sv_reg_t(FRS1.v[0])));
+WRITE_RD(sext32(sv_reg_t(((freg_t)FRS1).v[0])));
require_extension('D');
require_fp;
-MMU.store_uint64(rv_add(RS1, insn.s_imm()), FRS2.v[0]);
+MMU.store_uint64(rv_add(RS1, insn.s_imm()), ((freg_t)FRS2).v[0]);
require_extension('F');
require_fp;
-MMU.store_uint32(rv_add(RS1, insn.s_imm()), FRS2.v[0]);
+MMU.store_uint32(rv_add(RS1, insn.s_imm()), ((freg_t)FRS2).v[0]);
void (sv_proc_t::WRITE_FRD)(sv_freg_t value)
{
- fprintf(stderr, "WRITE_FRD fsv_reg_t %lx\n", value.v[0]);
+ fprintf(stderr, "WRITE_FRD fsv_reg_t %lx\n", ((freg_t)value).v[0]);
DO_WRITE_FREG( _insn->rd(), freg(value) );
}
typedef float32_t sv_float32_t;
typedef float64_t sv_float64_t;
typedef float128_t sv_float128_t;
-typedef freg_t sv_freg_t;
+//typedef freg_t sv_freg_t;
class sv_proc_t
{
inline sv_reg_t::operator sv_sreg_t() const &
{ return sv_sreg_t((int64_t)reg, elwidth); }
+class sv_freg_t : public sv_regbase_t {
+public:
+ sv_freg_t(freg_t _reg) : sv_regbase_t(), reg(_reg) { } // default elwidth
+ sv_freg_t(freg_t _reg, uint8_t _elwidth) :
+ sv_regbase_t(_elwidth), reg(_reg)
+ {}
+ sv_freg_t(freg_t _reg, int xlen, uint8_t _elwidth) :
+ sv_regbase_t(xlen, _elwidth), reg(_reg)
+ {}
+
+ freg_t reg;
+public:
+
+ operator freg_t() const& { return reg; }
+};
+
#endif