Recalculate memory size, that take into account of bus width & #chips on a DIMM
This commit is contained in:
@@ -66,6 +66,8 @@ using namespace Data;
|
||||
struct Dram : sc_module
|
||||
{
|
||||
unsigned int burstLength = Configuration::getInstance().memSpec.BurstLength;
|
||||
// All DRAM chips on a DIMM operate in lockstep,
|
||||
// which constituing aggregate data bus width = chip's bus width * # locksteep-operated chips
|
||||
unsigned int busWidth = Configuration::getInstance().memSpec.BusWidth * Configuration::getInstance().NumberOfDevicesOnDIMM;
|
||||
unsigned int bytesPerBurst = burstLength * (busWidth / 8);
|
||||
|
||||
@@ -94,11 +96,11 @@ struct Dram : sc_module
|
||||
|
||||
SC_CTOR(Dram) : tSocket("socket")
|
||||
{
|
||||
// calculate memory size
|
||||
// calculate memory size (in Bytes)
|
||||
unsigned int banks = Configuration::getInstance().memSpec.NumberOfBanks;
|
||||
unsigned int rows = Configuration::getInstance().memSpec.NumberOfRows;
|
||||
unsigned int columns = Configuration::getInstance().memSpec.NumberOfColumns;
|
||||
unsigned int size = banks * rows * columns;
|
||||
unsigned int size = banks * rows * columns * (busWidth / 8);
|
||||
memory = (unsigned char *)mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_NORESERVE, -1, 0);
|
||||
|
||||
tSocket.register_nb_transport_fw(this, &Dram::nb_transport_fw);
|
||||
|
||||
Reference in New Issue
Block a user