From 658e3fb1ca069a55191406cbd033cc4201a61c65 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Mon, 6 Apr 2020 11:44:33 +0200 Subject: [PATCH] Included cmake debug flag into debug manager. --- .../src/common/CongenAddressDecoder.cpp | 7 ++++--- .../library/src/common/CongenAddressDecoder.h | 12 ++++-------- DRAMSys/library/src/common/DebugManager.cpp | 4 ++-- DRAMSys/library/src/common/DebugManager.h | 4 +--- DRAMSys/library/src/common/TlmRecorder.cpp | 6 +++--- .../src/controller/ControllerRecordable.cpp | 6 +++--- DRAMSys/library/src/error/ECC/Word.cpp | 1 + DRAMSys/library/src/error/ECC/Word.h | 5 +---- DRAMSys/library/src/simulation/ReorderBuffer.h | 6 +++--- .../src/simulation/dram/DramRecordable.cpp | 18 +++++++++--------- 10 files changed, 31 insertions(+), 38 deletions(-) diff --git a/DRAMSys/library/src/common/CongenAddressDecoder.cpp b/DRAMSys/library/src/common/CongenAddressDecoder.cpp index fca1ea3b..46613007 100644 --- a/DRAMSys/library/src/common/CongenAddressDecoder.cpp +++ b/DRAMSys/library/src/common/CongenAddressDecoder.cpp @@ -37,14 +37,15 @@ #include "utils.h" #include +#include using std::ifstream; using std::cout; using std::endl; - -#include - using std::set; +using std::pair; +using std::map; +using std::deque; tinyxml2::XMLElement *CongenAddressDecoder::GetXMLNode(tinyxml2::XMLElement *pRoot, std::string strName) diff --git a/DRAMSys/library/src/common/CongenAddressDecoder.h b/DRAMSys/library/src/common/CongenAddressDecoder.h index ed523d9d..85829d9d 100644 --- a/DRAMSys/library/src/common/CongenAddressDecoder.h +++ b/DRAMSys/library/src/common/CongenAddressDecoder.h @@ -43,10 +43,6 @@ #include #include -using std::vector; -using std::pair; -using std::map; - class CongenAddressDecoder : private AddressDecoder { // Friendship needed so that the AddressDecoder can access the @@ -80,13 +76,13 @@ private: m_nByteBits; // Number of Byte bits used by this mapping - vector + std::vector m_vXor; // This container stores for each used xor gate a pair which consists of "First/Number of an address bit which corresponds to a bank" and "Second/Number of an address bit which corresponds to a row" - vector> + std::vector> m_vBankBits; // This container stores for each bank bit a pair which consists of "First/Number of the bank bit" and "Second/Number of the address bit" - vector> + std::vector> m_vRowBits; // This container stores for each row bit a pair which consists of "First/Number of the row bit" and "Second/Number of the address bit" - vector> + std::vector> m_vColumnBits; // This container stores for each column bit a pair which consists of "First/Number of the column bit" and "Second/Number of the address bit" //Methods diff --git a/DRAMSys/library/src/common/DebugManager.cpp b/DRAMSys/library/src/common/DebugManager.cpp index 02c1da73..19d6d6df 100644 --- a/DRAMSys/library/src/common/DebugManager.cpp +++ b/DRAMSys/library/src/common/DebugManager.cpp @@ -36,13 +36,13 @@ #include "DebugManager.h" -#ifdef DEBUGGING +#ifndef NDEBUG #include "../configuration/Configuration.h" void DebugManager::printDebugMessage(std::string sender, std::string message) { - if (Configuration::getInstance().Debug) { + if (Configuration::getInstance().debug) { if (writeToConsole) std::cout << " at " << sc_time_stamp() << "\t in " << sender << "\t: " << message << std::endl; diff --git a/DRAMSys/library/src/common/DebugManager.h b/DRAMSys/library/src/common/DebugManager.h index ca3b1fec..83219115 100644 --- a/DRAMSys/library/src/common/DebugManager.h +++ b/DRAMSys/library/src/common/DebugManager.h @@ -37,9 +37,7 @@ #ifndef DEBUGMANAGER_H #define DEBUGMANAGER_H -//#define DEBUGGING - -#ifndef DEBUGGING +#ifdef NDEBUG #define PRINTDEBUGMESSAGE(sender, message) {} #else #define PRINTDEBUGMESSAGE(sender, message) DebugManager::getInstance().printDebugMessage(sender, message) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index 0258da37..0571eb98 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -153,12 +153,12 @@ void TlmRecorder::introduceTransactionSystem(tlm_generic_payload &trans) currentTransactionsInSystem[&trans].timeOfGeneration = GenerationExtension::getExtension(&trans).TimeOfGeneration(); - PRINTDEBUGMESSAGE(name, "New transaction #" + to_string(id) + " generation time " + + PRINTDEBUGMESSAGE(name, "New transaction #" + std::to_string(id) + " generation time " + currentTransactionsInSystem[&trans].timeOfGeneration.to_string()); if (id % transactionCommitRate == 0) { PRINTDEBUGMESSAGE(name, "Committing transactions " + - to_string(id - transactionCommitRate + 1) + " - " + to_string(id)); + std::to_string(id - transactionCommitRate + 1) + " - " + std::to_string(id)); commitRecordedDataToDB(); } } @@ -168,7 +168,7 @@ void TlmRecorder::removeTransactionFromSystem(tlm_generic_payload &trans) assert(currentTransactionsInSystem.count(&trans) != 0); PRINTDEBUGMESSAGE(name, "Removing transaction #" + - to_string(currentTransactionsInSystem[&trans].id)); + std::to_string(currentTransactionsInSystem[&trans].id)); Transaction &recordingData = currentTransactionsInSystem[&trans]; recordedData.push_back(recordingData); diff --git a/DRAMSys/library/src/controller/ControllerRecordable.cpp b/DRAMSys/library/src/controller/ControllerRecordable.cpp index 7478d6fb..bcfbc836 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.cpp +++ b/DRAMSys/library/src/controller/ControllerRecordable.cpp @@ -81,9 +81,9 @@ void ControllerRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase pha uint64_t id __attribute__((unused)) = DramExtension::getExtension(trans).getPayloadID(); PRINTDEBUGMESSAGE(name(), "Recording " + phaseNameToString(phase) + " thread " + - to_string(thr) + " channel " + to_string(ch) + " bank group " + to_string( - bg) + " bank " + to_string(bank) + " row " + to_string(row) + " column " + - to_string(col) + " id " + to_string(id) + " at " + recTime.to_string()); + std::to_string(thr) + " channel " + std::to_string(ch) + " bank group " + std::to_string( + bg) + " bank " + std::to_string(bank) + " row " + std::to_string(row) + " column " + + std::to_string(col) + " id " + std::to_string(id) + " at " + recTime.to_string()); tlmRecorder->recordPhase(trans, phase, recTime); } diff --git a/DRAMSys/library/src/error/ECC/Word.cpp b/DRAMSys/library/src/error/ECC/Word.cpp index 47794ea0..a59c38e3 100644 --- a/DRAMSys/library/src/error/ECC/Word.cpp +++ b/DRAMSys/library/src/error/ECC/Word.cpp @@ -5,6 +5,7 @@ #include using std::cout; +using std::deque; CWord::CWord(unsigned nBitLength) : m_nBitLength(nBitLength) diff --git a/DRAMSys/library/src/error/ECC/Word.h b/DRAMSys/library/src/error/ECC/Word.h index c3edb1ae..743d7cfe 100644 --- a/DRAMSys/library/src/error/ECC/Word.h +++ b/DRAMSys/library/src/error/ECC/Word.h @@ -3,15 +3,12 @@ #include #include "Bit.h" -using std::deque; - - class CWord { protected: unsigned m_nBitLength; - deque m_word; + std::deque m_word; public: diff --git a/DRAMSys/library/src/simulation/ReorderBuffer.h b/DRAMSys/library/src/simulation/ReorderBuffer.h index ab751054..d2d84077 100644 --- a/DRAMSys/library/src/simulation/ReorderBuffer.h +++ b/DRAMSys/library/src/simulation/ReorderBuffer.h @@ -58,7 +58,7 @@ public: private: tlm_utils::peq_with_cb_and_phase payloadEventQueue; - deque pendingRequestsInOrder; + std::deque pendingRequestsInOrder; std::set receivedResponses; bool responseIsPendingInInitator; @@ -130,8 +130,8 @@ private: { - sc_assert(phase == END_REQ || - (phase == BEGIN_RESP && pendingRequestsInOrder.front() == &payload + sc_assert(phase == tlm::END_REQ || + (phase == tlm::BEGIN_RESP && pendingRequestsInOrder.front() == &payload && receivedResponses.count(&payload))); tlm::tlm_phase TPhase = phase; diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index ecf88f5b..d1a8df14 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -100,9 +100,9 @@ void DramRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID(); PRINTDEBUGMESSAGE(this->name(), "Recording " + phaseNameToString(phase) + " thread " + - to_string(thr) + " channel " + to_string(ch) + " bank group " + to_string( - bg) + " bank " + to_string(bank) + " row " + to_string(row) + " column " + - to_string(col) + " at " + recTime.to_string()); + std::to_string(thr) + " channel " + std::to_string(ch) + " bank group " + std::to_string( + bg) + " bank " + std::to_string(bank) + " row " + std::to_string(row) + " column " + + std::to_string(col) + " at " + recTime.to_string()); tlmRecorder->recordPhase(trans, phase, recTime); @@ -139,12 +139,12 @@ void DramRecordable::powerWindow() * Configuration::getInstance().numberOfDevicesOnDIMM); // Here considering that DRAMPower provides the energy in pJ and the power in mW - PRINTDEBUGMESSAGE(this->name(), string("\tWindow Energy: \t") + to_string( - DRAMPower->getEnergy().window_energy * - Configuration::getInstance().numberOfDevicesOnDIMM) + string("\t[pJ]")); - PRINTDEBUGMESSAGE(this->name(), string("\tWindow Average Power: \t") + to_string( - DRAMPower->getPower().window_average_power * - Configuration::getInstance().numberOfDevicesOnDIMM) + string("\t[mW]")); + PRINTDEBUGMESSAGE(this->name(), std::string("\tWindow Energy: \t") + std::to_string( + this->DRAMPower->getEnergy().window_energy * + Configuration::getInstance().numberOfDevicesOnDIMM) + std::string("\t[pJ]")); + PRINTDEBUGMESSAGE(this->name(), std::string("\tWindow Average Power: \t") + std::to_string( + this->DRAMPower->getPower().window_average_power * + Configuration::getInstance().numberOfDevicesOnDIMM) + std::string("\t[mW]")); } while (true); }