86 lines
2.2 KiB
C++
86 lines
2.2 KiB
C++
/*
|
|
* Simulation.h
|
|
*
|
|
* Created on: Apr 4, 2014
|
|
* Author: jonny
|
|
*/
|
|
|
|
#ifndef SIMULATION_H_
|
|
#define SIMULATION_H_
|
|
|
|
#include "Dram.h"
|
|
#include "Arbiter.h"
|
|
#include "TracePlayer.h"
|
|
#include "../controller/Controller.h"
|
|
#include "ISimulation.h"
|
|
#include <string>
|
|
#include <systemc.h>
|
|
|
|
namespace simulation {
|
|
|
|
struct DramSetup
|
|
{
|
|
DramSetup():memconfig(""),memspec(""){}
|
|
DramSetup(std::string memconfig, std::string memspec, std::string addressmapping) : memconfig(memconfig), memspec(memspec), addressmapping(addressmapping) {}
|
|
std::string memconfig;
|
|
std::string memspec;
|
|
std::string addressmapping;
|
|
};
|
|
|
|
struct Device
|
|
{
|
|
Device():trace("empty.stl"), burstLength(0){}
|
|
Device(std::string trace, unsigned int clkMhz, unsigned int burstLength = 8) : trace(trace), clkMhz (clkMhz), burstLength(burstLength)
|
|
{
|
|
}
|
|
std::string trace;
|
|
unsigned int clkMhz;
|
|
unsigned int burstLength;
|
|
};
|
|
|
|
class Simulation: public ISimulation, public sc_module
|
|
{
|
|
public:
|
|
SC_HAS_PROCESS(Simulation);
|
|
Simulation(sc_module_name name, string pathToResources, string traceName, DramSetup setup,
|
|
std::vector<Device> devices);
|
|
~Simulation();
|
|
|
|
void start();
|
|
void stop();
|
|
|
|
void inline transactionFinished() override;
|
|
constexpr static unsigned int NumberOfTracePlayers = 4;
|
|
|
|
private:
|
|
std::string traceName;
|
|
DramSetup dramSetup;
|
|
|
|
sc_event terminateSimulation;
|
|
|
|
Dram<> *dram;
|
|
Arbiter<NumberOfTracePlayers, 128> *arbiter;
|
|
Controller<> *controller;
|
|
|
|
TracePlayer<> *player1;
|
|
TracePlayer<> *player2;
|
|
TracePlayer<> *player3;
|
|
TracePlayer<> *player4;
|
|
|
|
unsigned int totalTransactions;
|
|
unsigned int remainingTransactions;
|
|
clock_t simulationStartTime;
|
|
unsigned int getNumberOfLines(string uri);
|
|
|
|
void report(std::string message);
|
|
void setupDebugManager(const string& traceName);
|
|
void setupTlmRecorder(const string &traceName, const string &pathToResources, const DramSetup &setup, const std::vector<Device> &devices);
|
|
void instantiateModules(const string &pathToResources, const std::vector<Device> &devices);
|
|
void bindSockets();
|
|
void calculateNumberOfTransaction(std::vector<Device> devices, string pathToResources);
|
|
};
|
|
|
|
} /* namespace simulation */
|
|
|
|
#endif /* SIMULATIONMANAGER_H_ */
|