Now players are created dynamically based on the number of players.
This commit is contained in:
@@ -32,23 +32,22 @@
|
||||
* Authors:
|
||||
* Robert Gernhardt
|
||||
* Matthias Jung
|
||||
* Eder F. Zulian
|
||||
*/
|
||||
|
||||
#ifndef ARBITER_H_
|
||||
#define ARBITER_H_
|
||||
|
||||
|
||||
#include <deque>
|
||||
#include <tlm.h>
|
||||
#include <systemc.h>
|
||||
#include <iostream>
|
||||
#include <tlm_utils/simple_target_socket.h>
|
||||
#include <tlm_utils/simple_initiator_socket.h>
|
||||
#include <tlm_utils/peq_with_cb_and_phase.h>
|
||||
#include "../common/xmlAddressdecoder.h"
|
||||
#include "../common/dramExtension.h"
|
||||
#include "../controller/core/TimingCalculation.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
|
||||
@@ -32,21 +32,22 @@
|
||||
* Authors:
|
||||
* Janik Schlemminger
|
||||
* Matthias Jung
|
||||
* Eder F. Zulian
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include "Simulation.h"
|
||||
#include "../common/TlmRecorder.h"
|
||||
#include "../common/DebugManager.h"
|
||||
#include "../common/xmlAddressdecoder.h"
|
||||
#include "../controller/core/ControllerCore.h"
|
||||
#include "../controller/core/configuration/ConfigurationLoader.h"
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include "../common/Utils.h"
|
||||
#include "../error/flip_memory.h"
|
||||
#include "StlPlayer.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -108,26 +109,19 @@ void Simulation::instantiateModules(const string &pathToResources, const std::ve
|
||||
// The number of channels is equal the number of controllers and comes from config.
|
||||
controller = new Controller<>("controller");
|
||||
|
||||
//TODO: this depends (or should depend) on config... Should be dynamic not fixed to four!
|
||||
#if 0
|
||||
vector<StlPlayer> players;
|
||||
for (int i = 0; i < NumberOfTracePlayers; i++) {
|
||||
for (size_t i = 0; i < NumberOfTracePlayers; i++) {
|
||||
std::string playerStr = "player" + std::to_string(i);
|
||||
players.push_back(new StlPlayer<>(playerStr, pathToResources + string("traces/") + devices[0].trace, devices[0].clkMhz, this));
|
||||
TracePlayer<> *player = new StlPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
players.push_back(player);
|
||||
}
|
||||
#endif
|
||||
player1 = new StlPlayer<>("player1", pathToResources + string("traces/") + devices[0].trace, devices[0].clkMhz, this);
|
||||
player2 = new StlPlayer<>("player2", pathToResources + string("traces/") + devices[1].trace, devices[1].clkMhz, this);
|
||||
player3 = new StlPlayer<>("player3", pathToResources + string("traces/") + devices[2].trace, devices[2].clkMhz, this);
|
||||
player4 = new StlPlayer<>("player4", pathToResources + string("traces/") + devices[3].trace, devices[3].clkMhz, this);
|
||||
}
|
||||
|
||||
void Simulation::bindSockets()
|
||||
{
|
||||
player1->iSocket.bind(arbiter->tSockets[0]);
|
||||
player2->iSocket.bind(arbiter->tSockets[1]);
|
||||
player3->iSocket.bind(arbiter->tSockets[2]);
|
||||
player4->iSocket.bind(arbiter->tSockets[3]);
|
||||
int i = 0;
|
||||
for (auto player : players) {
|
||||
player->iSocket.bind(arbiter->tSockets[i++]);
|
||||
}
|
||||
|
||||
// TODO: the number of controllers should be the number of channesl, right?!
|
||||
// each of the arbiter's initiators sockets should bind to a controller...
|
||||
@@ -142,10 +136,10 @@ Simulation::~Simulation()
|
||||
delete arbiter;
|
||||
// TODO: the number of components should come from config
|
||||
delete controller;
|
||||
delete player1;
|
||||
delete player2;
|
||||
delete player3;
|
||||
delete player4;
|
||||
|
||||
for (auto player : players) {
|
||||
delete player;
|
||||
}
|
||||
}
|
||||
|
||||
void Simulation::start()
|
||||
@@ -156,11 +150,11 @@ void Simulation::start()
|
||||
report(" -> memspec: \t\t" + Configuration::getInstance().memSpec.MemoryId);
|
||||
cout << endl;
|
||||
simulationStartTime = clock();
|
||||
// TODO: the number of components should come from config
|
||||
player1->nextPayload();
|
||||
player2->nextPayload();
|
||||
player3->nextPayload();
|
||||
player4->nextPayload();
|
||||
|
||||
for (auto player : players) {
|
||||
player->nextPayload();
|
||||
}
|
||||
|
||||
sc_set_stop_mode(SC_STOP_FINISH_DELTA);
|
||||
sc_start();
|
||||
}
|
||||
|
||||
@@ -32,20 +32,23 @@
|
||||
* Authors:
|
||||
* Janik Schlemminger
|
||||
* Matthias Jung
|
||||
* Eder F. Zulian
|
||||
*/
|
||||
|
||||
#ifndef SIMULATION_H_
|
||||
#define SIMULATION_H_
|
||||
|
||||
#include <string>
|
||||
#include <systemc.h>
|
||||
|
||||
#include "Dram.h"
|
||||
#include "Arbiter.h"
|
||||
#include "TracePlayer.h"
|
||||
#include "TraceGenerator.h"
|
||||
#include "ReorderBuffer.h"
|
||||
#include "../controller/Controller.h"
|
||||
#include <string>
|
||||
#include <systemc.h>
|
||||
#include "TracePlayerListener.h"
|
||||
#include "StlPlayer.h"
|
||||
#include "../controller/Controller.h"
|
||||
#include "../common/third_party/tinyxml2/tinyxml2.h"
|
||||
#include "../error/flip_memory.h"
|
||||
|
||||
@@ -102,11 +105,8 @@ private:
|
||||
Controller<> *controller;
|
||||
ReorderBuffer<> *reorder;
|
||||
|
||||
// TODO: here should be a vector or some other abstract data type and elements should be dynamically allocated based on configuration
|
||||
TracePlayer<> *player1;
|
||||
TracePlayer<> *player2;
|
||||
TracePlayer<> *player3;
|
||||
TracePlayer<> *player4;
|
||||
// A vector of pointers to all trace player (that represent devices which acquire the bus and generate transactions targeting the memory)
|
||||
std::vector<TracePlayer<>*> players;
|
||||
|
||||
clock_t simulationStartTime;
|
||||
void report(std::string message);
|
||||
|
||||
Reference in New Issue
Block a user