X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=3b_sim%2Fccpu.cpp;fp=3b_sim%2Fccpu.cpp;h=5f533ce42c546860fd22e9f99d63ae77d371f2b8;hb=5323485da487f6436f3f97971054e8b663778455;hp=abeeafd607c912e01402a9d889871895fe6bee49;hpb=65e5b2a7af27acfc56664224ebe2421778d484bd;p=calu.git diff --git a/3b_sim/ccpu.cpp b/3b_sim/ccpu.cpp index abeeafd..5f533ce 100644 --- a/3b_sim/ccpu.cpp +++ b/3b_sim/ccpu.cpp @@ -17,6 +17,7 @@ void CCpu::tick() if(instr == NULL) { throw string("Out of Instructions!"); } + this->incPerf(); if(this->conditionMet(instr->getCondition())) { cout << "Executing: " << instr->toString() << endl; instr->execInstr(); @@ -190,7 +191,23 @@ void CCpu::setStack(const int val) this->m_stack = val; } -CCpu::CCpu(int regs, int ram, int prog) : m_Z(false), m_S(false), m_C(false), m_O(false), m_pc(0), m_pc_next(0), m_reg(regs), m_ram(ram), m_prog(prog), m_stack(0) +CDat CCpu::getPerf() const +{ + return this->m_perf; +} + +void CCpu::setPerf(CDat val) +{ + this->m_perf = val; +} + +void CCpu::incPerf() +{ + this->m_perf++; +} + + +CCpu::CCpu(int regs, int ram, int prog) : m_Z(false), m_S(false), m_C(false), m_O(false), m_pc(0), m_pc_next(0), m_perf(0), m_reg(regs), m_ram(ram), m_prog(prog), m_stack(0) { }