From 478ce8d79f43456d6044b51dad1f022d07df401a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Wed, 9 Nov 2016 17:44:13 +0100 Subject: [PATCH] Function to get the width of the data bus. --- .../controller/core/configuration/Configuration.cpp | 10 ++++++++++ .../src/controller/core/configuration/Configuration.h | 1 + DRAMSys/simulator/src/simulation/Dram.h | 5 +---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index 1ee8f80d..ea6cb130 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -244,3 +244,13 @@ unsigned int Configuration::getSimMemSizeInBytes() return memorySize; } +// Returns the width of the data bus. +// All DRAM chips on a DIMM operate in lockstep, +// which constituing aggregate data bus width = chip's bus width * # locksteep-operated chips +// The bus width is given in bits, e.g., 64-bit data bus, 128-bit data bus, etc. +unsigned int Configuration::getDataBusWidth() +{ + unsigned int dataBusWidth = memSpec.bitWidth * NumberOfDevicesOnDIMM; + return dataBusWidth; +} + diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h index 8866620a..49c32d98 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h @@ -101,6 +101,7 @@ struct Configuration TemperatureSimConfig temperatureSim; unsigned int getSimMemSizeInBytes(); + unsigned int getDataBusWidth(); private: Configuration(); diff --git a/DRAMSys/simulator/src/simulation/Dram.h b/DRAMSys/simulator/src/simulation/Dram.h index 344d3805..a6acf28e 100644 --- a/DRAMSys/simulator/src/simulation/Dram.h +++ b/DRAMSys/simulator/src/simulation/Dram.h @@ -66,10 +66,7 @@ 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 - // The bus width is given in bits, e.g., 64-bit data bus, 128-bit data bus, etc. - unsigned int dataBusWidth = Configuration::getInstance().memSpec.bitWidth * Configuration::getInstance().NumberOfDevicesOnDIMM; + unsigned int dataBusWidth = Configuration::getInstance().getDataBusWidth(); // First multiply to get the number of bits in a burst, then divide by 8 to get the value in bytes (the order is important. Think on a single x4 device) unsigned int bytesPerBurst = (burstLength * dataBusWidth) / 8;