Merge pull request #52 from fzeder/master

Coherence check for the configuration field NumberofMemChannels.
This commit is contained in:
Matthias Jung
2015-12-17 09:15:42 +01:00
2 changed files with 13 additions and 3 deletions

View File

@@ -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")

View File

@@ -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);