From dddac71f4920c5b13a7539ab0daf06910a5843ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Wed, 9 Nov 2016 19:19:09 +0100 Subject: [PATCH] Assertions added. For memory modules: - The least significant bits of the physical address are the byte offset of the N-byte-wide memory module. - A single data word has N bytes. - N = 2^(# bits for byte offset). Assert that the number of bytes per burst match the burst length times the data word size in bytes. --- .../controller/core/configuration/Configuration.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index b132f283..62959c6f 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -253,6 +253,7 @@ unsigned int Configuration::getSimMemSizeInBytes() unsigned int Configuration::getDataBusWidth() { unsigned int dataBusWidth = memSpec.bitWidth * NumberOfDevicesOnDIMM; + assert(dataBusWidth > 0); return dataBusWidth; } @@ -262,6 +263,15 @@ unsigned int Configuration::getBytesPerBurst() // 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 = (memSpec.BurstLength * getDataBusWidth()) / 8; assert(bytesPerBurst > 0); + + if (NumberOfDevicesOnDIMM > 1) { + // The least significant bits of the physical address are the byte + // offset of the N-byte-wide memory module (a single data word has N + // bytes. N = 2^(# bits for byte offset)). + unsigned int dataWordSizeInBytes = xmlAddressDecoder::getInstance().amount["bytes"]; + assert(bytesPerBurst == (dataWordSizeInBytes * memSpec.BurstLength)); + } + return bytesPerBurst; }