Memory size can achieve values not supported by unsigned int. (small fix!!!)
Using std::uint64_t.
This commit is contained in:
@@ -229,19 +229,19 @@ void Configuration::setParameters(std::map<std::string, std::string> parameterMa
|
||||
}
|
||||
|
||||
// Returns the total memory size in bytes
|
||||
unsigned int Configuration::getSimMemSizeInBytes()
|
||||
std::uint64_t Configuration::getSimMemSizeInBytes()
|
||||
{
|
||||
// 1. Get number of banks, rows, columns and data width in bits for one die (or chip)
|
||||
unsigned int banks = memSpec.NumberOfBanks;
|
||||
unsigned int rows = memSpec.NumberOfRows;
|
||||
unsigned int columns = memSpec.NumberOfColumns;
|
||||
unsigned int bitWidth = memSpec.bitWidth;
|
||||
std::uint64_t banks = memSpec.NumberOfBanks;
|
||||
std::uint64_t rows = memSpec.NumberOfRows;
|
||||
std::uint64_t columns = memSpec.NumberOfColumns;
|
||||
std::uint64_t bitWidth = memSpec.bitWidth;
|
||||
// 2. Calculate size of one DRAM chip in bits
|
||||
unsigned int chipBitSize = banks * rows * columns * bitWidth;
|
||||
std::uint64_t chipBitSize = banks * rows * columns * bitWidth;
|
||||
// 3. Calculate size of one DRAM chip in bytes
|
||||
unsigned int chipSize = chipBitSize / 8;
|
||||
std::uint64_t chipSize = chipBitSize / 8;
|
||||
// 4. Total memory size in Bytes of one DIMM (with only support of 1 rank on a DIMM)
|
||||
unsigned int memorySize = chipSize * NumberOfDevicesOnDIMM;
|
||||
std::uint64_t memorySize = chipSize * NumberOfDevicesOnDIMM;
|
||||
assert(memorySize > 0);
|
||||
return memorySize;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ struct Configuration
|
||||
// Temperature Simulation related
|
||||
TemperatureSimConfig temperatureSim;
|
||||
|
||||
unsigned int getSimMemSizeInBytes();
|
||||
std::uint64_t getSimMemSizeInBytes();
|
||||
unsigned int getDataBusWidth();
|
||||
unsigned int getBytesPerBurst();
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ struct Dram : sc_module
|
||||
|
||||
SC_CTOR(Dram) : tSocket("socket")
|
||||
{
|
||||
unsigned int memorySize = Configuration::getInstance().getSimMemSizeInBytes();
|
||||
std::uint64_t memorySize = Configuration::getInstance().getSimMemSizeInBytes();
|
||||
// allocate and model storage of one DRAM channel using memory map
|
||||
memory = (unsigned char *)mmap(NULL, memorySize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, -1, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user