From 778834f15c534c5360e4fa1c423c3b7c189bcfb8 Mon Sep 17 00:00:00 2001 From: Johannes Feldmann Date: Fri, 2 Jun 2017 17:19:19 +0200 Subject: [PATCH] Removed deprecated files --- .../resources/simulations/sim-batch.xml | 52 --- .../src/simulation/SimulationManager.cpp | 310 ------------------ 2 files changed, 362 deletions(-) delete mode 100644 DRAMSys/simulator/resources/simulations/sim-batch.xml delete mode 100644 DRAMSys/simulator/src/simulation/SimulationManager.cpp diff --git a/DRAMSys/simulator/resources/simulations/sim-batch.xml b/DRAMSys/simulator/resources/simulations/sim-batch.xml deleted file mode 100644 index 0752914c..00000000 --- a/DRAMSys/simulator/resources/simulations/sim-batch.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - chstone-adpcm_32.stl - - - - - diff --git a/DRAMSys/simulator/src/simulation/SimulationManager.cpp b/DRAMSys/simulator/src/simulation/SimulationManager.cpp deleted file mode 100644 index a3494667..00000000 --- a/DRAMSys/simulator/src/simulation/SimulationManager.cpp +++ /dev/null @@ -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 -#include - -#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 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): - // - // - // - // chstone-adpcm_32.stl - // - // - // - // 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 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; - } -}