reduce scope variables

This commit is contained in:
mariusmonton 2021-01-31 12:09:15 +01:00
parent 622da9872a
commit 1d1b6de616
3 changed files with 4 additions and 6 deletions

View File

@ -57,7 +57,6 @@ CPU::~CPU() {
bool CPU::cpu_process_IRQ() { bool CPU::cpu_process_IRQ() {
uint32_t csr_temp; uint32_t csr_temp;
uint32_t new_pc;
bool ret_value = false; bool ret_value = false;
if (interrupt == true) { if (interrupt == true) {
@ -84,7 +83,7 @@ bool CPU::cpu_process_IRQ() {
register_bank->setCSR(CSR_MCAUSE, 0x80000000); register_bank->setCSR(CSR_MCAUSE, 0x80000000);
/* set new PC address */ /* set new PC address */
new_pc = register_bank->getCSR(CSR_MTVEC); uint32_t new_pc = register_bank->getCSR(CSR_MTVEC);
//new_pc = new_pc & 0xFFFFFFFC; // last two bits always to 0 //new_pc = new_pc & 0xFFFFFFFC; // last two bits always to 0
log->SC_log(Log::DEBUG) << "NEW PC Value 0x" << std::hex << new_pc log->SC_log(Log::DEBUG) << "NEW PC Value 0x" << std::hex << new_pc
<< std::endl; << std::endl;

View File

@ -62,7 +62,6 @@ CPU64::~CPU64() {
bool CPU64::cpu_process_IRQ() { bool CPU64::cpu_process_IRQ() {
uint32_t csr_temp; uint32_t csr_temp;
uint32_t new_pc;
bool ret_value = false; bool ret_value = false;
if (interrupt == true) { if (interrupt == true) {
@ -89,7 +88,7 @@ bool CPU64::cpu_process_IRQ() {
register_bank->setCSR(CSR_MCAUSE, 0x80000000); register_bank->setCSR(CSR_MCAUSE, 0x80000000);
/* set new PC address */ /* set new PC address */
new_pc = register_bank->getCSR(CSR_MTVEC); uint32_t new_pc = register_bank->getCSR(CSR_MTVEC);
//new_pc = new_pc & 0xFFFFFFFC; // last two bits always to 0 //new_pc = new_pc & 0xFFFFFFFC; // last two bits always to 0
log->SC_log(Log::DEBUG) << "NEW PC Value 0x" << std::hex << new_pc log->SC_log(Log::DEBUG) << "NEW PC Value 0x" << std::hex << new_pc
<< std::endl; << std::endl;

View File

@ -148,11 +148,11 @@ void Memory::readHexFile(std::string const& filename) {
std::ifstream hexfile; std::ifstream hexfile;
std::string line; std::string line;
uint32_t extended_address = 0;
hexfile.open(filename); hexfile.open(filename);
if (hexfile.is_open()) { if (hexfile.is_open()) {
uint32_t extended_address = 0;
while (getline(hexfile, line)) { while (getline(hexfile, line)) {
if (line[0] == ':') { if (line[0] == ':') {
if (line.substr(7, 2) == "00") { if (line.substr(7, 2) == "00") {