powerdown manager. simulation manager introduced

This commit is contained in:
Janik Schlemminger
2014-04-05 12:18:34 +02:00
parent 0e07876071
commit 2145f3b18c
43 changed files with 823 additions and 956 deletions

View File

@@ -6,83 +6,26 @@
*/
#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>
#include <time.h>
#include "SimulationManager.h"
using namespace std;
using namespace simulation;
string pathOfFile(string file)
{
return file.substr(0, file.find_last_of('/'));
}
void endOfTrace_callback()
{
static int finishedPlayers = 0;
finishedPlayers++;
if(finishedPlayers == 2)
{
sc_stop();
}
}
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");
time_t rawtime;
time (&rawtime);
// string tracename = c_time(&rawtime) + string(".tdb");
string tracename = string("tpr.tdb");
TlmRecorder recorder(tracename, resources + string("scripts/createTraceDB.sql"));
TracePlayer<> player("player", resources + string("traces/mediabench-fractal_32.stl"),endOfTrace_callback, 0);
TracePlayer<> player2("player2", resources + string("traces/mediabench-jpegdecode_32.stl"),endOfTrace_callback, 1);
//TracePlayer<> player("player", resources + string("traces/trace2.stl"),endOfTrace_callback, 0);
//TracePlayer<> player2("player2", resources + string("traces/chstone-aes_32.stl"),endOfTrace_callback, 1);
Dram<> dram("dram");
Arbiter<2,128> arbiter("arbiter");
ControllerWrapper<> controller("controller", recorder);
player.iSocket.bind(arbiter.tSockets[0]);
player2.iSocket.bind(arbiter.tSockets[1]);
arbiter.iSocket.bind(controller.tSocket);
controller.iSocket.bind(dram.tSocket);
DebugManager::getInstance().addToWhiteList({Sender::TracePlayer, Sender::TraceRecorder, Sender::DramWrapper, Sender::DramController, Sender::PowerDownManager});
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 run_tpr = "/home/robert/analyzer/build/traceAnalyzer " + tracename;
system(run_tpr.c_str());
string stl1 = "chstone-mips_32.stl";
string stl2 = "chstone-motion_32.stl";
SimulationManager simulationManager("sim",stl1,stl2,"tpr.tdb", resources);
simulationManager.startSimulation();
return 0;
}