Removed deprecated files
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
<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>
|
||||
|
||||
@@ -1,310 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user