From ef8b8ff7c77829789b3be7b10dc5e5bd290d09ba Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 2 Jun 2020 14:02:08 +0200 Subject: [PATCH] Moved trace player files from library to simulator. --- DRAMSys/library/CMakeLists.txt | 7 -- DRAMSys/library/src/simulation/DRAMSys.cpp | 90 ++++++++----------- DRAMSys/library/src/simulation/DRAMSys.h | 1 - .../library/src/simulation/ReorderBuffer.h | 8 +- DRAMSys/simulator/CMakeLists.txt | 14 ++- .../ExampleInitiator.h | 9 +- .../MemoryManager.cpp | 4 +- .../simulation => simulator}/MemoryManager.h | 0 .../src/simulation => simulator}/StlPlayer.h | 0 .../simulation => simulator}/TraceGenerator.h | 0 .../simulation => simulator}/TracePlayer.cpp | 0 .../simulation => simulator}/TracePlayer.h | 4 +- .../TracePlayerListener.h | 0 .../simulation => simulator}/TraceSetup.cpp | 0 .../src/simulation => simulator}/TraceSetup.h | 2 +- DRAMSys/simulator/main.cpp | 2 +- 16 files changed, 63 insertions(+), 78 deletions(-) rename DRAMSys/{library/src/simulation => simulator}/ExampleInitiator.h (97%) rename DRAMSys/{library/src/simulation => simulator}/MemoryManager.cpp (97%) rename DRAMSys/{library/src/simulation => simulator}/MemoryManager.h (100%) rename DRAMSys/{library/src/simulation => simulator}/StlPlayer.h (100%) rename DRAMSys/{library/src/simulation => simulator}/TraceGenerator.h (100%) rename DRAMSys/{library/src/simulation => simulator}/TracePlayer.cpp (100%) rename DRAMSys/{library/src/simulation => simulator}/TracePlayer.h (97%) rename DRAMSys/{library/src/simulation => simulator}/TracePlayerListener.h (100%) rename DRAMSys/{library/src/simulation => simulator}/TraceSetup.cpp (100%) rename DRAMSys/{library/src/simulation => simulator}/TraceSetup.h (98%) diff --git a/DRAMSys/library/CMakeLists.txt b/DRAMSys/library/CMakeLists.txt index d33f0260..816577f4 100644 --- a/DRAMSys/library/CMakeLists.txt +++ b/DRAMSys/library/CMakeLists.txt @@ -153,15 +153,8 @@ add_library(DRAMSysLibrary src/simulation/Arbiter.cpp src/simulation/DRAMSys.cpp - src/simulation/ExampleInitiator.h - src/simulation/MemoryManager.cpp src/simulation/ReorderBuffer.h - src/simulation/StlPlayer.h src/simulation/TemperatureController.cpp - src/simulation/TraceGenerator.h - src/simulation/TracePlayer.cpp - src/simulation/TracePlayerListener.h - src/simulation/TraceSetup.cpp src/simulation/dram/Dram.cpp src/simulation/dram/DramRecordable.cpp diff --git a/DRAMSys/library/src/simulation/DRAMSys.cpp b/DRAMSys/library/src/simulation/DRAMSys.cpp index 141a185b..479f3521 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.cpp +++ b/DRAMSys/library/src/simulation/DRAMSys.cpp @@ -193,8 +193,7 @@ void DRAMSys::instantiateModules(const std::string &traceName, // Create and properly initialize TLM recorders. // They need to be ready before creating some modules. - bool recordingEnabled = Configuration::getInstance().databaseRecording; - if (recordingEnabled) + if (Configuration::getInstance().databaseRecording) setupTlmRecorders(traceName, pathToResources); // Create new ECC Controller @@ -218,7 +217,7 @@ void DRAMSys::instantiateModules(const std::string &traceName, std::string str = "controller" + std::to_string(i); ControllerIF *controller; - if (recordingEnabled) + if (Configuration::getInstance().databaseRecording) controller = new ControllerRecordable(str.c_str(), tlmRecorders[i]); else controller = new Controller(str.c_str()); @@ -227,71 +226,52 @@ void DRAMSys::instantiateModules(const std::string &traceName, str = "dram" + std::to_string(i); Dram *dram; - if (memoryType == "DDR3") + if (Configuration::getInstance().databaseRecording) { - if (recordingEnabled) + if (memoryType == "DDR3") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramDDR3(str.c_str()); - } - else if (memoryType == "WIDEIO_SDR") - { - if (recordingEnabled) + else if (memoryType == "WIDEIO_SDR") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramWideIO(str.c_str()); - } - else if (memoryType == "DDR4") - { - if (recordingEnabled) + else if (memoryType == "DDR4") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramDDR4(str.c_str()); - } - else if (memoryType == "LPDDR4") - { - if (recordingEnabled) + else if (memoryType == "LPDDR4") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramLPDDR4(str.c_str()); - } - else if (memoryType == "WIDEIO2") - { - if (recordingEnabled) + else if (memoryType == "WIDEIO2") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramWideIO2(str.c_str()); - } - else if (memoryType == "HBM2") - { - if (recordingEnabled) + else if (memoryType == "HBM2") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramHBM2(str.c_str()); - } - else if (memoryType == "GDDR5") - { - if (recordingEnabled) + else if (memoryType == "GDDR5") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramGDDR5(str.c_str()); - } - else if (memoryType == "GDDR5X") - { - if (recordingEnabled) + else if (memoryType == "GDDR5X") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); - else - dram = new DramGDDR5X(str.c_str()); - } - else if (memoryType == "GDDR6") - { - if (recordingEnabled) + else if (memoryType == "GDDR6") dram = new DramRecordable(str.c_str(), tlmRecorders[i]); else - dram = new DramGDDR6(str.c_str()); + SC_REPORT_FATAL("DRAMSys", "Unsupported DRAM type"); } else - SC_REPORT_FATAL("DRAMSys", "Unsupported DRAM type"); + { + if (memoryType == "DDR3") + dram = new DramDDR3(str.c_str()); + else if (memoryType == "WIDEIO_SDR") + dram = new DramWideIO(str.c_str()); + else if (memoryType == "DDR4") + dram = new DramDDR4(str.c_str()); + else if (memoryType == "LPDDR4") + dram = new DramLPDDR4(str.c_str()); + else if (memoryType == "WIDEIO2") + dram = new DramWideIO2(str.c_str()); + else if (memoryType == "HBM2") + dram = new DramHBM2(str.c_str()); + else if (memoryType == "GDDR5") + dram = new DramGDDR5(str.c_str()); + else if (memoryType == "GDDR5X") + dram = new DramGDDR5X(str.c_str()); + else if (memoryType == "GDDR6") + dram = new DramGDDR6(str.c_str()); + else + SC_REPORT_FATAL("DRAMSys", "Unsupported DRAM type"); + } drams.push_back(dram); diff --git a/DRAMSys/library/src/simulation/DRAMSys.h b/DRAMSys/library/src/simulation/DRAMSys.h index 841dd22b..b6d113f1 100644 --- a/DRAMSys/library/src/simulation/DRAMSys.h +++ b/DRAMSys/library/src/simulation/DRAMSys.h @@ -44,7 +44,6 @@ #include "dram/Dram.h" #include "Arbiter.h" -#include "TraceGenerator.h" #include "ReorderBuffer.h" #include #include diff --git a/DRAMSys/library/src/simulation/ReorderBuffer.h b/DRAMSys/library/src/simulation/ReorderBuffer.h index d2d84077..bb0b925e 100644 --- a/DRAMSys/library/src/simulation/ReorderBuffer.h +++ b/DRAMSys/library/src/simulation/ReorderBuffer.h @@ -39,11 +39,15 @@ #define REORDERBUFFER_H #include +#include #include #include -#include +#include +#include +#include -struct ReorderBuffer: public sc_module { +struct ReorderBuffer : public sc_module +{ public: tlm_utils::simple_initiator_socket iSocket; tlm_utils::simple_target_socket tSocket; diff --git a/DRAMSys/simulator/CMakeLists.txt b/DRAMSys/simulator/CMakeLists.txt index 034efaf5..52549fa6 100644 --- a/DRAMSys/simulator/CMakeLists.txt +++ b/DRAMSys/simulator/CMakeLists.txt @@ -39,10 +39,20 @@ project(DRAMSysSimulator) set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ Version") set(DCMAKE_SH="CMAKE_SH-NOTFOUND") -add_executable(DRAMSys main.cpp) +add_executable(DRAMSys + main.cpp + ExampleInitiator.h + MemoryManager.cpp + StlPlayer.h + TraceGenerator.h + TracePlayer.cpp + TracePlayerListener.h + TraceSetup.cpp) + target_include_directories(DRAMSys - PUBLIC ../library/src/simulation/ + PUBLIC ../library/src/ ) + target_link_libraries(DRAMSys ${SYSTEMC_LIBRARY} DRAMSysLibrary diff --git a/DRAMSys/library/src/simulation/ExampleInitiator.h b/DRAMSys/simulator/ExampleInitiator.h similarity index 97% rename from DRAMSys/library/src/simulation/ExampleInitiator.h rename to DRAMSys/simulator/ExampleInitiator.h index 1e0bbcd5..b3e3845f 100644 --- a/DRAMSys/library/src/simulation/ExampleInitiator.h +++ b/DRAMSys/simulator/ExampleInitiator.h @@ -5,7 +5,7 @@ #include #include "MemoryManager.h" -#include "../common/dramExtensions.h" +#include "common/dramExtensions.h" #include "TracePlayer.h" struct ExampleInitiator : sc_module @@ -14,12 +14,11 @@ struct ExampleInitiator : sc_module tlm_utils::simple_initiator_socket socket; SC_CTOR(ExampleInitiator) - : socket("socket") // Construct and name socket - , request_in_progress(0) - , m_peq(this, &ExampleInitiator::peq_cb) + : socket("socket"), + request_in_progress(0), + m_peq(this, &ExampleInitiator::peq_cb) { socket.register_nb_transport_bw(this, &ExampleInitiator::nb_transport_bw); - SC_THREAD(thread_process); } diff --git a/DRAMSys/library/src/simulation/MemoryManager.cpp b/DRAMSys/simulator/MemoryManager.cpp similarity index 97% rename from DRAMSys/library/src/simulation/MemoryManager.cpp rename to DRAMSys/simulator/MemoryManager.cpp index dad4e044..6a73026b 100644 --- a/DRAMSys/library/src/simulation/MemoryManager.cpp +++ b/DRAMSys/simulator/MemoryManager.cpp @@ -35,8 +35,8 @@ */ #include "MemoryManager.h" -#include "../common/DebugManager.h" -#include "../configuration/Configuration.h" +#include "common/DebugManager.h" +#include "configuration/Configuration.h" #include using namespace tlm; diff --git a/DRAMSys/library/src/simulation/MemoryManager.h b/DRAMSys/simulator/MemoryManager.h similarity index 100% rename from DRAMSys/library/src/simulation/MemoryManager.h rename to DRAMSys/simulator/MemoryManager.h diff --git a/DRAMSys/library/src/simulation/StlPlayer.h b/DRAMSys/simulator/StlPlayer.h similarity index 100% rename from DRAMSys/library/src/simulation/StlPlayer.h rename to DRAMSys/simulator/StlPlayer.h diff --git a/DRAMSys/library/src/simulation/TraceGenerator.h b/DRAMSys/simulator/TraceGenerator.h similarity index 100% rename from DRAMSys/library/src/simulation/TraceGenerator.h rename to DRAMSys/simulator/TraceGenerator.h diff --git a/DRAMSys/library/src/simulation/TracePlayer.cpp b/DRAMSys/simulator/TracePlayer.cpp similarity index 100% rename from DRAMSys/library/src/simulation/TracePlayer.cpp rename to DRAMSys/simulator/TracePlayer.cpp diff --git a/DRAMSys/library/src/simulation/TracePlayer.h b/DRAMSys/simulator/TracePlayer.h similarity index 97% rename from DRAMSys/library/src/simulation/TracePlayer.h rename to DRAMSys/simulator/TracePlayer.h index d87e747b..445f8c29 100644 --- a/DRAMSys/library/src/simulation/TracePlayer.h +++ b/DRAMSys/simulator/TracePlayer.h @@ -47,8 +47,8 @@ #include #include #include "MemoryManager.h" -#include "../configuration/Configuration.h" -#include "../common/DebugManager.h" +#include "configuration/Configuration.h" +#include "common/DebugManager.h" #include "TracePlayerListener.h" struct TracePlayer : public sc_module diff --git a/DRAMSys/library/src/simulation/TracePlayerListener.h b/DRAMSys/simulator/TracePlayerListener.h similarity index 100% rename from DRAMSys/library/src/simulation/TracePlayerListener.h rename to DRAMSys/simulator/TracePlayerListener.h diff --git a/DRAMSys/library/src/simulation/TraceSetup.cpp b/DRAMSys/simulator/TraceSetup.cpp similarity index 100% rename from DRAMSys/library/src/simulation/TraceSetup.cpp rename to DRAMSys/simulator/TraceSetup.cpp diff --git a/DRAMSys/library/src/simulation/TraceSetup.h b/DRAMSys/simulator/TraceSetup.h similarity index 98% rename from DRAMSys/library/src/simulation/TraceSetup.h rename to DRAMSys/simulator/TraceSetup.h index a65ae1f2..a8f5fb4a 100644 --- a/DRAMSys/library/src/simulation/TraceSetup.h +++ b/DRAMSys/simulator/TraceSetup.h @@ -39,7 +39,7 @@ #include #include -#include "../common/utils.h" +#include "common/utils.h" #include "TracePlayer.h" #include "StlPlayer.h" diff --git a/DRAMSys/simulator/main.cpp b/DRAMSys/simulator/main.cpp index e865fa05..15c25f94 100644 --- a/DRAMSys/simulator/main.cpp +++ b/DRAMSys/simulator/main.cpp @@ -42,7 +42,7 @@ #include #include -#include "DRAMSys.h" +#include "simulation/DRAMSys.h" #include "TraceSetup.h" std::string resources;