ControllerECC: stored data pointer will be erased from map if not needed anymore.

Moved {ErrorChipSeed, ErrorCSVFile, StoreMode} from mcconfig zu simconfig
Error files moved to resources/error/ and are now named correctly.
This commit is contained in:
Johannes Feldmann
2017-05-08 10:13:57 +02:00
parent 0b55dfd7e7
commit 4d9a6f74d8
16 changed files with 420 additions and 41 deletions

View File

@@ -8,13 +8,5 @@
<PowerDownMode value="NoPowerDown" />
<PowerDownTimeout value="100" />
<!-- Error Modelling -->
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
<ControllerCoreDisableRefresh value="0"/>
</mcconfig>

View File

@@ -8,13 +8,5 @@
<PowerDownMode value="NoPowerDown" />
<PowerDownTimeout value="100" />
<!-- Error Modelling -->
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
<ControllerCoreDisableRefresh value="0"/>
</mcconfig>

View File

@@ -8,13 +8,5 @@
<PowerDownMode value="NoPowerDown" />
<PowerDownTimeout value="100" />
<!-- Error Modelling -->
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="ErrorModel" />
<ControllerCoreDisableRefresh value="0"/>
</mcconfig>

View File

@@ -8,14 +8,6 @@
<PowerDownMode value="NoPowerDown" />
<PowerDownTimeout value="100" />
<!-- Error Model: -->
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
<ControllerCoreDisableRefresh value="0"/>
</mcconfig>

View File

@@ -8,13 +8,5 @@
<PowerDownMode value="NoPowerDown" />
<PowerDownTimeout value="100" />
<!-- Error Modelling -->
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/src/error/error.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
<ControllerCoreDisableRefresh value="0"/>
</mcconfig>

View File

@@ -11,4 +11,12 @@
<NumberOfDevicesOnDIMM value = "8" />
<CheckTLM2Protocol value = "0" />
<AddressOffset value = "0" />
<ErrorChipSeed value="42" />
<ErrorCSVFile value="" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
</simconfig>

View File

@@ -11,6 +11,14 @@
<NumberOfDevicesOnDIMM value = "8" />
<CheckTLM2Protocol value = "0" />
<AddressOffset value = "0" />
<ErrorChipSeed value="42" />
<ErrorCSVFile value="" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
<!-- Gem5 Related Configuration:
In the memory controller file the storage mode should be set to Store
E.g. the DRAM is located at 0x80000000 for gem5

View File

@@ -12,4 +12,12 @@
<CheckTLM2Protocol value = "0" />
<AddressOffset value = "0" />
<EnableControllerECC value = "1" />
<ErrorChipSeed value="42" />
<ErrorCSVFile value="" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="ErrorModel" />
</simconfig>

View File

@@ -10,5 +10,13 @@
<NumberOfMemChannels value="4"/>
<NumberOfDevicesOnDIMM value = "1" />
<CheckTLM2Protocol value = "0" />
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/resources/error/wideio.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
</simconfig>

View File

@@ -11,5 +11,13 @@
<NumberOfDevicesOnDIMM value = "1" />
<CheckTLM2Protocol value = "0" />
<EnableControllerECC value = "1" />
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/resources/error/wideio.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="ErrorModel" />
</simconfig>

View File

@@ -10,5 +10,13 @@
<NumberOfMemChannels value="1"/>
<NumberOfDevicesOnDIMM value = "1" />
<CheckTLM2Protocol value = "0" />
<ErrorChipSeed value="42" />
<ErrorCSVFile value="../../DRAMSys/simulator/resources/error/wideio.csv" />
<!-- Modes:
- NoStorage,
- Store (store data without errormodel),
- ErrorModel (store data with errormodel)
-->
<StoreMode value="NoStorage" />
</simconfig>

View File

@@ -140,3 +140,6 @@ OTHER_FILES += resources/configs/thermalsim/mem.flp
OTHER_FILES += resources/configs/thermalsim/powerInfo.xml
OTHER_FILES += resources/configs/thermalsim/stack.stk
OTHER_FILES += resources/configs/thermalsim/config.xml
# Error Simulation data
OTHER_FILES += resources/error/wideio.csv

View File

@@ -0,0 +1,52 @@
<simulation>
<!-- General Simulator Configuration (used for all simulation setups) -->
<simconfig>
<Debug value="0" />
<DatabaseRecording value="0" />
<PowerAnalysis value="0" />
<EnableWindowing value = "0" />
<WindowSize value="1000" />
<NumberOfTracePlayers value="1"/>
<NumberOfMemChannels value="4"/>
<ControllerCoreDisableRefresh value="0"/>
<ThermalSimulation value="0"/>
<SimulationProgressBar value="0"/>
<NumberOfDevicesOnDIMM value = "1" />
<CheckTLM2Protocol value = "0" />
</simconfig>
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
<thermalsimconfig>
<TemperatureScale value="Celsius" />
<StaticTemperatureDefaultValue value="89" />
<ThermalSimPeriod value="100" />
<ThermalSimUnit value="us" />
<PowerInfoFile value="../../DRAMSys/simulator/resources/configs/thermalsim/powerInfo.xml"/>
<IceServerIp value="127.0.0.1" />
<IceServerPort value="11880" />
<SimPeriodAdjustFactor value="10" />
<NPowStableCyclesToIncreasePeriod value="5" />
<GenerateTemperatureMap value="1" />
<GeneratePowerMap value="1" />
</thermalsimconfig>
<memspecs>
<memspec src="../../DRAMSys/simulator/resources/configs/memspecs/WideIO.xml"></memspec>
</memspecs>
<addressmappings>
<addressmapping src="../../DRAMSys/simulator/resources/configs/amconfigs/am_wideio.xml"></addressmapping>
</addressmappings>
<mcconfigs>
<mcconfig src="../../DRAMSys/simulator/resources/configs/mcconfigs/fifoStrict.xml"/>
</mcconfigs>
<tracesetups>
<tracesetup id="fifo">
<device clkMhz="200">chstone-adpcm_32.stl</device>
</tracesetup>
</tracesetups>
</simulation>

View File

@@ -194,6 +194,9 @@ public:
unsigned char* pDataECC = it->second;
// delete data pointer from map
m_mDataPointer.erase(it);
// Copy data
memcpy(pDataECC, pData, nBlocks<<3);
@@ -219,7 +222,10 @@ public:
trans.set_data_ptr(it->second);
// Change transport data length
// delete data pointer from map
m_mDataPointer.erase(it);
// Change transport data length
trans.set_data_length((nDataLength/9)<<3);
}

View File

@@ -0,0 +1,310 @@
/*
* Copyright (c) 2015, University of Kaiserslautern
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors:
* Janik Schlemminger
* Matthias Jung
* Eder F. Zulian
*/
#include <sys/wait.h>
#include <boost/filesystem.hpp>
#include "SimulationManager.h"
#include "../common/Utils.h"
using namespace std;
using namespace tinyxml2;
SimulationManager::SimulationManager(string resources) : resources(resources)
{
}
SimulationManager::~SimulationManager()
{
for (auto player : players) {
delete player;
}
#if USE_EXAMPLE_INITIATOR
delete init;
delete exampleInitiatorTlmChecker;
#endif
for (auto tlmChecker : playersTlmCheckers) {
delete tlmChecker;
}
}
void SimulationManager::loadSimulationsFromXML(string uri)
{
cout << "\n\nload simulation-batch:" << endl;
cout << headline << endl;
exportPath = getFileName(uri);
loadXML(uri, simulationdoc);
cout << "\t-> parsing simulation objects .." << endl;
XMLElement* simulation = simulationdoc.FirstChildElement("simulation");
string xmlNodeName(simulation->Name());
if( xmlNodeName != "simulation")
reportFatal("SimulationManager", "simulation node expected");
parseSimulationBatch(simulation);
cout << "\t-> simulation batches loaded successfully!\n" << endl;
for (auto batch : simulationBatches)
{
batch.print();
}
}
void SimulationManager::runSimulations()
{
for (auto& batch : simulationBatches)
{
boost::filesystem::path dir(exportPath);
boost::filesystem::create_directories(dir);
for (auto& dramSetup : batch.dramSetups)
{
for (auto& traceSetup : batch.traceSetups)
{
string exportname = exportPath + "/" + traceSetup.first;
instantiateModules(exportname, dramSetup, traceSetup.second);
bindSockets();
runSimulation(exportname);
}
}
}
}
void SimulationManager::parseSimulationBatch(XMLElement* simulation)
{
SimulationBatch batch;
XMLElement* simconfig = simulation->FirstChildElement("simconfig");
XMLElement *thermalsimconfig = simulation->FirstChildElement("thermalsimconfig");
XMLElement* memspecs = simulation->FirstChildElement("memspecs");
if(memspecs == NULL) memspecs = simulation;
XMLElement* addressmappings = simulation->FirstChildElement("addressmappings");
if(addressmappings == NULL) addressmappings = simulation;
XMLElement* mcconfigs = simulation->FirstChildElement("mcconfigs");
if(mcconfigs == NULL) mcconfigs = simulation;
for (XMLElement* memspec = memspecs->FirstChildElement("memspec"); memspec != NULL;
memspec = memspec->NextSiblingElement("memspec"))
{
for (XMLElement* addressmapping = addressmappings->FirstChildElement("addressmapping"); addressmapping != NULL;
addressmapping = addressmapping->NextSiblingElement("addressmapping"))
{
for (XMLElement* mcconfig = mcconfigs->FirstChildElement("mcconfig");
mcconfig != NULL; mcconfig = mcconfig->NextSiblingElement("mcconfig"))
{
batch.dramSetups.push_back(DramSetup(memspec, mcconfig, simconfig, addressmapping, thermalsimconfig));
}
}
}
addTraceSetups(batch, simulation);
simulationBatches.push_back(batch);
}
void SimulationManager::instantiateModules(string traceName, DramSetup dramSetup, vector<Device> traceSetup)
{
simulation = new Simulation("sim", resources, traceName, dramSetup, traceSetup);
#if USE_EXAMPLE_INITIATOR
init = new ExampleInitiator("init");
if(Configuration::getInstance().CheckTLM2Protocol) {
string str = "ExampleInitiatorTLMChecker";
exampleInitiatorTlmChecker = new tlm_utils::tlm2_base_protocol_checker<>(str.c_str());
}
#else
for (size_t i = 0; i < Configuration::getInstance().NumberOfTracePlayers; i++) {
std::string playerStr = "tracePlayer" + std::to_string(i);
TracePlayer *player;
sc_time playerClk;
// The clock frequency for the player can be specified in the
// configuration file like in the example below (200 MHz):
//
// <tracesetups>
// <tracesetup id="fifo">
// <device clkMhz="200">chstone-adpcm_32.stl</device>
// </tracesetup>
// </tracesetups>
//
// If it is not specified in the configuration, the player will be
// configured to use the memory clock frequency got from the memory
// specs.
if (traceSetup[i].clkMhz == 0)
playerClk = Configuration::getInstance().memSpec.clk;
else
playerClk = FrequencyToClk(traceSetup[i].clkMhz);
const string pathToResources = resources;
player = new StlPlayer(playerStr.c_str(), pathToResources + string("traces/") + traceSetup[i].trace, playerClk, this);
if(Configuration::getInstance().SimulationProgressBar)
{
totalTransactions += player->getNumberOfLines(pathToResources + string("traces/") + traceSetup[i].trace);
}
players.push_back(player);
if(Configuration::getInstance().CheckTLM2Protocol) {
string str = "TLMCheckerPlayer"+ std::to_string(i);
tlm_utils::tlm2_base_protocol_checker<> * playerTlmChecker = new tlm_utils::tlm2_base_protocol_checker<>(str.c_str());
playersTlmCheckers.push_back(playerTlmChecker);
}
}
remainingTransactions = totalTransactions;
#endif /* USE_EXAMPLE_INITIATOR */
}
void SimulationManager::bindSockets()
{
#if USE_EXAMPLE_INITIATOR
if(Configuration::getInstance().CheckTLM2Protocol) {
init->socket.bind(exampleInitiatorTlmChecker->target_socket);
exampleInitiatorTlmChecker->initiator_socket.bind(simulation->tSocket);
}
else {
init->socket.bind(simulation->tSocket);
#else
if(Configuration::getInstance().CheckTLM2Protocol) {
for (size_t i = 0; i < players.size(); i++) {
players[i]->iSocket.bind(playersTlmCheckers[i]->target_socket);
playersTlmCheckers[i]->initiator_socket.bind(simulation->tSocket);
}
}
else {
for (auto player : players) {
player->iSocket.bind(simulation->tSocket);
}
#endif
}
}
void SimulationManager::runSimulation(string traceName)
{
report("\n\nStarting simulation:");
report(headline);
report(" -> setup: \t\t" + getFileName(traceName));
report(" -> memspec: \t\t" + Configuration::getInstance().memSpec.MemoryId);
cout << endl;
simStartTime = clock();
for (auto player : players) {
player->nextPayload();
}
sc_set_stop_mode(SC_STOP_FINISH_DELTA);
sc_start();
double elapsed_secs = double(clock() - simStartTime) / CLOCKS_PER_SEC;
report("\nSimulation took " + to_string(elapsed_secs) + " seconds\n");
delete simulation;
}
void SimulationManager::startTraceAnalyzer()
{
string p = getenv("trace");
string run_tpr = p + " -f ";
run_tpr += "&";
system(run_tpr.c_str());
}
void SimulationManager::addTraceSetups(SimulationBatch &batch, tinyxml2::XMLElement *simulation)
{
vector<Device> devices;
XMLElement *tracesetups = simulation->FirstChildElement("tracesetups");
XMLElement *simconfig = simulation->FirstChildElement("simconfig");
unsigned int numberOfTracePlayers = 1;
XMLElement *ntp = simconfig->FirstChildElement("NumberOfTracePlayers");
if (ntp != NULL)
ntp->QueryUnsignedAttribute("value", &numberOfTracePlayers);
for (XMLElement *tracesetup = tracesetups->FirstChildElement("tracesetup"); tracesetup != NULL; tracesetup = tracesetup->NextSiblingElement("tracesetup")) {
for (XMLElement *device = tracesetup->FirstChildElement("device"); device != NULL; device = device->NextSiblingElement("device")) {
devices.push_back(Device(device->GetText(), device->IntAttribute("clkMhz"), device->IntAttribute("bl")));
}
// This step is done here to add a default device in case the user haven't specified a trace file to be executed by one or more trace players.
while (devices.size() < numberOfTracePlayers) {
devices.push_back(Device());
}
batch.traceSetups.emplace(tracesetup->Attribute("id"), devices);
devices.clear();
}
}
void inline SimulationManager::tracePlayerTerminates()
{
static unsigned int finishedTracePlayers = 0;
finishedTracePlayers++;
if (finishedTracePlayers == Configuration::getInstance().NumberOfTracePlayers)
simulation->terminateSimulation.notify();
}
void inline SimulationManager::transactionFinished()
{
remainingTransactions--;
loadbar(totalTransactions - remainingTransactions, totalTransactions);
if (remainingTransactions == 0)
{
cout << endl;
}
}
void SimulationManager::report(string message)
{
cout << message << endl;
}
void SimulationBatch::print()
{
for (auto& s : traceSetups)
{
cout << "trace-setup " + s.first + ":\n";
for (Device d : s.second)
cout << "\t(" << d.burstLength << ") " << d.trace << ";" << endl;
cout << endl;
}
}