1 #include "../Iinstr.hpp"
3 class Ccmpi : public Iinstr {
8 std::string toString();
13 * Name: create_instruction
14 * Purpose: if compiled as shared library, this functions creates the
17 * Returns: pointer to instruction object
19 extern "C" Iinstr* create_instruction() {
23 Iinstr* Ccmpi::getNew() {
28 * Name: destroy_instruction
29 * Purpose: if compiled as shared library, this functions destoys the
32 * Parameter: IInstruction - the instruction object to delete
34 extern "C" void destroy_instruction(Iinstr* p) {
45 void Ccmpi::evalInstr()
48 dynamic_bitset<> immb = argbits;
50 this->m_imm = this->generate16ImmSign(immb.to_ulong());
53 m_ra = this->getRegister(argbits);
56 void Ccmpi::execInstr()
58 //cout << "should exec " << this->toString() << endl;
59 CDat ra = this->m_cpu->getRegister(m_ra);
60 CDatd reg = ra - this->m_imm;
61 this->m_cpu->updateFlags(reg, ra, (~this->m_imm)+1);
64 std::string Ccmpi::toString()
67 op << this->getName();
73 op << this->getConditionFlag() << " r" << m_ra << ", " << m_imm;