override keyword to virtual methods

This commit is contained in:
Màrius Montón 2021-02-01 11:25:04 +01:00
parent b3b00ac7f3
commit cc9045341d
6 changed files with 33 additions and 29 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -83,6 +83,10 @@ public:
*/
void dump() const;
inline uint_fast64_t getInstructions() {
return instructions_executed;
}
private:
static Performance *instance;
Performance();

View File

@ -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;