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
|
||||
#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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue