From: Luke Kenneth Casson Leighton Date: Sat, 27 Oct 2018 07:19:54 +0000 (+0100) Subject: redirect freg through getter macro, to keep elwidth state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e168ec050d1e5df74df46a5c6a255e47d52c0099;p=riscv-isa-sim.git redirect freg through getter macro, to keep elwidth state --- diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index d94671e..893a488 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -168,6 +168,13 @@ sv_reg_t sv_proc_t::get_intreg(reg_spec_t const&spec) return sv_reg_t(data, xlen, bitwidth); } +sv_freg_t sv_proc_t::get_fpreg(reg_spec_t const&spec) +{ + freg_t data = READ_FREG(spec); + uint8_t bitwidth = _insn->src_bitwidth; + return sv_freg_t(data, xlen, bitwidth); +} + #define GET_REG(name) \ sv_reg_t sv_proc_t::get_##name() \ { \ @@ -188,31 +195,18 @@ sv_reg_t sv_proc_t::get_rvc_sp() return get_intreg({X_SP, _insn->get_sp_offs()}); } -sv_freg_t sv_proc_t::get_frs1() -{ - reg_spec_t spec = _insn->rs1(); - return READ_FREG(spec); -} - -sv_freg_t sv_proc_t::get_frs3() -{ - return READ_FREG(_insn->rs3()); -} - -sv_freg_t sv_proc_t::get_frs2() -{ - return READ_FREG(_insn->rs2()); -} - -sv_freg_t sv_proc_t::get_rvc_frs2s() -{ - return READ_FREG(_insn->rvc_rs2s()); -} +#define GET_FPREG(name, getter) \ + sv_freg_t sv_proc_t::get_##name() \ + { \ + reg_spec_t reg = _insn->getter (); \ + return get_fpreg(reg); \ + } -sv_freg_t sv_proc_t::get_rvc_frs2() -{ - return READ_FREG(_insn->rvc_rs2()); -} +GET_FPREG(frs1, rs1) +GET_FPREG(frs2, rs2) +GET_FPREG(frs3, rs3) +GET_FPREG(rvc_frs2, rvc_rs2) +GET_FPREG(rvc_frs2s, rvc_rs2s) sv_reg_t sv_proc_t::get_shamt() { diff --git a/riscv/sv_insn_redirect.h b/riscv/sv_insn_redirect.h index bbf62f3..159a10b 100644 --- a/riscv/sv_insn_redirect.h +++ b/riscv/sv_insn_redirect.h @@ -107,6 +107,7 @@ public: private: sv_reg_t get_intreg(reg_spec_t const®); + sv_freg_t get_fpreg(reg_spec_t const®); public: sv_reg_t get_rs1();