1 #include "../Iinstr.hpp"
3 class Caddi : public Iinstr {
8 std::string toString();
12 * Name: create_instruction
13 * Purpose: if compiled as shared library, this functions creates the
16 * Returns: pointer to instruction object
18 extern "C" Iinstr* create_instruction() {
23 * Name: destroy_instruction
24 * Purpose: if compiled as shared library, this functions destoys the
27 * Parameter: IInstruction - the instruction object to delete
29 extern "C" void destroy_instruction(Iinstr* p) {
39 void Caddi::evalInstr()
41 this->m_s = argbits[2];
42 this->m_c = argbits[1];
43 this->m_d = argbits[0];
46 dynamic_bitset<> immb = argbits;
48 this->m_imm = this->generate12ImmSign(immb.to_ulong());
51 m_ra = this->getRegister(argbits);
54 m_rd = this->getRegister(argbits);
57 void Caddi::execInstr()
59 cout << "should exec " << this->toString() << endl;
62 std::string Caddi::toString()
65 op << this->getName();
71 op << this->getConditionFlag() << " r" << m_rd << ", r" << m_ra << ", " << m_imm;