1 #include "../Iinstr.hpp"
4 class Cstx : public Iinstr {
9 std::string toString();
14 * Name: create_instruction
15 * Purpose: if compiled as shared library, this functions creates the
18 * Returns: pointer to instruction object
20 extern "C" Iinstr* create_instruction() {
24 Iinstr* Cstx::getNew()
30 * Name: destroy_instruction
31 * Purpose: if compiled as shared library, this functions destoys the
34 * Parameter: IInstruction - the instruction object to delete
36 extern "C" void destroy_instruction(Iinstr* p) {
46 void Cstx::evalInstr()
50 dynamic_bitset<> immb = argbits;
52 this->m_imm = this->generate15ImmSign(immb.to_ulong());
55 m_ra = this->getRegister(argbits);
57 m_rd = this->getRegister(argbits);
61 void Cstx::execInstr()
63 //cout << "should exec " << this->toString() << endl;
64 CDat val = this->m_cpu->getRegister(this->m_ra);
66 this->m_cpu->setProg(val, m_disasm->decodeNum(this->m_cpu->getRegister(this->m_rd)));
69 std::string Cstx::toString()
72 op << this->getName();
74 op << this->getConditionFlag() << " r" << m_rd << ", " << m_imm << "(r" << m_ra << ")";