disasm/sim: changed interface, branch => br, features++
[calu.git] / 3c_disasm / instr / add.cpp
index 7cdf820def5d026441eb02ca3a19d29d3fd7780b..f196794d3d45a82e50ff298d25d83a9100e94ccd 100644 (file)
@@ -6,6 +6,7 @@ class Cadd : public Iinstr {
                void evalInstr();
                void execInstr();
                std::string toString();
+               Iinstr* getNew();
 };
 
 /**
@@ -19,6 +20,10 @@ extern "C" Iinstr* create_instruction() {
     return new Cadd();
 }
 
+Iinstr* Cadd::getNew() {
+       return new Cadd();
+}
+
 /**
  * Name:      destroy_instruction
  * Purpose:   if compiled as shared library, this functions destoys the 
@@ -53,7 +58,10 @@ void Cadd::evalInstr()
 
 void Cadd::execInstr()
 {
-       cout << "should exec" << this->toString() << endl;
+       cout << "should exec " << this->toString() << endl;
+       CDat val = this->m_cpu->getRegister(m_ra) + this->m_cpu->getRegister(m_rb);
+       this->m_cpu->setRegister(m_rd, val);
+       this->m_cpu->updateFlags(val);
 }
 
 std::string Cadd::toString()