Proper initialization of sp register

This commit is contained in:
mariusmonton 2018-10-15 17:32:37 +02:00
parent aa526943b9
commit 5ae765b304
2 changed files with 10 additions and 3 deletions

View File

@ -14,6 +14,7 @@
#include "tlm.h" #include "tlm.h"
#include "Performance.h" #include "Performance.h"
#include "Memory.h"
using namespace sc_core; using namespace sc_core;
using namespace sc_dt; using namespace sc_dt;
@ -126,8 +127,13 @@ public:
/** /**
* Increments PC couunter to next address * Increments PC couunter to next address
*/ */
inline void incPC() { inline void incPC(bool C_ext=false) {
register_PC += 4; if (C_ext == true) {
register_PC += 2;
} else {
register_PC += 4;
}
} }
/** /**

View File

@ -6,7 +6,8 @@ Registers::Registers() {
memset(CSR, 0, sizeof(uint32_t)*4096); memset(CSR, 0, sizeof(uint32_t)*4096);
perf = Performance::getInstance(); perf = Performance::getInstance();
register_bank[sp] = 1024-1; // SP points to end of memory //register_bank[sp] = 1024-1; // SP points to end of memory
register_bank[sp] = Memory::SIZE-1;
register_PC = 0x10000; // default _start address register_PC = 0x10000; // default _start address
} }