diff --git a/inc/A_extension.h b/inc/A_extension.h index d83abaa..39fcb64 100644 --- a/inc/A_extension.h +++ b/inc/A_extension.h @@ -63,7 +63,7 @@ public: * @brief Access to opcode field * @return return opcode field */ - inline int32_t opcode() const { + inline int32_t opcode() const override { return m_instr.range(31, 27); } @@ -71,11 +71,11 @@ public: * @brief Access to rd field * @return rd field */ - inline int32_t get_rd() const { + inline int32_t get_rd() const override { return m_instr.range(11, 7); } - inline void set_rd(int32_t value) { + inline void set_rd(int32_t value) override { m_instr.range(11, 7) = value; } @@ -83,11 +83,11 @@ public: * @brief Access to rs1 field * @return rs1 field */ - inline int32_t get_rs1() const { + inline int32_t get_rs1() const override { return m_instr.range(19, 15); } - inline void set_rs1(int32_t value) { + inline void set_rs1(int32_t value) override { m_instr.range(19, 15) = value; } @@ -95,19 +95,19 @@ public: * @brief Access to rs2 field * @return rs2 field */ - inline int32_t get_rs2() const { + inline int32_t get_rs2() const override { return m_instr.range(24, 20); } - inline void set_rs2(int32_t value) { + inline void set_rs2(int32_t value) override { m_instr.range(24, 20) = value; } - inline int32_t get_funct3() const { + inline int32_t get_funct3() const override { return m_instr.range(14, 12); } - inline void set_funct3(int32_t value) { + inline void set_funct3(int32_t value) override { m_instr.range(14, 12) = value; } @@ -117,7 +117,7 @@ public: */ op_A_Codes decode() const; - inline void dump() const{ + inline void dump() const override { std::cout << std::hex << "0x" << m_instr << std::dec << std::endl; } diff --git a/inc/BASE_ISA.h b/inc/BASE_ISA.h index a3cdb87..94b211e 100644 --- a/inc/BASE_ISA.h +++ b/inc/BASE_ISA.h @@ -104,7 +104,7 @@ public: * @brief Access to rd field * @return rd field */ - inline int32_t get_rd() const { + inline int32_t get_rd() const override { return m_instr.range(11, 7); } @@ -112,7 +112,7 @@ public: * @brief Sets rd field * @param value desired rd value */ - inline void set_rd(int32_t value) { + inline void set_rd(int32_t value) override { m_instr.range(11, 7) = value; } @@ -120,7 +120,7 @@ public: * @brief Access to rs1 field * @return rs1 field */ - inline int32_t get_rs1() const { + inline int32_t get_rs1() const override { return m_instr.range(19, 15); } @@ -128,7 +128,7 @@ public: * @brief Sets rs1 field * @param value desired rs1 value */ - inline void set_rs1(int32_t value) { + inline void set_rs1(int32_t value) override { m_instr.range(19, 15) = value; } @@ -136,7 +136,7 @@ public: * @brief Access to rs2 field * @return rs2 field */ - inline int32_t get_rs2() const { + inline int32_t get_rs2() const override { return m_instr.range(24, 20); } @@ -144,7 +144,7 @@ public: * @brief Sets rs2 field * @param value desired rs2 value */ - inline void set_rs2(int32_t value) { + inline void set_rs2(int32_t value) override { m_instr.range(24, 10) = value; } @@ -152,7 +152,7 @@ public: * @brief Access to funct3 field * @return funct3 field */ - inline int32_t get_funct3() const { + inline int32_t get_funct3() const override { return m_instr.range(14, 12); } @@ -160,7 +160,7 @@ public: * @brief Sets func3 field * @param value desired func3 value */ - inline void set_funct3(int32_t value) { + inline void set_funct3(int32_t value) override { m_instr.range(14, 12) = value; } @@ -338,7 +338,7 @@ public: * @brief Access to opcode field * @return return opcode field */ - inline int32_t opcode() const { + inline int32_t opcode() const override { return m_instr.range(6, 0); } diff --git a/inc/C_extension.h b/inc/C_extension.h index 12f123f..6bb634c 100644 --- a/inc/C_extension.h +++ b/inc/C_extension.h @@ -113,11 +113,11 @@ public: * @brief Access to rd field * @return rd field */ - inline int32_t get_rd () const { + inline int32_t get_rd () const override { return m_instr.range(11, 7); } - inline void set_rd(int32_t value) { + inline void set_rd(int32_t value) override { m_instr.range(11, 7) = value; } @@ -129,11 +129,11 @@ public: * @brief Access to rs1 field * @return rs1 field */ - inline int32_t get_rs1() const { + inline int32_t get_rs1() const override { return m_instr.range(11, 7); } - inline void set_rs1(int32_t value) { + inline void set_rs1(int32_t value) override { m_instr.range(11, 7) = value; } @@ -145,11 +145,11 @@ public: * @brief Access to rs2 field * @return rs2 field */ - inline int32_t get_rs2() const { + inline int32_t get_rs2() const override { return m_instr.range(6, 2); } - inline void set_rs2(int32_t value) { + inline void set_rs2(int32_t value) override { m_instr.range(6, 2) = value; } @@ -157,11 +157,11 @@ public: return m_instr.range(4, 2) + 8; } - inline int32_t get_funct3() const { + inline int32_t get_funct3() const override { return m_instr.range(15, 13); } - inline void set_funct3(int32_t value) { + inline void set_funct3(int32_t value) override { m_instr.range(15, 13) = value; } diff --git a/inc/M_extension.h b/inc/M_extension.h index 541f7dd..cb4aa1a 100644 --- a/inc/M_extension.h +++ b/inc/M_extension.h @@ -56,7 +56,7 @@ public: */ op_M_Codes decode() const; - inline void dump() const{ + inline virtual void dump() const override { std::cout << std::hex << "0x" << m_instr << std::dec << std::endl; } diff --git a/inc/Performance.h b/inc/Performance.h index d67fa08..98af282 100644 --- a/inc/Performance.h +++ b/inc/Performance.h @@ -83,6 +83,10 @@ public: */ void dump() const; + inline uint_fast64_t getInstructions() { + return instructions_executed; + } + private: static Performance *instance; Performance(); diff --git a/inc/extension_base.h b/inc/extension_base.h index 984b39d..601749a 100644 --- a/inc/extension_base.h +++ b/inc/extension_base.h @@ -45,7 +45,7 @@ public: virtual int32_t get_funct3() const = 0; virtual void set_funct3(int32_t value) = 0; - void dump(); + virtual void dump() const; protected: sc_dt::sc_uint<32> m_instr;