X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=calu.git;a=blobdiff_plain;f=3c_disasm%2Finstr%2Fmovt.cpp;fp=3c_disasm%2Finstr%2Fmovt.cpp;h=416812a964d14d18937bac3d98520199142e9c62;hp=0000000000000000000000000000000000000000;hb=69964280107c6139062349844f99ef80bc6f68be;hpb=bdac0a3a362e151f65cc32364f5120e28ce32314 diff --git a/3c_disasm/instr/movt.cpp b/3c_disasm/instr/movt.cpp new file mode 100644 index 0000000..416812a --- /dev/null +++ b/3c_disasm/instr/movt.cpp @@ -0,0 +1,78 @@ +#include "../Iinstr.hpp" + +class Cmovt : public Iinstr { + private: + bool m_type; + public: + Cmovt(); + void evalInstr(); + void execInstr(); + std::string toString(); + Iinstr* getNew(); +}; + +/** + * Name: create_instruction + * Purpose: if compiled as shared library, this functions creates the + instruction object + + * Returns: pointer to instruction object + */ +extern "C" Iinstr* create_instruction() { + return new Cmovt(); +} + +Iinstr* Cmovt::getNew() { + return new Cmovt(); +} + +/** + * Name: destroy_instruction + * Purpose: if compiled as shared library, this functions destoys the + instruction object + + * Parameter: IInstruction - the instruction object to delete + */ +extern "C" void destroy_instruction(Iinstr* p) { + delete p; +} + +Cmovt::Cmovt() : m_type(0) +{ + opcode = B5(01101); + name = "movt"; +} + +void Cmovt::evalInstr() +{ + this->m_type = argbits[18]; + if(this->m_type) { + name = "movpt"; + } + else { + name = "movst"; + } + + argbits >>= 19; + m_rd = this->getRegister(argbits); +} + +void Cmovt::execInstr() +{ + //cout << "should exec " << this->toString() << endl; + CDat val = this->m_cpu->getRegister(this->m_rd); + if(this->m_type) { + this->m_cpu->setFlags(val); + } + else { + this->m_cpu->setStack(val); + } +} + +std::string Cmovt::toString() +{ + stringstream op; + op << this->getName(); + op << " r" << m_rd; + return op.str(); +}