73 lines
2.1 KiB
C++
73 lines
2.1 KiB
C++
/*
|
|
* main.cpp
|
|
*
|
|
* Created on: Mar 16, 2014
|
|
* Author: robert
|
|
*/
|
|
|
|
#include <iostream>
|
|
#include <systemc.h>
|
|
#include <fstream>
|
|
#include <algorithm>
|
|
#include <string>
|
|
#include "../common/TlmRecorder.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>
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
|
|
string pathOfFile(string file)
|
|
{
|
|
return file.substr(0, file.find_last_of('/'));
|
|
}
|
|
|
|
int sc_main(int argc, char **argv)
|
|
{
|
|
sc_set_time_resolution(1, SC_NS);
|
|
|
|
string resources = pathOfFile(argv[0]) + string("/../resources/");
|
|
xmlAddressDecoder::addressConfigURI = resources + string("configs/addressConfig.xml");
|
|
TlmRecorder recorder("tpr.tdb", resources + string("scripts/createTraceDB.sql"));
|
|
TracePlayer<> player("player", resources + string("traces/mediabench-adpcmdecode_32.stl"));
|
|
//TracePlayer<> player("player", resources + string("traces/mediabench-h263encode_32.stl"));
|
|
|
|
Dram<> dram("dram");
|
|
Arbiter<> arbiter("arbiter");
|
|
ControllerWrapper<> controller("controller", recorder);
|
|
|
|
player.iSocket.bind(arbiter.tSockets[0]);
|
|
arbiter.iSocket.bind(controller.tSocket);
|
|
controller.iSocket.bind(dram.tSocket);
|
|
|
|
// DebugManager::getInstance().addToWhiteList(Sender::TraceRecorder);
|
|
// DebugManager::getInstance().addToWhiteList(Sender::TracePlayer);
|
|
DebugManager::getInstance().addToWhiteList(Sender::DramWrapper);
|
|
DebugManager::getInstance().addToWhiteList(Sender::DramController);
|
|
|
|
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;
|
|
|
|
recorder.closeConnection();
|
|
cout << "Simulation took " << elapsed_secs << " seconds." << endl;
|
|
|
|
string testingScript = resources + string("/scripts/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;
|
|
}
|
|
|