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) {
44 void Ccmpi::evalInstr()
47 dynamic_bitset<> immb = argbits;
49 this->m_imm = this->generate16ImmSign(immb.to_ulong());
52 m_ra = this->getRegister(argbits);
55 void Ccmpi::execInstr()
57 //cout << "should exec " << this->toString() << endl;
58 CDat ra = this->m_cpu->getRegister(m_ra);
59 CDatd reg = ra - this->m_imm;
60 this->m_cpu->updateFlags(reg, ra, this->m_imm);
63 std::string Ccmpi::toString()
66 op << this->getName();
72 op << this->getConditionFlag() << " r" << m_rd << ", r" << m_ra << ", " << m_imm;