From 7a993cad5fca09dfc4213072b6b10699aa667e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Thu, 28 Jan 2016 12:12:34 -0200 Subject: [PATCH] Debugs improved - generating messages for every recorded phase (tlmRecorder->recordPhase()) --- DRAMSys/simulator/src/common/TlmRecorder.cpp | 16 ++++++++-- DRAMSys/simulator/src/controller/Controller.h | 32 ++++++++++++++----- DRAMSys/simulator/src/simulation/Arbiter.h | 14 ++++++-- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/DRAMSys/simulator/src/common/TlmRecorder.cpp b/DRAMSys/simulator/src/common/TlmRecorder.cpp index 4b30a748..d7e2ef6f 100644 --- a/DRAMSys/simulator/src/common/TlmRecorder.cpp +++ b/DRAMSys/simulator/src/common/TlmRecorder.cpp @@ -141,6 +141,8 @@ void TlmRecorder::introduceTransactionSystem(tlm::tlm_generic_payload& trans) else currentTransactionsInSystem[&trans].timeOfGeneration = GenerationExtension::getExtension(&trans).TimeOfGeneration(); + printDebugMessage("New transaction #" + to_string(id + 1) + " generation time " + currentTransactionsInSystem[&trans].timeOfGeneration.to_string()); + if (id % transactionCommitRate == 0) { printDebugMessage( @@ -154,6 +156,8 @@ void TlmRecorder::removeTransactionFromSystem(tlm::tlm_generic_payload& trans) { assert(currentTransactionsInSystem.count(&trans) != 0); + printDebugMessage("Removing transaction #" + to_string(currentTransactionsInSystem[&trans].id + 1)); + Transaction& recordingData = currentTransactionsInSystem[&trans]; recordedData.push_back(recordingData); currentTransactionsInSystem.erase(&trans); @@ -226,13 +230,21 @@ void TlmRecorder::createTables(string pathToURI) void TlmRecorder::setUpTransactionTerminatingPhases() { transactionTerminatingPhases.push_back(tlm::END_RESP); + + // Refresh All transactionTerminatingPhases.push_back(static_cast(END_REFA)); + + // Refresh Bank transactionTerminatingPhases.push_back(static_cast(END_REFB)); - transactionTerminatingPhases.push_back(static_cast(END_PDNP)); + + // Phases for Power Down transactionTerminatingPhases.push_back(static_cast(END_PDNA)); + transactionTerminatingPhases.push_back(static_cast(END_PDNP)); transactionTerminatingPhases.push_back(static_cast(END_SREF)); - transactionTerminatingPhases.push_back(static_cast(END_PDNPB)); + + // Phases for Power Down Bankwise transactionTerminatingPhases.push_back(static_cast(END_PDNAB)); + transactionTerminatingPhases.push_back(static_cast(END_PDNPB)); transactionTerminatingPhases.push_back(static_cast(END_SREFB)); } diff --git a/DRAMSys/simulator/src/controller/Controller.h b/DRAMSys/simulator/src/controller/Controller.h index 2ac9e200..e3f11ff5 100644 --- a/DRAMSys/simulator/src/controller/Controller.h +++ b/DRAMSys/simulator/src/controller/Controller.h @@ -342,17 +342,27 @@ void Controller::controllerCorePEQCallback(tlm_generic_payload &payloa template tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &fwDelay) { + sc_time recTime; + sc_time notDelay; if (phase == BEGIN_REQ) { - tlmRecorder->recordPhase(payload, phase, fwDelay + sc_time_stamp()); - frontendPEQ.notify(payload, phase, - clkAlign(sc_time_stamp() + fwDelay) - (sc_time_stamp() + fwDelay) + Configuration::getInstance().memSpec.clk); + recTime = fwDelay + sc_time_stamp(); + notDelay = clkAlign(sc_time_stamp() + fwDelay) - (sc_time_stamp() + fwDelay) + Configuration::getInstance().memSpec.clk; + + printDebugMessage("[fw] Recording " + phaseNameToString(phase) + " at " + recTime.to_string() + " notification in " + notDelay.to_string()); + + tlmRecorder->recordPhase(payload, phase, recTime); + frontendPEQ.notify(payload, phase, notDelay); } else if (phase == END_RESP) { - tlmRecorder->recordPhase(payload, phase, - fwDelay + sc_time_stamp() + Configuration::getInstance().memSpec.clk); - frontendPEQ.notify(payload, phase, clkAlign(sc_time_stamp() + fwDelay) - (sc_time_stamp() + fwDelay)); + recTime = fwDelay + sc_time_stamp() + Configuration::getInstance().memSpec.clk; + notDelay = clkAlign(sc_time_stamp() + fwDelay) - (sc_time_stamp() + fwDelay); + + printDebugMessage("[fw] Recording " + phaseNameToString(phase) + " at " + recTime.to_string() + " notification in " + notDelay.to_string()); + + tlmRecorder->recordPhase(payload, phase, recTime); + frontendPEQ.notify(payload, phase, notDelay); } return TLM_ACCEPTED; } @@ -478,8 +488,14 @@ void Controller::sendToFrontend(tlm_generic_payload &payload, const tl template tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay) { - dramPEQ.notify(payload, phase, bwDelay); - tlmRecorder->recordPhase(payload, phase, bwDelay + sc_time_stamp()); + sc_time recTime = bwDelay + sc_time_stamp(); + sc_time notDelay = bwDelay; + + printDebugMessage("[bw] Recording " + phaseNameToString(phase) + " at " + recTime.to_string() + " notification in " + notDelay.to_string()); + + dramPEQ.notify(payload, phase, notDelay); + tlmRecorder->recordPhase(payload, phase, recTime); + return TLM_ACCEPTED; } diff --git a/DRAMSys/simulator/src/simulation/Arbiter.h b/DRAMSys/simulator/src/simulation/Arbiter.h index 6aed14e6..5e190451 100644 --- a/DRAMSys/simulator/src/simulation/Arbiter.h +++ b/DRAMSys/simulator/src/simulation/Arbiter.h @@ -104,8 +104,13 @@ private: // This function is called when an arbiter's initiator socket receives a transaction from a memory controller tlm_sync_enum nb_transport_bw(int channelId, tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay) { - tlmRecorders[channelId]->recordPhase(payload, phase, bwDelay + sc_time_stamp()); - payloadEventQueue.notify(payload, phase, bwDelay); + sc_time recTime = bwDelay + sc_time_stamp(); + sc_time notDelay = bwDelay; + + printDebugMessage("[bw] Recording " + phaseNameToString(phase) + " at " + recTime.to_string() + " notification in " + notDelay.to_string()); + + tlmRecorders[channelId]->recordPhase(payload, phase, recTime); + payloadEventQueue.notify(payload, phase, notDelay); return TLM_ACCEPTED; } @@ -210,6 +215,11 @@ private: DramExtension* extension = new DramExtension(Thread(socketId+1), Channel(decodedAddress.channel), Bank(decodedAddress.bank), BankGroup(decodedAddress.bankgroup), Row(decodedAddress.row), Column(decodedAddress.column),burstlength); payload.set_auto_extension(extension); } + + void printDebugMessage(std::string message) + { + DebugManager::getInstance().printDebugMessage(this->name(), message); + } }; #endif /* ARBITER_H_ */