prd(p_rd), prs1(p_rs1), prs2(p_rs2), prs3(p_rs3), psp(p_sp),
save_branch_addr(0) {}
+ uint8_t reg_elwidth(reg_t reg, bool intreg);
sv_reg_t rvc_addi4spn_imm() { return sv_reg_t(insn_t::rvc_addi4spn_imm()); }
sv_reg_t rvc_imm() { return sv_reg_t(insn_t::rvc_imm()); }
sv_reg_t rvc_zimm() { return sv_reg_t(insn_t::rvc_zimm()); }
}
*/
-sv_reg_t sv_proc_t::get_rs1()
-{
- return (_insn->p->get_state()->XPR[_insn->rs1()]);
-}
+#define GET_REG(name) \
+ sv_reg_t sv_proc_t::get_##name() \
+ { \
+ reg_t reg = _insn->name (); \
+ uint8_t elwidth = _insn->reg_elwidth(reg, true); \
+ uint64_t data = _insn->p->get_state()->XPR[reg]; \
+ return sv_reg_t(data, elwidth); \
+ }
+
+GET_REG(rs1)
+GET_REG(rs2)
+GET_REG(rs3)
+GET_REG(rvc_rs1s)
+GET_REG(rvc_rs2s)
+GET_REG(rvc_rs1)
+GET_REG(rvc_rs2)
-sv_reg_t sv_proc_t::get_rs2()
+freg_t sv_proc_t::get_frs1()
{
- return (_insn->p->get_state()->XPR[_insn->rs2()]);
+ return READ_FREG(_insn->rs1());
}
-sv_reg_t sv_proc_t::get_rvc_rs1s()
+freg_t sv_proc_t::get_frs2()
{
- fprintf(stderr, "get_rvc_rs1s %ld\n", _insn->rvc_rs1s());
- sv_reg_entry *r = _insn->get_regentry(_insn->_rvc_rs1s(), true);
- fprintf(stderr, "active %d vec %d map %ld\n",
- r->active, r->isvec, r->regidx);
-
- return (_insn->p->get_state()->XPR[_insn->rvc_rs1s()]);
+ return READ_FREG(_insn->rs2());
}
sv_reg_t sv_proc_t::get_shamt()
return sv_reg_t(_insn->i_imm() & 0x3F);
}
-sv_reg_t sv_proc_t::get_rvc_rs2s()
-{
- return (_insn->p->get_state()->XPR[_insn->rvc_rs2s()]);
-}
-
-sv_reg_t sv_proc_t::get_rvc_rs1()
-{
- return (_insn->p->get_state()->XPR[_insn->rvc_rs1()]);
-}
-
-sv_reg_t sv_proc_t::get_rvc_rs2()
-{
- return (_insn->p->get_state()->XPR[_insn->rvc_rs2()]);
-}
-
-sv_reg_t sv_proc_t::get_rs3()
-{
- return (_insn->p->get_state()->XPR[_insn->rs3()]);
-}
-
sv_reg_t sv_proc_t::get_rvc_sp()
{
return (_insn->p->get_state()->XPR[X_SP]);
return sv_reg_t(x);
}
-freg_t sv_proc_t::get_frs1()
-{
- return READ_FREG(_insn->rs1());
-}
-
-freg_t sv_proc_t::get_frs2()
-{
- return READ_FREG(_insn->rs2());
-}
-
/*
sv_reg_t sv_reg_t::make_sv_int64_t (int64_t v) const
{