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 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),
activeThreads(1),
reg(a.getNThds(), vector<Word>(a.getNRegs())),
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() {
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());
Core core(arch, *dec, mu);
Core core(arch, *dec, mu/*, ID in multicore implementations*/);
RamMemDevice mem(imgFileName.c_str(), arch.getWordSize());
ConsoleMemDevice console(arch.getWordSize(), cout, core);

View file

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