Coherence check for the configuration field NumberofMemChannels.

The number of bits reserved to describe the channel within the address
determines the maximum number of memory channels allowed.

The program will be aborted if the number of memory channels in the
configuration exceeds the maximum number of memory channels supported based on
the number of bits reserved in the address mapping configuration file.
This commit is contained in:
Éder F. Zulian
2015-12-17 01:25:23 -02:00
parent 534eadf2fb
commit 9820ac497f
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);