From 59cbf4d6a80dbacf245f4bf0575a4c6f7f5ade7c Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Tue, 21 Feb 2017 22:59:04 +0100 Subject: [PATCH] Fixed some path problems in thermalsim --- .../simulator/resources/configs/thermalsim/config.xml | 2 +- .../controller/core/configuration/Configuration.cpp | 11 +++++++++++ .../src/controller/core/configuration/Configuration.h | 3 +++ .../controller/core/configuration/thermalSimConfig.h | 10 ++++++++++ DRAMSys/simulator/src/simulation/DRAMSys.cpp | 2 ++ 5 files changed, 27 insertions(+), 1 deletion(-) diff --git a/DRAMSys/simulator/resources/configs/thermalsim/config.xml b/DRAMSys/simulator/resources/configs/thermalsim/config.xml index 9c71f8c6..4d32315e 100644 --- a/DRAMSys/simulator/resources/configs/thermalsim/config.xml +++ b/DRAMSys/simulator/resources/configs/thermalsim/config.xml @@ -4,7 +4,7 @@ - + diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index d0f18424..58e29c0c 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -228,6 +228,17 @@ void Configuration::setParameter(std::string name, std::string value) } } +void Configuration::setPathToResources(std::string path) +{ + pathToResources = path; + temperatureSim.setPathToResources(path); +} + +std::string Configuration::getPathToResources() +{ + return pathToResources; +} + void Configuration::setParameters(std::map parameterMap) { for(auto item : parameterMap) diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h index 21977e78..40c24b8a 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h @@ -53,6 +53,7 @@ struct Configuration { static std::string memspecUri; static std::string mcconfigUri; + std::string pathToResources; DEF_SINGLETON(Configuration); @@ -98,6 +99,8 @@ struct Configuration std::uint64_t getSimMemSizeInBytes(); unsigned int getDataBusWidth(); unsigned int getBytesPerBurst(); + void setPathToResources(std::string path); + std::string getPathToResources(); private: Configuration(); diff --git a/DRAMSys/simulator/src/controller/core/configuration/thermalSimConfig.h b/DRAMSys/simulator/src/controller/core/configuration/thermalSimConfig.h index d5d5a25f..167b0e11 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/thermalSimConfig.h +++ b/DRAMSys/simulator/src/controller/core/configuration/thermalSimConfig.h @@ -49,6 +49,12 @@ struct TemperatureSimConfig { // Temperature Scale std::string TemperatureScale; + std::string pathToResources; + + void setPathToResources(std::string path) + { + pathToResources = path; + } // Static Temperature Simulation parameters int StaticTemperatureDefaultValue; @@ -72,6 +78,10 @@ struct TemperatureSimConfig { { printDebugMessage("Power Info File: " + powerInfoFile); + powerInfoFile = pathToResources + + "/configs/thermalsim/" + + powerInfoFile; + // Load the XML file into memory and parse it tinyxml2::XMLDocument xml; loadXML(powerInfoFile, xml); diff --git a/DRAMSys/simulator/src/simulation/DRAMSys.cpp b/DRAMSys/simulator/src/simulation/DRAMSys.cpp index 5454f2ea..174dc721 100644 --- a/DRAMSys/simulator/src/simulation/DRAMSys.cpp +++ b/DRAMSys/simulator/src/simulation/DRAMSys.cpp @@ -74,6 +74,8 @@ DRAMSys::DRAMSys(sc_module_name __attribute__((unused)) name, simconfig, thermalconfig); + Configuration::getInstance().setPathToResources(pathToResources); + // The xmlAddressDecoder MUST be initialized before calling the // ConfigurationLoader because some information from the xmlAddressDecoder // is needed to assure the coherence of the configuration.