From 169627de2e8da1c9e7c95e08b2f8e2a7d442cad5 Mon Sep 17 00:00:00 2001 From: "Lukas Steiner (2)" Date: Fri, 21 Feb 2020 14:55:06 +0100 Subject: [PATCH] Included address range check. Fixed bug with FIFO Strict in controllerMethod(). --- DRAMSys/library/src/common/XmlAddressDecoder.cpp | 5 +++++ DRAMSys/library/src/common/XmlAddressDecoder.h | 1 + DRAMSys/library/src/controller/Controller.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/DRAMSys/library/src/common/XmlAddressDecoder.cpp b/DRAMSys/library/src/common/XmlAddressDecoder.cpp index 06e0c715..0dcc2d5d 100644 --- a/DRAMSys/library/src/common/XmlAddressDecoder.cpp +++ b/DRAMSys/library/src/common/XmlAddressDecoder.cpp @@ -119,6 +119,8 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI) bankgroupsPerRank = amount.bankgroup; amount.bankgroup = bankgroupsPerRank * amount.rank; + maximumAddress = amount.bytes * amount.column * amount.row * banksPerGroup * bankgroupsPerRank * amount.rank * amount.channel - 1; + Configuration &config = Configuration::getInstance(); MemSpec *memSpec = config.memSpec; @@ -132,6 +134,9 @@ void XmlAddressDecoder::setConfiguration(std::string addressConfigURI) DecodedAddress XmlAddressDecoder::decodeAddress(uint64_t addr) { + if (addr > maximumAddress) + SC_REPORT_WARNING("XmlAddressDecoder", ("Address " + std::to_string(addr) + " out of range (maximum address is " + std::to_string(maximumAddress) + ")").c_str()); + DecodedAddress result; result.channel = (addr & masks.channel) >> shifts.channel; result.rank = (addr & masks.rank) >> shifts.rank; diff --git a/DRAMSys/library/src/common/XmlAddressDecoder.h b/DRAMSys/library/src/common/XmlAddressDecoder.h index 85a9c0ca..21befb9f 100644 --- a/DRAMSys/library/src/common/XmlAddressDecoder.h +++ b/DRAMSys/library/src/common/XmlAddressDecoder.h @@ -78,6 +78,7 @@ private: unsigned bankgroupsPerRank; tinyxml2::XMLElement *addressmapping; + uint64_t maximumAddress; public: XmlAddressDecoder(); diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index d4ded163..54811455 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -305,7 +305,11 @@ void Controller::controllerMethod() // TODO: check if all calls are necessary sc_time delayForNextTrigger = sc_max_time(); for (auto it : bankMachines) - delayForNextTrigger = std::min(delayForNextTrigger, it->start()); + { + sc_time localDelay = it->start(); + if (!(localDelay == SC_ZERO_TIME && readyCmdBlocked)) + delayForNextTrigger = std::min(delayForNextTrigger, localDelay); + } if (payloadToAcquire != nullptr && sc_time_stamp() >= timeToAcquire && scheduler->hasBufferSpace(payloadToAcquire)) acquirePayload(); for (auto it : refreshManagers) @@ -313,7 +317,7 @@ void Controller::controllerMethod() for (auto it : powerDownManagers) delayForNextTrigger = std::min(delayForNextTrigger, it->start()); - if (!((delayForNextTrigger == SC_ZERO_TIME && readyCmdBlocked) || (delayForNextTrigger == (sc_max_time() - sc_time_stamp())))) + if (!(delayForNextTrigger == (sc_max_time() - sc_time_stamp()))) controllerEvent.notify(delayForNextTrigger); }