From 78cc14dcd40ea4fd5e7f75dd4541cbca3680e5e3 Mon Sep 17 00:00:00 2001 From: Janik Schlemminger Date: Wed, 9 Apr 2014 22:41:51 +0200 Subject: [PATCH] device and dram setup object --- dram/.cproject | 2 +- dram/src/simulation/SimulationManager.cpp | 29 ++++++++----- dram/src/simulation/SimulationManager.h | 25 +++++++++-- dram/src/simulation/main.cpp | 23 +++++----- dram/testing/main.cpp | 52 +++++++++++------------ 5 files changed, 79 insertions(+), 52 deletions(-) diff --git a/dram/.cproject b/dram/.cproject index 5edbf2e0..362fbe05 100644 --- a/dram/.cproject +++ b/dram/.cproject @@ -80,7 +80,7 @@ - + diff --git a/dram/src/simulation/SimulationManager.cpp b/dram/src/simulation/SimulationManager.cpp index dbd96f8b..9f0d606b 100644 --- a/dram/src/simulation/SimulationManager.cpp +++ b/dram/src/simulation/SimulationManager.cpp @@ -17,9 +17,8 @@ using namespace std; namespace simulation { -SimulationManager::SimulationManager(sc_module_name name, string memconfig, string memspec, - string stl1, unsigned int burstlength1, string stl2, unsigned int burstlenght2, - string traceName, string pathToResources, bool silent) : +SimulationManager::SimulationManager(sc_module_name name, string pathToResources, string traceName, DramSetup setup, + std::vector devices, bool silent) : traceName(traceName) { @@ -28,16 +27,25 @@ SimulationManager::SimulationManager(sc_module_name name, string memconfig, stri xmlAddressDecoder::addressConfigURI = pathToResources + string("configs/addressConfig.xml"); TlmRecorder::dbName = traceName; TlmRecorder::sqlScriptURI = pathToResources + string("scripts/createTraceDB.sql"); - Configuration::memconfigUri = pathToResources + string("configs/memconfigs/") + memconfig; - Configuration::memspecUri = pathToResources + string("configs/memspecs/") + memspec; + Configuration::memconfigUri = pathToResources + string("configs/memconfigs/") + setup.memconfig; + Configuration::memspecUri = pathToResources + string("configs/memspecs/") + setup.memspec; + //setup dram dram = new Dram<>("dram"); - arbiter = new Arbiter("arbiter"); + arbiter = new Arbiter("arbiter"); controller = new Controller<>("controller"); - player1 = new TracePlayer<>("player1", pathToResources + string("traces/") + stl1, burstlength1, - this); - player2 = new TracePlayer<>("player2", pathToResources + string("traces/") + stl2, burstlenght2, - this); + + //setup devices + for(auto& d : devices) + { + if(d.burstLength == 0) + d.burstLength = 8; + } + + player1 = new TracePlayer<>("player1", pathToResources + string("traces/") + devices[0].trace, + devices[0].burstLength, this); + player2 = new TracePlayer<>("player2", pathToResources + string("traces/") + devices[1].trace, + devices[1].burstLength, this); player1->iSocket.bind(arbiter->tSockets[0]); player2->iSocket.bind(arbiter->tSockets[1]); @@ -67,7 +75,6 @@ SimulationManager::~SimulationManager() delete player2; } - void SimulationManager::startSimulation() { diff --git a/dram/src/simulation/SimulationManager.h b/dram/src/simulation/SimulationManager.h index fc7f0f52..5eddf210 100644 --- a/dram/src/simulation/SimulationManager.h +++ b/dram/src/simulation/SimulationManager.h @@ -18,14 +18,30 @@ namespace simulation { +struct DramSetup +{ + DramSetup():memconfig(""),memspec(""){} + DramSetup(std::string memconfig, std::string memspec) : memconfig(memconfig), memspec(memspec) {} + std::string memconfig; + std::string memspec; +}; + +struct Device +{ + Device():trace(""), burstLength(0){} + Device(std::string trace, unsigned int burstLength = 0) : trace(trace), burstLength(burstLength) + { + } + std::string trace; + unsigned int burstLength; +}; + class SimulationManager: public ISimulationManager, public sc_module { public: SC_HAS_PROCESS(SimulationManager); - SimulationManager(sc_module_name name, std::string memconfig, std::string memspec, - std::string stl1, unsigned int burstlength1, std::string stl2, - unsigned int burstlenght2, std::string traceName, std::string pathToResources, - bool silent = false); + SimulationManager(sc_module_name name, string pathToResources, string traceName, DramSetup setup, + std::vector devices, bool silent = false); ~SimulationManager(); void startSimulation(); void tracePlayerFinishedCallback(string name) override; @@ -38,6 +54,7 @@ private: Dram<> *dram; Arbiter *arbiter; Controller<> *controller; + TracePlayer<> *player1; TracePlayer<> *player2; }; diff --git a/dram/src/simulation/main.cpp b/dram/src/simulation/main.cpp index c250b023..c47104b9 100644 --- a/dram/src/simulation/main.cpp +++ b/dram/src/simulation/main.cpp @@ -33,18 +33,21 @@ int sc_main(int argc, char **argv) string resources = pathOfFile(argv[0]) + string("/../resources/"); - string memconfig = "memconfig.xml"; - string memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml"; -// memspec = "MatzesWideIO.xml"; - string stl1 = "chstone-sha_32.stl"; - //stl1 = "empty.stl"; - unsigned int burstlength1 = 8; - string stl2 = "mediabench-h263decode_32.stl"; - stl2 = "trace.stl"; - unsigned int burstlength2 = 8; + DramSetup setup; + setup.memconfig = "memconfig.xml"; + setup.memspec = "MICRON_4Gb_DDR4-1866_8bit_A.xml"; + setup.memspec = "MatzesWideIO.xml"; + + Device device1; + device1.trace = "empty.stl"; + + Device device2; + device2.trace = "trace.stl"; + //device2.trace = "mediabench-h263decode_32.stl"; + string traceName = "tpr.tdb"; - SimulationManager simulationManager("sim",memconfig,memspec,stl1,burstlength1, stl2,burstlength2, traceName, resources,false); + SimulationManager simulationManager("sim", resources, traceName, setup, { device1, device2 }); simulationManager.startSimulation(); startTraceAnalyzer(traceName); return 0; diff --git a/dram/testing/main.cpp b/dram/testing/main.cpp index b4db982c..db14631b 100644 --- a/dram/testing/main.cpp +++ b/dram/testing/main.cpp @@ -5,29 +5,29 @@ * Author: jonny */ -#include -#include -#include -#include -#include -#include -#include -#include -using namespace std; -using namespace testing; - - -int runTests(int argc, char **argv) -{ - cout << "---- Starting Tests ----" < +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//using namespace std; +//using namespace testing; +// +// +//int runTests(int argc, char **argv) +//{ +// cout << "---- Starting Tests ----" <