Fix Trace Analyzer cmake.

This commit is contained in:
Lukas Steiner
2023-02-22 17:11:17 +01:00
parent fe08c833c8
commit e848d776cc
8 changed files with 33 additions and 43 deletions

View File

@@ -42,7 +42,6 @@ project(TraceAnalyzer)
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp)
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
#file(GLOB_RECURSE UI_FILES CONFIGURE_DEPENDS *.ui)
# Add Python3 Dependency:
find_package(Python3 COMPONENTS Development)

View File

@@ -19,6 +19,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER lib)
### Compile options ###
# refer to https://www.sqlite.org/compile.html
target_compile_definitions(${PROJECT_NAME} PUBLIC SQLITE_ENABLE_RTREE)
target_compile_definitions(${PROJECT_NAME} PUBLIC SQLITE_ENABLE_RTREE SQLITE_OMIT_LOAD_EXTENSION)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

View File

@@ -42,10 +42,6 @@ set(DCMAKE_SH="CMAKE_SH-NOTFOUND")
find_library(GEM5_LIBRARY gem5_${GEM5_VARIANT} PATHS $ENV{GEM5}/build/${GEM5_ISA}/)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../library/src/simulation/DRAMSysRecordable.cpp)
add_definitions(-DRECORDING)
endif()
add_executable(DRAMSys_gem5
main.cpp
$ENV{GEM5}/util/systemc/gem5_within_systemc/sc_logger.cc

View File

@@ -52,10 +52,7 @@
#include "Configuration.h"
#include "simulation/DRAMSys.h"
#ifdef RECORDING
#include "simulation/DRAMSysRecordable.h"
#endif
using namespace sc_core;
using namespace tlm;
@@ -167,11 +164,9 @@ int sc_main(int argc, char **argv)
// Instantiate DRAMSys:
std::unique_ptr<DRAMSys> dramSys;
#ifdef RECORDING
if (configLib.simConfig.databaseRecording.value_or(false))
dramSys = std::make_unique<DRAMSysRecordable>("DRAMSys", configLib);
else
#endif
dramSys = std::make_unique<DRAMSys>("DRAMSys", configLib);
// Instantiate gem5:

View File

@@ -62,10 +62,10 @@
#include <memory>
using namespace sc_core;
namespace DRAMSys {
DRAMSysRecordable::DRAMSysRecordable(const sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib)
: DRAMSys(name, configLib, false)
DRAMSysRecordable::DRAMSysRecordable(const sc_core::sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib)
: DRAMSys(name, configLib, false)
{
// If a simulation file is passed as argument to DRAMSys the simulation ID
// is prepended to the simulation name if found.
@@ -89,15 +89,16 @@ void DRAMSysRecordable::end_of_simulation()
// Report power before TLM recorders are finalized
if (config.powerAnalysis)
{
for (auto& dram : drams)
for (auto& dram: drams)
dram->reportPower();
}
for (auto& tlmRecorder : tlmRecorders)
for (auto& tlmRecorder: tlmRecorders)
tlmRecorder.finalize();
}
void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib)
void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName,
const ::DRAMSys::Config::Configuration& configLib)
{
// Create TLM Recorders, one per channel.
// Reserve is required because the recorders use double buffers that are accessed with pointers.
@@ -116,8 +117,8 @@ void DRAMSysRecordable::setupTlmRecorders(const std::string& traceName, const ::
}
}
void DRAMSysRecordable::instantiateModules(const std::string &traceName,
const ::DRAMSys::Config::Configuration &configLib)
void DRAMSysRecordable::instantiateModules(const std::string& traceName,
const ::DRAMSys::Config::Configuration& configLib)
{
addressDecoder = std::make_unique<AddressDecoder>(config, configLib.addressMapping);
addressDecoder->print();
@@ -143,34 +144,34 @@ void DRAMSysRecordable::instantiateModules(const std::string &traceName,
if (memoryType == MemSpec::MemoryType::DDR3)
drams.emplace_back(std::make_unique<DramRecordable<DramDDR3>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::DDR4)
drams.emplace_back(std::make_unique<DramRecordable<DramDDR4>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::WideIO)
drams.emplace_back(std::make_unique<DramRecordable<DramWideIO>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::LPDDR4)
drams.emplace_back(std::make_unique<DramRecordable<DramLPDDR4>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::WideIO2)
drams.emplace_back(std::make_unique<DramRecordable<DramWideIO2>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::HBM2)
drams.emplace_back(std::make_unique<DramRecordable<DramHBM2>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::GDDR5)
drams.emplace_back(std::make_unique<DramRecordable<DramGDDR5>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::GDDR5X)
drams.emplace_back(std::make_unique<DramRecordable<DramGDDR5X>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::GDDR6)
drams.emplace_back(std::make_unique<DramRecordable<DramGDDR6>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
else if (memoryType == MemSpec::MemoryType::STTMRAM)
drams.emplace_back(std::make_unique<DramRecordable<DramSTTMRAM>>(("dram" + std::to_string(i)).c_str(),
config, tlmRecorders[i]));
config, tlmRecorders[i]));
#ifdef DDR5_SIM
else if (memoryType == MemSpec::MemoryType::DDR5)
drams.emplace_back(std::make_unique<DramRecordable<DramDDR5>>(("dram" + std::to_string(i)).c_str(),
@@ -189,6 +190,8 @@ void DRAMSysRecordable::instantiateModules(const std::string &traceName,
if (config.checkTLM2Protocol)
controllersTlmCheckers.emplace_back(std::make_unique<tlm_utils::tlm2_base_protocol_checker<>>
(("TLMCheckerController" + std::to_string(i)).c_str()));
(("TLMCheckerController" + std::to_string(i)).c_str()));
}
}
}

View File

@@ -42,10 +42,12 @@
#include "DRAMSys/config/DRAMSysConfiguration.h"
class DRAMSysRecordable : public DRAMSys::DRAMSys
namespace DRAMSys {
class DRAMSysRecordable : public DRAMSys
{
public:
DRAMSysRecordable(const sc_core::sc_module_name &name, const ::DRAMSys::Config::Configuration& configLib);
DRAMSysRecordable(const sc_core::sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib);
protected:
void end_of_simulation() override;
@@ -55,8 +57,11 @@ private:
// They generate the output databases.
std::vector<TlmRecorder> tlmRecorders;
void setupTlmRecorders(const std::string &traceName, const ::DRAMSys::Config::Configuration& configLib);
void instantiateModules(const std::string &traceName, const ::DRAMSys::Config::Configuration& configLib);
void setupTlmRecorders(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib);
void instantiateModules(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib);
};
}
#endif // DRAMSYSRECORDABLE_H

View File

@@ -46,10 +46,6 @@ file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
add_executable(DRAMSys ${SOURCE_FILES} ${HEADER_FILES})
target_include_directories(DRAMSys PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/../library/src/simulation/DRAMSysRecordable.cpp)
target_compile_definitions(DRAMSys PRIVATE RECORDING)
endif()
target_link_libraries(DRAMSys
PRIVATE
Threads::Threads

View File

@@ -41,9 +41,7 @@
#include "simulator/TrafficInitiator.h"
#include "DRAMSys/simulation/DRAMSys.h"
#ifdef RECORDING
#include "DRAMSys/simulation/DRAMSysRecordable.h"
#endif
#include "DRAMSys/config/DRAMSysConfiguration.h"
#include <iostream>
@@ -101,11 +99,9 @@ int sc_main(int argc, char **argv)
// Instantiate DRAMSys:
std::unique_ptr<DRAMSys::DRAMSys> dramSys;
#ifdef RECORDING
if (configLib.simConfig.databaseRecording.value_or(false))
dramSys = std::make_unique<DRAMSysRecordable>("DRAMSys", configLib);
dramSys = std::make_unique<DRAMSys::DRAMSysRecordable>("DRAMSys", configLib);
else
#endif
dramSys = std::make_unique<DRAMSys::DRAMSys>("DRAMSys", configLib);
if (!configLib.traceSetup.has_value())