change fixed array for CSR to unordered map
This commit is contained in:
parent
5b91897244
commit
abf47625a1
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
#define SC_INCLUDE_DYNAMIC_PROCESSES
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "systemc"
|
#include "systemc"
|
||||||
#include "tlm.h"
|
#include "tlm.h"
|
||||||
|
@ -254,7 +255,10 @@ private:
|
||||||
/**
|
/**
|
||||||
* CSR registers (4096 maximum)
|
* CSR registers (4096 maximum)
|
||||||
*/
|
*/
|
||||||
uint32_t CSR[4096];
|
//uint32_t CSR[4096];
|
||||||
|
std::unordered_map<unsigned int, uint32_t> CSR;
|
||||||
|
|
||||||
|
|
||||||
Performance *perf;
|
Performance *perf;
|
||||||
|
|
||||||
void initCSR(void);
|
void initCSR(void);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
Registers::Registers() {
|
Registers::Registers() {
|
||||||
|
|
||||||
memset(register_bank, 0, sizeof(uint32_t) * 32); // 32 registers of 32 bits each
|
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();
|
perf = Performance::getInstance();
|
||||||
|
|
||||||
initCSR();
|
initCSR();
|
||||||
|
@ -156,7 +156,7 @@ uint32_t Registers::getCSR(int csr) {
|
||||||
- sc_core::sc_time(sc_core::SC_ZERO_TIME)).to_double())
|
- sc_core::sc_time(sc_core::SC_ZERO_TIME)).to_double())
|
||||||
>> 32 & 0x00000000FFFFFFFF);
|
>> 32 & 0x00000000FFFFFFFF);
|
||||||
break;
|
break;
|
||||||
default:
|
[[likely]] default:
|
||||||
ret_value = CSR[csr];
|
ret_value = CSR[csr];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue