diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index 69315241..19d8ca75 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -38,6 +38,7 @@ #include "Configuration.h" #include "ConfigurationLoader.h" #include "boost/lexical_cast.hpp" +#include "../../../common/xmlAddressdecoder.h" using namespace std; @@ -139,8 +140,14 @@ void Configuration::setParameter(std::string name, std::string value) Debug = string2bool(value); else if (name == "NumberOfTracePlayers") NumberOfTracePlayers = string2int(value); - else if (name == "NumberOfMemChannels") + else if (name == "NumberOfMemChannels") { NumberOfMemChannels = string2int(value); + unsigned int maxNumberofMemChannels = xmlAddressDecoder::getInstance().amount["channel"]; + if (NumberOfMemChannels > maxNumberofMemChannels) { + SC_REPORT_FATAL("Configuration", ("Invalid value for parameter " + name + ". Value is out of range. The maximum value according to the address mapping configuration file is " + std::to_string(maxNumberofMemChannels) + ".").c_str()); + throw; + } + } else if (name == "ControllerCoreDisableRefresh") ControllerCoreDisableRefresh = string2bool(value); else if (name == "DynamicTemperatureSimulation") diff --git a/DRAMSys/simulator/src/simulation/Simulation.cpp b/DRAMSys/simulator/src/simulation/Simulation.cpp index 9b84334b..55bd4c0d 100644 --- a/DRAMSys/simulator/src/simulation/Simulation.cpp +++ b/DRAMSys/simulator/src/simulation/Simulation.cpp @@ -57,11 +57,14 @@ Simulation::Simulation(sc_module_name __attribute__((unused)) name, string pathT { SC_THREAD(stop); + // XXX: The xmlAddressDecoder MUST be initialized before calling the + // ConfigurationLoader because some information from the xmlAddressDecoder + // is needed to assure the coherence of the configuration. xmlAddressDecoder::Initialize(setup.addressmapping); xmlAddressDecoder::getInstance().print(); - ConfigurationLoader::loadMemConfig(Configuration::getInstance(), setup.memconfig);//pathToResources + string("configs/memconfigs/") + setup.memconfig); - ConfigurationLoader::loadMemSpec(Configuration::getInstance(), setup.memspec);//pathToResources + string("configs/memspecs/") + setup.memspec); + ConfigurationLoader::loadMemConfig(Configuration::getInstance(), setup.memconfig); + ConfigurationLoader::loadMemSpec(Configuration::getInstance(), setup.memspec); ConfigurationLoader::loadSimConfig(Configuration::getInstance(), setup.simconfig); ConfigurationLoader::loadTemperatureSimConfig(Configuration::getInstance(), setup.temperature_simconfig);