From 22b7ec4c03ddf56e36c375d5cb5be97bdd4bb690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A0rius=20Mont=C3=B3n?= Date: Mon, 1 Feb 2021 11:49:38 +0100 Subject: [PATCH] remove duplicated methods --- inc/A_extension.h | 11 ----------- inc/BASE_ISA.h | 16 ---------------- inc/C_extension.h | 12 ------------ inc/M_extension.h | 12 ------------ inc/extension_base.h | 8 ++++++-- 5 files changed, 6 insertions(+), 53 deletions(-) diff --git a/inc/A_extension.h b/inc/A_extension.h index 39fcb64..6fab905 100644 --- a/inc/A_extension.h +++ b/inc/A_extension.h @@ -67,17 +67,6 @@ public: return m_instr.range(31, 27); } - /** - * @brief Access to rd field - * @return rd field - */ - inline int32_t get_rd() const override { - return m_instr.range(11, 7); - } - - inline void set_rd(int32_t value) override { - m_instr.range(11, 7) = value; - } /** * @brief Access to rs1 field diff --git a/inc/BASE_ISA.h b/inc/BASE_ISA.h index 94b211e..06527ad 100644 --- a/inc/BASE_ISA.h +++ b/inc/BASE_ISA.h @@ -100,22 +100,6 @@ public: */ using extension_base::extension_base; - /** - * @brief Access to rd field - * @return rd field - */ - inline int32_t get_rd() const override { - return m_instr.range(11, 7); - } - - /** - * @brief Sets rd field - * @param value desired rd value - */ - inline void set_rd(int32_t value) override { - m_instr.range(11, 7) = value; - } - /** * @brief Access to rs1 field * @return rs1 field diff --git a/inc/C_extension.h b/inc/C_extension.h index 6bb634c..48e9804 100644 --- a/inc/C_extension.h +++ b/inc/C_extension.h @@ -109,18 +109,6 @@ public: return m_instr.range(1, 0); } - /** - * @brief Access to rd field - * @return rd field - */ - inline int32_t get_rd () const override { - return m_instr.range(11, 7); - } - - inline void set_rd(int32_t value) override { - m_instr.range(11, 7) = value; - } - inline int32_t get_rdp() const { return m_instr.range(4, 2) + 8; } diff --git a/inc/M_extension.h b/inc/M_extension.h index cb4aa1a..d030c94 100644 --- a/inc/M_extension.h +++ b/inc/M_extension.h @@ -81,18 +81,6 @@ private: return m_instr.range(14, 12); } - /** - * @brief Access to rd field - * @return rd field - */ - inline int32_t get_rd() const { - return m_instr.range(11, 7); - } - - inline void set_rd(int32_t value) { - m_instr.range(11, 7) = value; - } - /** * @brief Access to rs1 field * @return rs1 field diff --git a/inc/extension_base.h b/inc/extension_base.h index 601749a..2a9a085 100644 --- a/inc/extension_base.h +++ b/inc/extension_base.h @@ -36,8 +36,12 @@ public: /* pure virtual functions */ virtual int32_t opcode() const = 0; - virtual int32_t get_rd() const = 0; - virtual void set_rd(int32_t value) = 0; + virtual int32_t get_rd() const { + return m_instr.range(11, 7); + } + virtual void set_rd(int32_t value) { + m_instr.range(11, 7) = value; + } virtual int32_t get_rs1() const = 0; virtual void set_rs1(int32_t value) = 0; virtual int32_t get_rs2() const = 0;