removed duplicate code
This commit is contained in:
		
							parent
							
								
									22b7ec4c03
								
							
						
					
					
						commit
						03c95d2de3
					
				|  | @ -67,39 +67,6 @@ public: | |||
| 		return m_instr.range(31, 27); | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to rs1 field | ||||
| 	 * @return rs1 field | ||||
| 	 */ | ||||
| 	inline int32_t get_rs1() const override { | ||||
| 		return m_instr.range(19, 15); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void set_rs1(int32_t value) override { | ||||
| 		m_instr.range(19, 15) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to rs2 field | ||||
| 	 * @return rs2 field | ||||
| 	 */ | ||||
| 	inline int32_t get_rs2() const override { | ||||
| 		return m_instr.range(24, 20); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void set_rs2(int32_t value) override { | ||||
| 		m_instr.range(24, 20) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	inline int32_t get_funct3() const override { | ||||
| 		return m_instr.range(14, 12); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void set_funct3(int32_t value) override { | ||||
| 		m_instr.range(14, 12) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Decodes opcode of instruction | ||||
| 	 * @return opcode of instruction | ||||
|  |  | |||
|  | @ -100,54 +100,6 @@ public: | |||
| 	 */ | ||||
| 	using extension_base::extension_base; | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to rs1 field | ||||
| 	 * @return rs1 field | ||||
| 	 */ | ||||
| 	inline int32_t get_rs1() const override { | ||||
| 		return m_instr.range(19, 15); | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Sets rs1 field | ||||
| 	 * @param value desired rs1 value | ||||
| 	 */ | ||||
| 	inline void set_rs1(int32_t value) override { | ||||
| 		m_instr.range(19, 15) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to rs2 field | ||||
| 	 * @return rs2 field | ||||
| 	 */ | ||||
| 	inline int32_t get_rs2() const override { | ||||
| 		return m_instr.range(24, 20); | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Sets rs2 field | ||||
| 	 * @param value desired rs2 value | ||||
| 	 */ | ||||
| 	inline void set_rs2(int32_t value) override { | ||||
| 		m_instr.range(24, 10) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to funct3 field | ||||
| 	 * @return funct3 field | ||||
| 	 */ | ||||
| 	inline int32_t get_funct3() const override { | ||||
| 		return m_instr.range(14, 12); | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Sets func3 field | ||||
| 	 * @param value desired func3 value | ||||
| 	 */ | ||||
| 	inline void set_funct3(int32_t value) override { | ||||
| 		m_instr.range(14, 12) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to funct7 field | ||||
| 	 * @return funct7 field | ||||
|  |  | |||
|  | @ -81,37 +81,6 @@ private: | |||
| 		return m_instr.range(14, 12); | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to rs1 field | ||||
| 	 * @return rs1 field | ||||
| 	 */ | ||||
| 	inline int32_t get_rs1() const { | ||||
| 		return m_instr.range(19, 15); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void set_rs1(int32_t value) { | ||||
| 		m_instr.range(19, 15) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	/**
 | ||||
| 	 * @brief Access to rs2 field | ||||
| 	 * @return rs2 field | ||||
| 	 */ | ||||
| 	inline int32_t get_rs2() const { | ||||
| 		return m_instr.range(24, 20); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void set_rs2(int32_t value) { | ||||
| 		m_instr.range(24, 20) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	inline int32_t get_funct3() const { | ||||
| 		return m_instr.range(14, 12); | ||||
| 	} | ||||
| 
 | ||||
| 	inline void set_funct3(int32_t value) { | ||||
| 		m_instr.range(14, 12) = value; | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -36,18 +36,38 @@ public: | |||
| 
 | ||||
| 	/* pure virtual functions */ | ||||
| 	virtual int32_t opcode() const = 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; | ||||
| 	virtual void set_rs2(int32_t value) = 0; | ||||
| 	virtual int32_t get_funct3() const = 0; | ||||
| 	virtual void set_funct3(int32_t value) = 0; | ||||
| 
 | ||||
| 	virtual int32_t get_rs1() const { | ||||
|     return m_instr.range(19, 15); | ||||
| 	} | ||||
| 
 | ||||
| 	virtual void set_rs1(int32_t value) { | ||||
| 	  m_instr.range(19, 15) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	virtual int32_t get_rs2() const { | ||||
| 	  return m_instr.range(24, 20); | ||||
| 	} | ||||
| 
 | ||||
| 	virtual void set_rs2(int32_t value) { | ||||
|     m_instr.range(24, 20) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	virtual int32_t get_funct3() const { | ||||
|     return m_instr.range(14, 12); | ||||
| 	} | ||||
| 
 | ||||
| 	virtual void set_funct3(int32_t value) { | ||||
| 	  m_instr.range(14, 12) = value; | ||||
| 	} | ||||
| 
 | ||||
| 	virtual void dump() const; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue