1 #include "../Iinstr.hpp"
4 class Cstw : 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* Cstw::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 Cstw::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 Cstw::execInstr()
63 //cout << "should exec " << this->toString() << endl;
64 CDat val = this->m_cpu->getRegister(this->m_ra);
66 this->m_cpu->setRAM(val, this->m_cpu->getRegister(this->m_rd));
69 std::string Cstw::toString()
72 op << this->getName();
74 op << this->getConditionFlag() << " r" << m_rd << ", " << m_imm << "(r" << m_ra << ")";