Proper initialization of sp register
This commit is contained in:
		
							parent
							
								
									aa526943b9
								
							
						
					
					
						commit
						5ae765b304
					
				| 
						 | 
					@ -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,10 +127,15 @@ public:
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * Increments PC couunter to next address
 | 
					   * Increments PC couunter to next address
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
  inline void incPC() {
 | 
					  inline void incPC(bool C_ext=false) {
 | 
				
			||||||
 | 
					    if (C_ext == true) {
 | 
				
			||||||
 | 
					      register_PC += 2;
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
      register_PC += 4;
 | 
					      register_PC += 4;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
   * @brief Get CSR value
 | 
					   * @brief Get CSR value
 | 
				
			||||||
   * @param csr CSR number to access
 | 
					   * @param csr CSR number to access
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue