merged everythin into one project
This commit is contained in:
77
dram/src/simulation/main.cpp
Normal file
77
dram/src/simulation/main.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* main.cpp
|
||||
*
|
||||
* Created on: Mar 16, 2014
|
||||
* Author: robert
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <systemc.h>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include "../common/tlmDBPhaseRecorder.h"
|
||||
#include "../common/DebugManager.h"
|
||||
#include "../common/xmlAddressdecoder.h"
|
||||
#include "controllerwrapper.h"
|
||||
#include "dram.h"
|
||||
#include "arbiter.h"
|
||||
#include "traceplayer.h"
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int sc_main(int argc, char **argv) {
|
||||
|
||||
DebugManager::getInstance().printDebug(Importance::Warning, DebugManager::Sender::Core, SC_ZERO_TIME, "hhh");
|
||||
|
||||
string executableName(argv[0]);
|
||||
string pathOfExecutable = executableName.substr(0,executableName.find_last_of('/'));
|
||||
//string pathToStaticFolder = pathOfExecutable + string("../static");
|
||||
string pathToStaticFolder = string("/home/jonny/git/dram/dram/static");
|
||||
xmlAddressDecoder::URI = pathToStaticFolder + string("/addressConfig.xml");
|
||||
|
||||
tlmDBPhaseRecorder *recorder = new tlmDBPhaseRecorder("tpr.tdb", pathToStaticFolder);
|
||||
|
||||
//TracePlayer<> player("player","/home/robert/traces/trace.stl");
|
||||
//TracePlayer<> player("player",string("/home/robert/common/common/static/test2.stl"));
|
||||
//TracePlayer<> player("player",string("/home/jonny/traces/mediabench-h263encode_32.stl"));
|
||||
TracePlayer<> player("player",string("/home/jonny/traces/mediabench-h263decode_32.stl"));
|
||||
|
||||
cout << "Toplevel: build player" << std::endl;
|
||||
Dram<> dram("dram");
|
||||
cout << "Toplevel: build dram" << std::endl;
|
||||
Arbiter<> arbiter("arbiter");
|
||||
cout << "Toplevel: build arbiter" << std::endl;
|
||||
ControllerWrapper<> controller("controller",*recorder);
|
||||
cout << "Toplevel: build controller" << std::endl;
|
||||
|
||||
cout << "Toplevel: binding sockets" << std::endl;
|
||||
player.iSocket.bind(arbiter.tSockets[0]);
|
||||
arbiter.iSocket.bind(controller.tSocket);
|
||||
controller.iSocket.bind(dram.tSocket);
|
||||
|
||||
cout << "Toplevel: simulation start" << std::endl;
|
||||
|
||||
clock_t begin = clock();
|
||||
sc_start();
|
||||
|
||||
clock_t end = clock();
|
||||
|
||||
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
|
||||
|
||||
cout << "Simulation took " << elapsed_secs << " seconds. You better optimize your model ! " << endl;
|
||||
|
||||
delete recorder;
|
||||
|
||||
string testingScript = pathToStaticFolder + string("/tests.py");
|
||||
string runTestCommand = string("python ") + testingScript + string(" tpr.tdb");
|
||||
//system(runTestCommand.c_str());
|
||||
|
||||
string run_tpr = "/home/jonny/git/analyzer/build-traceAnalyzer-Desktop-Debug/traceAnalyzer tpr.tdb";
|
||||
system(run_tpr.c_str());
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user