Fix Trace Analyzer cmake.
This commit is contained in:
@@ -42,7 +42,6 @@ project(TraceAnalyzer)
|
|||||||
|
|
||||||
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp)
|
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS *.cpp)
|
||||||
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
|
file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
|
||||||
#file(GLOB_RECURSE UI_FILES CONFIGURE_DEPENDS *.ui)
|
|
||||||
|
|
||||||
# Add Python3 Dependency:
|
# Add Python3 Dependency:
|
||||||
find_package(Python3 COMPONENTS Development)
|
find_package(Python3 COMPONENTS Development)
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER lib)
|
|||||||
### Compile options ###
|
### Compile options ###
|
||||||
# refer to https://www.sqlite.org/compile.html
|
# 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})
|
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
|
||||||
@@ -42,10 +42,6 @@ set(DCMAKE_SH="CMAKE_SH-NOTFOUND")
|
|||||||
|
|
||||||
find_library(GEM5_LIBRARY gem5_${GEM5_VARIANT} PATHS $ENV{GEM5}/build/${GEM5_ISA}/)
|
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
|
add_executable(DRAMSys_gem5
|
||||||
main.cpp
|
main.cpp
|
||||||
$ENV{GEM5}/util/systemc/gem5_within_systemc/sc_logger.cc
|
$ENV{GEM5}/util/systemc/gem5_within_systemc/sc_logger.cc
|
||||||
|
|||||||
@@ -52,10 +52,7 @@
|
|||||||
|
|
||||||
#include "Configuration.h"
|
#include "Configuration.h"
|
||||||
#include "simulation/DRAMSys.h"
|
#include "simulation/DRAMSys.h"
|
||||||
|
|
||||||
#ifdef RECORDING
|
|
||||||
#include "simulation/DRAMSysRecordable.h"
|
#include "simulation/DRAMSysRecordable.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace sc_core;
|
using namespace sc_core;
|
||||||
using namespace tlm;
|
using namespace tlm;
|
||||||
@@ -167,11 +164,9 @@ int sc_main(int argc, char **argv)
|
|||||||
// Instantiate DRAMSys:
|
// Instantiate DRAMSys:
|
||||||
std::unique_ptr<DRAMSys> dramSys;
|
std::unique_ptr<DRAMSys> dramSys;
|
||||||
|
|
||||||
#ifdef RECORDING
|
|
||||||
if (configLib.simConfig.databaseRecording.value_or(false))
|
if (configLib.simConfig.databaseRecording.value_or(false))
|
||||||
dramSys = std::make_unique<DRAMSysRecordable>("DRAMSys", configLib);
|
dramSys = std::make_unique<DRAMSysRecordable>("DRAMSys", configLib);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
dramSys = std::make_unique<DRAMSys>("DRAMSys", configLib);
|
dramSys = std::make_unique<DRAMSys>("DRAMSys", configLib);
|
||||||
|
|
||||||
// Instantiate gem5:
|
// Instantiate gem5:
|
||||||
|
|||||||
@@ -62,10 +62,10 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace sc_core;
|
namespace DRAMSys {
|
||||||
|
|
||||||
DRAMSysRecordable::DRAMSysRecordable(const sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib)
|
DRAMSysRecordable::DRAMSysRecordable(const sc_core::sc_module_name& name, const ::DRAMSys::Config::Configuration& configLib)
|
||||||
: DRAMSys(name, configLib, false)
|
: DRAMSys(name, configLib, false)
|
||||||
{
|
{
|
||||||
// If a simulation file is passed as argument to DRAMSys the simulation ID
|
// If a simulation file is passed as argument to DRAMSys the simulation ID
|
||||||
// is prepended to the simulation name if found.
|
// is prepended to the simulation name if found.
|
||||||
@@ -89,15 +89,16 @@ void DRAMSysRecordable::end_of_simulation()
|
|||||||
// Report power before TLM recorders are finalized
|
// Report power before TLM recorders are finalized
|
||||||
if (config.powerAnalysis)
|
if (config.powerAnalysis)
|
||||||
{
|
{
|
||||||
for (auto& dram : drams)
|
for (auto& dram: drams)
|
||||||
dram->reportPower();
|
dram->reportPower();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& tlmRecorder : tlmRecorders)
|
for (auto& tlmRecorder: tlmRecorders)
|
||||||
tlmRecorder.finalize();
|
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.
|
// Create TLM Recorders, one per channel.
|
||||||
// Reserve is required because the recorders use double buffers that are accessed with pointers.
|
// 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,
|
void DRAMSysRecordable::instantiateModules(const std::string& traceName,
|
||||||
const ::DRAMSys::Config::Configuration &configLib)
|
const ::DRAMSys::Config::Configuration& configLib)
|
||||||
{
|
{
|
||||||
addressDecoder = std::make_unique<AddressDecoder>(config, configLib.addressMapping);
|
addressDecoder = std::make_unique<AddressDecoder>(config, configLib.addressMapping);
|
||||||
addressDecoder->print();
|
addressDecoder->print();
|
||||||
@@ -143,34 +144,34 @@ void DRAMSysRecordable::instantiateModules(const std::string &traceName,
|
|||||||
|
|
||||||
if (memoryType == MemSpec::MemoryType::DDR3)
|
if (memoryType == MemSpec::MemoryType::DDR3)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramDDR3>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::DDR4)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramDDR4>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::WideIO)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramWideIO>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::LPDDR4)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramLPDDR4>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::WideIO2)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramWideIO2>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::HBM2)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramHBM2>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::GDDR5)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramGDDR5>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::GDDR5X)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramGDDR5X>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::GDDR6)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramGDDR6>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
else if (memoryType == MemSpec::MemoryType::STTMRAM)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramSTTMRAM>>(("dram" + std::to_string(i)).c_str(),
|
drams.emplace_back(std::make_unique<DramRecordable<DramSTTMRAM>>(("dram" + std::to_string(i)).c_str(),
|
||||||
config, tlmRecorders[i]));
|
config, tlmRecorders[i]));
|
||||||
#ifdef DDR5_SIM
|
#ifdef DDR5_SIM
|
||||||
else if (memoryType == MemSpec::MemoryType::DDR5)
|
else if (memoryType == MemSpec::MemoryType::DDR5)
|
||||||
drams.emplace_back(std::make_unique<DramRecordable<DramDDR5>>(("dram" + std::to_string(i)).c_str(),
|
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)
|
if (config.checkTLM2Protocol)
|
||||||
controllersTlmCheckers.emplace_back(std::make_unique<tlm_utils::tlm2_base_protocol_checker<>>
|
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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,10 +42,12 @@
|
|||||||
|
|
||||||
#include "DRAMSys/config/DRAMSysConfiguration.h"
|
#include "DRAMSys/config/DRAMSysConfiguration.h"
|
||||||
|
|
||||||
class DRAMSysRecordable : public DRAMSys::DRAMSys
|
namespace DRAMSys {
|
||||||
|
|
||||||
|
class DRAMSysRecordable : public DRAMSys
|
||||||
{
|
{
|
||||||
public:
|
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:
|
protected:
|
||||||
void end_of_simulation() override;
|
void end_of_simulation() override;
|
||||||
@@ -55,8 +57,11 @@ private:
|
|||||||
// They generate the output databases.
|
// They generate the output databases.
|
||||||
std::vector<TlmRecorder> tlmRecorders;
|
std::vector<TlmRecorder> tlmRecorders;
|
||||||
|
|
||||||
void setupTlmRecorders(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);
|
|
||||||
|
void instantiateModules(const std::string& traceName, const ::DRAMSys::Config::Configuration& configLib);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // DRAMSYSRECORDABLE_H
|
#endif // DRAMSYSRECORDABLE_H
|
||||||
|
|||||||
@@ -46,10 +46,6 @@ file(GLOB_RECURSE HEADER_FILES CONFIGURE_DEPENDS *.h;*.hpp)
|
|||||||
add_executable(DRAMSys ${SOURCE_FILES} ${HEADER_FILES})
|
add_executable(DRAMSys ${SOURCE_FILES} ${HEADER_FILES})
|
||||||
target_include_directories(DRAMSys PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
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
|
target_link_libraries(DRAMSys
|
||||||
PRIVATE
|
PRIVATE
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
|
|||||||
@@ -41,9 +41,7 @@
|
|||||||
#include "simulator/TrafficInitiator.h"
|
#include "simulator/TrafficInitiator.h"
|
||||||
|
|
||||||
#include "DRAMSys/simulation/DRAMSys.h"
|
#include "DRAMSys/simulation/DRAMSys.h"
|
||||||
#ifdef RECORDING
|
|
||||||
#include "DRAMSys/simulation/DRAMSysRecordable.h"
|
#include "DRAMSys/simulation/DRAMSysRecordable.h"
|
||||||
#endif
|
|
||||||
#include "DRAMSys/config/DRAMSysConfiguration.h"
|
#include "DRAMSys/config/DRAMSysConfiguration.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -101,11 +99,9 @@ int sc_main(int argc, char **argv)
|
|||||||
// Instantiate DRAMSys:
|
// Instantiate DRAMSys:
|
||||||
std::unique_ptr<DRAMSys::DRAMSys> dramSys;
|
std::unique_ptr<DRAMSys::DRAMSys> dramSys;
|
||||||
|
|
||||||
#ifdef RECORDING
|
|
||||||
if (configLib.simConfig.databaseRecording.value_or(false))
|
if (configLib.simConfig.databaseRecording.value_or(false))
|
||||||
dramSys = std::make_unique<DRAMSysRecordable>("DRAMSys", configLib);
|
dramSys = std::make_unique<DRAMSys::DRAMSysRecordable>("DRAMSys", configLib);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
dramSys = std::make_unique<DRAMSys::DRAMSys>("DRAMSys", configLib);
|
dramSys = std::make_unique<DRAMSys::DRAMSys>("DRAMSys", configLib);
|
||||||
|
|
||||||
if (!configLib.traceSetup.has_value())
|
if (!configLib.traceSetup.has_value())
|
||||||
|
|||||||
Reference in New Issue
Block a user