From 14b93bd145d5ffce16038ad68783f860fd4812a4 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 9 Jun 2020 16:06:27 +0200 Subject: [PATCH] Adapt PCT project to new recording structure. --- DRAMSys/library/src/common/TlmRecorder.cpp | 3 +-- DRAMSys/library/src/common/utils.cpp | 7 +++++++ DRAMSys/library/src/common/utils.h | 2 ++ DRAMSys/library/src/controller/Controller.cpp | 2 +- .../src/controller/ControllerRecordable.cpp | 2 +- DRAMSys/library/src/simulation/Arbiter.cpp | 4 ++-- DRAMSys/library/src/simulation/DRAMSys.cpp | 6 ++++++ DRAMSys/library/src/simulation/DRAMSys.h | 3 +-- .../src/simulation/dram/DramRecordable.cpp | 2 +- DRAMSys/pct/createPlatform.tcl | 5 +++-- DRAMSys/pct/dummy.h | 17 +++++++++++++---- 11 files changed, 38 insertions(+), 15 deletions(-) diff --git a/DRAMSys/library/src/common/TlmRecorder.cpp b/DRAMSys/library/src/common/TlmRecorder.cpp index ffa604b6..a15789f2 100644 --- a/DRAMSys/library/src/common/TlmRecorder.cpp +++ b/DRAMSys/library/src/common/TlmRecorder.cpp @@ -95,8 +95,7 @@ void TlmRecorder::recordPhase(tlm_generic_payload &trans, if (currentTransactionsInSystem.count(&trans) == 0) introduceTransactionSystem(trans); - //std::string phaseName = phaseNameToString(phase); - std::string phaseName = phase.get_name(); + std::string phaseName = getPhaseName(phase); std::string phaseBeginPrefix = "BEGIN_"; std::string phaseEndPrefix = "END_"; diff --git a/DRAMSys/library/src/common/utils.cpp b/DRAMSys/library/src/common/utils.cpp index 65999dc0..6918ab16 100644 --- a/DRAMSys/library/src/common/utils.cpp +++ b/DRAMSys/library/src/common/utils.cpp @@ -65,6 +65,13 @@ sc_time TimeInterval::getLength() return start - end; } +std::string getPhaseName(tlm_phase phase) +{ + std::ostringstream oss; + oss << phase; + return oss.str(); +} + json parseJSON(std::string path) { try diff --git a/DRAMSys/library/src/common/utils.h b/DRAMSys/library/src/common/utils.h index 0e52b291..47318b60 100644 --- a/DRAMSys/library/src/common/utils.h +++ b/DRAMSys/library/src/common/utils.h @@ -102,6 +102,8 @@ static inline void loadbar(unsigned int x, std::cout << "|\r" << std::flush; } +std::string getPhaseName(tlm::tlm_phase phase); + nlohmann::json parseJSON(std::string path); bool parseBool(nlohmann::json &obj, std::string name); unsigned int parseUint(nlohmann::json &obj, std::string name); diff --git a/DRAMSys/library/src/controller/Controller.cpp b/DRAMSys/library/src/controller/Controller.cpp index 6a0a4f0e..137aa3db 100644 --- a/DRAMSys/library/src/controller/Controller.cpp +++ b/DRAMSys/library/src/controller/Controller.cpp @@ -349,7 +349,7 @@ tlm_sync_enum Controller::nb_transport_fw(tlm_generic_payload &trans, else SC_REPORT_FATAL("Controller", "nb_transport_fw in controller was triggered with unknown phase"); - PRINTDEBUGMESSAGE(name(), "[fw] " + std::string(phase.get_name()) + " notification in " + + PRINTDEBUGMESSAGE(name(), "[fw] " + getPhaseName(phase) + " notification in " + notificationDelay.to_string()); return TLM_ACCEPTED; diff --git a/DRAMSys/library/src/controller/ControllerRecordable.cpp b/DRAMSys/library/src/controller/ControllerRecordable.cpp index e4a36e61..5c155e34 100644 --- a/DRAMSys/library/src/controller/ControllerRecordable.cpp +++ b/DRAMSys/library/src/controller/ControllerRecordable.cpp @@ -80,7 +80,7 @@ void ControllerRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase pha unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID(); uint64_t id __attribute__((unused)) = DramExtension::getExtension(trans).getPayloadID(); - PRINTDEBUGMESSAGE(name(), "Recording " + std::string(phase.get_name()) + " thread " + + PRINTDEBUGMESSAGE(name(), "Recording " + getPhaseName(phase) + " thread " + 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()); diff --git a/DRAMSys/library/src/simulation/Arbiter.cpp b/DRAMSys/library/src/simulation/Arbiter.cpp index 743ea18d..098c6013 100644 --- a/DRAMSys/library/src/simulation/Arbiter.cpp +++ b/DRAMSys/library/src/simulation/Arbiter.cpp @@ -93,7 +93,7 @@ tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload, notDelay += Configuration::getInstance().memSpec->tCK; } - PRINTDEBUGMESSAGE(name(), "[fw] " + std::string(phase.get_name()) + " notification in " + + PRINTDEBUGMESSAGE(name(), "[fw] " + getPhaseName(phase) + " notification in " + notDelay.to_string()); payloadEventQueue.notify(payload, phase, notDelay); return TLM_ACCEPTED; @@ -107,7 +107,7 @@ tlm_sync_enum Arbiter::nb_transport_bw(int channelId, tlm_generic_payload &paylo // Check channel ID assert((unsigned int)channelId == DramExtension::getExtension(payload).getChannel().ID()); - PRINTDEBUGMESSAGE(name(), "[bw] " + std::string(phase.get_name()) + " notification in " + + PRINTDEBUGMESSAGE(name(), "[bw] " + getPhaseName(phase) + " notification in " + bwDelay.to_string()); payloadEventQueue.notify(payload, phase, bwDelay); return TLM_ACCEPTED; diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index fa119ed2..b210438d 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -60,6 +60,12 @@ #include "dram/DramGDDR6.h" #include "../controller/Controller.h" +DRAMSys::DRAMSys(sc_module_name name, + std::string simulationToRun, + std::string pathToResources) + : DRAMSys(name, simulationToRun, pathToResources, true) +{} + DRAMSys::DRAMSys(sc_module_name name, std::string simulationToRun, std::string pathToResources, diff --git a/DRAMSys/library/src/simulation/DRAMSys.h b/DRAMSys/library/src/simulation/DRAMSys.h index 34f47091..4738a4fb 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.h +++ b/DRAMSys/library/src/simulation/DRAMSys.h @@ -63,8 +63,7 @@ public: SC_HAS_PROCESS(DRAMSys); DRAMSys(sc_module_name name, std::string simulationToRun, - std::string pathToResources) - : DRAMSys(name, simulationToRun, pathToResources, true) {} + std::string pathToResources); virtual ~DRAMSys(); diff --git a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp index 67830919..c2319ddb 100644 --- a/DRAMSys/library/src/simulation/dram/DramRecordable.cpp +++ b/DRAMSys/library/src/simulation/dram/DramRecordable.cpp @@ -95,7 +95,7 @@ void DramRecordable::recordPhase(tlm_generic_payload &trans, tlm_phase unsigned int row __attribute__((unused)) = DramExtension::getExtension(trans).getRow().ID(); unsigned int col __attribute__((unused)) = DramExtension::getExtension(trans).getColumn().ID(); - PRINTDEBUGMESSAGE(this->name(), "Recording " + std::string(phase.get_name()) + " thread " + + PRINTDEBUGMESSAGE(this->name(), "Recording " + getPhaseName(phase) + " thread " + 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()); diff --git a/DRAMSys/pct/createPlatform.tcl b/DRAMSys/pct/createPlatform.tcl index d6a1c661..fd567c82 100644 --- a/DRAMSys/pct/createPlatform.tcl +++ b/DRAMSys/pct/createPlatform.tcl @@ -44,7 +44,8 @@ ::pct::set_dynamic_port_arrays_flag true ::pct::set_import_scml_properties_flag true ::pct::load_all_modules "--set-category" "dummy.h" -::pct::create_instance Project:DRAMSys /HARDWARE i_DRAMSys DRAMSys {DRAMSys(simulationToRun, pathToResources)} +#::pct::create_instance Project:DRAMSys /HARDWARE i_DRAMSys DRAMSys {DRAMSys(simulationToRun, pathToResources)} +::pct::create_instance Project:DRAMSysRecordable /HARDWARE i_DRAMSys DRAMSysRecordable {DRAMSysRecordable(simulationToRun, pathToResources)} # Add DRAMSys Library // ../[glob -type d ../../build*]/simulator/ ::pct::set_simulation_build_project_setting Debug Libraries "sqlite3 DRAMSysLibrary DRAMPower" @@ -61,7 +62,7 @@ # Configure DDR3 Example: ::pct::set_param_value /HARDWARE/i_DRAMSys {Constructor Arguments} pathToResources ../../library/resources/ -::pct::set_param_value /HARDWARE/i_DRAMSys {Constructor Arguments} simulationToRun ../../library/resources/simulations/ddr3-example.xml +::pct::set_param_value /HARDWARE/i_DRAMSys {Constructor Arguments} simulationToRun ../../library/resources/simulations/ddr3-example.json # Build Rest of the Example system: ::pct::open_library "GFRBM" diff --git a/DRAMSys/pct/dummy.h b/DRAMSys/pct/dummy.h index cd199d30..d4ad3fbc 100644 --- a/DRAMSys/pct/dummy.h +++ b/DRAMSys/pct/dummy.h @@ -31,10 +31,11 @@ * * Authors: * Matthias Jung + * Lukas Steiner */ -#ifndef DRAMSYS_H_ -#define DRAMSYS_H_ +#ifndef DUMMY_H +#define DUMMY_H #include #include @@ -48,7 +49,7 @@ * real module... */ -class DRAMSys: public sc_module +class DRAMSys : public sc_module { public: tlm_utils::multi_passthrough_target_socket tSocket; @@ -61,5 +62,13 @@ public: string pathToResources); }; -#endif /* SIMULATIONMANAGER_H_ */ +class DRAMSysRecordable : public DRAMSys +{ +public: + DRAMSysRecordable(sc_module_name name, + std::string simulationToRun, + std::string pathToResources); +}; + +#endif // DUMMY_H