Fix hardcoded memory size (issue #128)
Recalculate memory size using #Banks, #Rows, and #Columns from memory specs.
This commit is contained in:
@@ -94,8 +94,11 @@ struct Dram : sc_module
|
||||
|
||||
SC_CTOR(Dram) : tSocket("socket")
|
||||
{
|
||||
// FIXME: memory size
|
||||
unsigned int size = 1024 * 1024 * 1024;
|
||||
// calculate memory size
|
||||
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;
|
||||
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