change fixed array for CSR to unordered map

This commit is contained in:
mariusmonton 2020-06-21 00:29:45 +02:00
parent 5b91897244
commit abf47625a1
2 changed files with 7 additions and 3 deletions

View File

@ -11,6 +11,7 @@
#define SC_INCLUDE_DYNAMIC_PROCESSES
#include <iomanip>
#include <unordered_map>
#include "systemc"
#include "tlm.h"
@ -254,7 +255,10 @@ private:
/**
* CSR registers (4096 maximum)
*/
uint32_t CSR[4096];
//uint32_t CSR[4096];
std::unordered_map<unsigned int, uint32_t> CSR;
Performance *perf;
void initCSR(void);

View File

@ -11,7 +11,7 @@
Registers::Registers() {
memset(register_bank, 0, sizeof(uint32_t) * 32); // 32 registers of 32 bits each
memset(CSR, 0, sizeof(uint32_t) * 4096);
//memset(CSR, 0, sizeof(uint32_t) * 4096);
perf = Performance::getInstance();
initCSR();
@ -156,7 +156,7 @@ uint32_t Registers::getCSR(int csr) {
- sc_core::sc_time(sc_core::SC_ZERO_TIME)).to_double())
>> 32 & 0x00000000FFFFFFFF);
break;
default:
[[likely]] default:
ret_value = CSR[csr];
break;
}