Added initial register content needed by runtime.

git-svn-id: http://www.cdkersey.com/harp/harptool@10 0246edb2-e076-4747-b392-db732a341fa2
This commit is contained in:
chad
2011-07-23 12:22:43 +00:00
parent 269fe72f2d
commit e3ab8a71ee
3 changed files with 6 additions and 6 deletions

View File

@@ -14,13 +14,13 @@
using namespace Harp; using namespace Harp;
using namespace std; using namespace std;
Core::Core(const ArchDef &a, Decoder &d, MemoryUnit &mem) : Core::Core(const ArchDef &a, Decoder &d, MemoryUnit &mem, Word id) :
a(a), iDec(d), mem(mem), pc(0), interruptEnable(false), supervisorMode(true), a(a), iDec(d), mem(mem), pc(0), interruptEnable(false), supervisorMode(true),
activeThreads(1), activeThreads(1),
reg(a.getNThds(), vector<Word>(a.getNRegs())), reg(a.getNThds(), vector<Word>(a.getNRegs())),
pred(a.getNPRegs(), vector<bool>(a.getNPRegs())), pred(a.getNPRegs(), vector<bool>(a.getNPRegs())),
shadowReg(), shadowPReg(), interruptEntry(0) shadowReg(), shadowPReg(), interruptEntry(0), id(id)
{ } { reg[0][0] = (a.getNThds()<<(a.getWordSize()*8 / 2)) | id; }
void Core::step() { void Core::step() {
Size fetchPos(0), decPos, wordSize(a.getWordSize()); Size fetchPos(0), decPos, wordSize(a.getWordSize());

View File

@@ -230,7 +230,7 @@ int emu_main(int argc, char **argv) {
} }
MemoryUnit mu(4096, arch.getWordSize()); MemoryUnit mu(4096, arch.getWordSize());
Core core(arch, *dec, mu); Core core(arch, *dec, mu/*, ID in multicore implementations*/);
RamMemDevice mem(imgFileName.c_str(), arch.getWordSize()); RamMemDevice mem(imgFileName.c_str(), arch.getWordSize());
ConsoleMemDevice console(arch.getWordSize(), cout, core); ConsoleMemDevice console(arch.getWordSize(), cout, core);

View File

@@ -15,7 +15,7 @@
namespace Harp { namespace Harp {
class Core { class Core {
public: public:
Core(const ArchDef &a, Decoder &d, MemoryUnit &mem); Core(const ArchDef &a, Decoder &d, MemoryUnit &mem, Word id=0);
void step(); void step();
bool interrupt(Word r0); bool interrupt(Word r0);
bool running() const { return activeThreads; } bool running() const { return activeThreads; }
@@ -25,7 +25,7 @@ namespace Harp {
Decoder &iDec; Decoder &iDec;
MemoryUnit &mem; MemoryUnit &mem;
Word pc, interruptEntry, shadowPc; Word pc, interruptEntry, shadowPc, id;
Size activeThreads, shadowActiveThreads; Size activeThreads, shadowActiveThreads;
std::vector<std::vector<Word> > reg; std::vector<std::vector<Word> > reg;
std::vector<std::vector<bool> > pred; std::vector<std::vector<bool> > pred;