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