X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=3b_sim%2Fccpu.cpp;h=98c0b658f66279cf63d8f20a18e6e995ef8b6500;hb=HEAD;hp=d2e64e030e3024ecb3f495b2055ce88de12d5949;hpb=d664b832f84b5130620e78dd87c80d79ef81a139;p=calu.git diff --git a/3b_sim/ccpu.cpp b/3b_sim/ccpu.cpp index d2e64e0..98c0b65 100644 --- a/3b_sim/ccpu.cpp +++ b/3b_sim/ccpu.cpp @@ -1,3 +1,24 @@ +/* `Deep Thought', a softcore CPU implemented on a FPGA + + Copyright (C) 2010 Markus Hofstaetter + Copyright (C) 2010 Martin Perner + Copyright (C) 2010 Stefan Rebernig + Copyright (C) 2010 Manfred Schwarz + Copyright (C) 2010 Bernhard Urban + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + #include "ccpu.hpp" /* CDat m_pc, m_pc_next; @@ -33,6 +54,23 @@ void CCpu::registerExtension(Iext* ext) m_exts.push_back(ext); } +void CCpu::applyToExtensions(const vector& in) +{ + for(auto iter = m_exts.begin(); iter != m_exts.end(); ++iter) { + (*iter)->parseInput(in); + } +} + +void CCpu::breakNext() +{ + m_breakNext = true; +} + +bool CCpu::shouldBreak() +{ + return m_breakNext; +} + void CCpu::tick() { // signal extensions @@ -51,7 +89,7 @@ void CCpu::tick() } if(this->conditionMet(instr->getCondition())) { - cout << color(green,black) << "Executing: " << color(white,black) << colorifyInstr(instr->toString()) << endl; + cout << color(green,black) << "Executing: " << color(white,black) << colorifyInstr(instr->toString()) << " (0x" << std::hex << m_pc << std::dec << ")" << endl; instr->execInstr(); this->incPerfBy(instr->getClockCount()); } @@ -266,7 +304,7 @@ void CCpu::incPerfBy(short inc) } -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_exts(0), m_stack(0) +CCpu::CCpu(int regs, int ram, int prog) : m_Z(false), m_S(false), m_C(false), m_O(false), m_breakNext(0), m_pc(0), m_pc_next(0), m_perf(0), m_reg(regs), m_ram(ram), m_prog(prog), m_exts(0), m_stack(0) { }