device and dram setup object
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="src|testing" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="testing|src" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/common"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/core"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src/scheduler"/>
|
||||
|
||||
@@ -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<Device> 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<numberOfTracePlayers,128>("arbiter");
|
||||
arbiter = new Arbiter<numberOfTracePlayers, 128>("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()
|
||||
{
|
||||
|
||||
|
||||
@@ -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<Device> devices, bool silent = false);
|
||||
~SimulationManager();
|
||||
void startSimulation();
|
||||
void tracePlayerFinishedCallback(string name) override;
|
||||
@@ -38,6 +54,7 @@ private:
|
||||
Dram<> *dram;
|
||||
Arbiter<numberOfTracePlayers, 128> *arbiter;
|
||||
Controller<> *controller;
|
||||
|
||||
TracePlayer<> *player1;
|
||||
TracePlayer<> *player2;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5,29 +5,29 @@
|
||||
* Author: jonny
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <gtest/gtest.h>
|
||||
#include <tlm.h>
|
||||
#include <systemc.h>
|
||||
#include <unistd.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <memory.h>
|
||||
#include <set>
|
||||
using namespace std;
|
||||
using namespace testing;
|
||||
|
||||
|
||||
int runTests(int argc, char **argv)
|
||||
{
|
||||
cout << "---- Starting Tests ----" <<endl;
|
||||
InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
return runTests(argc,argv);
|
||||
}
|
||||
|
||||
int sc_main(int argc, char **argv) {
|
||||
return main(argc,argv);
|
||||
}
|
||||
//#include <iostream>
|
||||
//#include <gtest/gtest.h>
|
||||
//#include <tlm.h>
|
||||
//#include <systemc.h>
|
||||
//#include <unistd.h>
|
||||
//#include <gtest/gtest.h>
|
||||
//#include <memory.h>
|
||||
//#include <set>
|
||||
//using namespace std;
|
||||
//using namespace testing;
|
||||
//
|
||||
//
|
||||
//int runTests(int argc, char **argv)
|
||||
//{
|
||||
// cout << "---- Starting Tests ----" <<endl;
|
||||
// InitGoogleTest(&argc, argv);
|
||||
// return RUN_ALL_TESTS();
|
||||
//}
|
||||
//
|
||||
//int main(int argc, char **argv) {
|
||||
// return runTests(argc,argv);
|
||||
//}
|
||||
//
|
||||
//int sc_main(int argc, char **argv) {
|
||||
// return main(argc,argv);
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user