Issue#12 - removal of BUSWIDTH from modules
This commit is contained in:
@@ -104,7 +104,9 @@ SOURCES += \
|
||||
src/controller/scheduler/IScheduler.cpp \
|
||||
src/controller/scheduler/FifoStrict.cpp \
|
||||
src/error/errormodel.cpp \
|
||||
src/controller/Controller.cpp
|
||||
src/controller/Controller.cpp \
|
||||
src/simulation/TracePlayer.cpp \
|
||||
src/simulation/StlPlayer.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/common/third_party/tinyxml2/tinyxml2.h \
|
||||
|
||||
@@ -116,20 +116,20 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT
|
||||
|
||||
for (size_t i = 0; i < Configuration::getInstance().NumberOfTracePlayers; i++) {
|
||||
std::string playerStr = "tracePlayer" + std::to_string(i);
|
||||
TracePlayer<> *player;
|
||||
TracePlayer *player;
|
||||
// When data should be stored during the simulation the StlDataPlayer is needed.
|
||||
// Else: no data should be stored, for instance to get a faster simulation
|
||||
// or if you simply dont care about the data the normal StlPlayer is used.
|
||||
if(Configuration::getInstance().ErrorStoreMode == ErrorStorageMode::NoStorage)
|
||||
{
|
||||
StlPlayer<> *newPlayer = new StlPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
StlPlayer *newPlayer = new StlPlayer(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
player = newPlayer;
|
||||
newPlayer->getTraceLength(pathToResources + string("traces/") + devices[i].trace);
|
||||
totalTransactions += newPlayer->getNumberOfLines(pathToResources + string("traces/") + devices[i].trace);
|
||||
}
|
||||
else
|
||||
{
|
||||
StlDataPlayer<> *newPlayer = new StlDataPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
StlDataPlayer *newPlayer = new StlDataPlayer(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
|
||||
player = newPlayer;
|
||||
newPlayer->getTraceLength(pathToResources + string("traces/") + devices[i].trace);
|
||||
totalTransactions += newPlayer->getNumberOfLines(pathToResources + string("traces/") + devices[i].trace);
|
||||
|
||||
@@ -96,15 +96,15 @@ private:
|
||||
|
||||
// A vector of pointers to all trace player (devices which acquire the bus
|
||||
// and initiate transactions targeting the memory)
|
||||
std::vector<TracePlayer<>*> players;
|
||||
std::vector<TracePlayer*> players;
|
||||
// All transactions pass through the same arbiter
|
||||
Arbiter *arbiter;
|
||||
// Each DRAM unit has a controller
|
||||
std::vector<Controller *> controllers;
|
||||
std::vector<Controller*> controllers;
|
||||
// TODO: Each DRAM has a reorder buffer (check this!)
|
||||
ReorderBuffer *reorder;
|
||||
// DRAM units
|
||||
std::vector<Dram *> drams;
|
||||
std::vector<Dram*> drams;
|
||||
// Transaction Recorders (one per channel). They generate the output databases.
|
||||
std::vector<TlmRecorder*> tlmRecorders;
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
void setupTlmRecorders(const string &traceName, const string &pathToResources, const std::vector<Device> &devices);
|
||||
void instantiateModules(const string &traceName, const string &pathToResources, const std::vector<Device> &devices);
|
||||
void bindSockets();
|
||||
void setupDebugManager(const string& traceName);
|
||||
void setupDebugManager(const string &traceName);
|
||||
};
|
||||
|
||||
#endif /* SIMULATIONMANAGER_H_ */
|
||||
|
||||
@@ -45,8 +45,7 @@
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
|
||||
template<unsigned int BUSWIDTH = 128>
|
||||
struct StlDataPlayer: public TracePlayer<BUSWIDTH>
|
||||
struct StlDataPlayer: public TracePlayer
|
||||
{
|
||||
public:
|
||||
StlDataPlayer(sc_module_name /*name*/, string pathToTrace, unsigned int clkMhz, TracePlayerListener* listener);
|
||||
@@ -199,10 +198,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
StlDataPlayer<BUSWIDTH>::StlDataPlayer(sc_module_name /*name*/, string pathToTrace, unsigned int clkMhz,
|
||||
StlDataPlayer::StlDataPlayer(sc_module_name /*name*/, string pathToTrace, unsigned int clkMhz,
|
||||
TracePlayerListener* listener) :
|
||||
TracePlayer<BUSWIDTH>(listener),file(pathToTrace)
|
||||
TracePlayer(listener),file(pathToTrace)
|
||||
{
|
||||
if (!file.is_open())
|
||||
SC_REPORT_FATAL(0, (string("Could not open trace ") + pathToTrace).c_str());
|
||||
|
||||
55
DRAMSys/simulator/src/simulation/StlPlayer.cpp
Normal file
55
DRAMSys/simulator/src/simulation/StlPlayer.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2015, University of Kaiserslautern
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors:
|
||||
* Janik Schlemminger
|
||||
* Robert Gernhardt
|
||||
* Matthias Jung
|
||||
*/
|
||||
|
||||
#include "StlPlayer.h"
|
||||
|
||||
|
||||
StlPlayer::StlPlayer(sc_module_name /*name*/, string pathToTrace, unsigned int clkMhz,
|
||||
TracePlayerListener* listener) :
|
||||
TracePlayer(listener),file(pathToTrace)
|
||||
{
|
||||
if (!file.is_open())
|
||||
SC_REPORT_FATAL(0, (string("Could not open trace ") + pathToTrace).c_str());
|
||||
|
||||
if(clkMhz == 0)
|
||||
clk = Configuration::getInstance().memSpec.clk;
|
||||
else
|
||||
clk = FrequencyToClk(clkMhz);
|
||||
|
||||
this->burstlength = Configuration::getInstance().memSpec.BurstLength;
|
||||
this->bytesPerColumn = xmlAddressDecoder::getInstance().amount["bytes"];
|
||||
}
|
||||
@@ -45,8 +45,7 @@
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
|
||||
template<unsigned int BUSWIDTH = 128>
|
||||
struct StlPlayer: public TracePlayer<BUSWIDTH>
|
||||
struct StlPlayer: public TracePlayer
|
||||
{
|
||||
public:
|
||||
StlPlayer(sc_module_name /*name*/, string pathToTrace, unsigned int clkMhz, TracePlayerListener *listener);
|
||||
@@ -185,23 +184,4 @@ private:
|
||||
sc_time clk;
|
||||
};
|
||||
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
StlPlayer<BUSWIDTH>::StlPlayer(sc_module_name /*name*/, string pathToTrace, unsigned int clkMhz,
|
||||
TracePlayerListener* listener) :
|
||||
TracePlayer<BUSWIDTH>(listener),file(pathToTrace)
|
||||
{
|
||||
if (!file.is_open())
|
||||
SC_REPORT_FATAL(0, (string("Could not open trace ") + pathToTrace).c_str());
|
||||
|
||||
if(clkMhz == 0)
|
||||
clk = Configuration::getInstance().memSpec.clk;
|
||||
else
|
||||
clk = FrequencyToClk(clkMhz);
|
||||
|
||||
this->burstlength = Configuration::getInstance().memSpec.BurstLength;
|
||||
this->bytesPerColumn = xmlAddressDecoder::getInstance().amount["bytes"];
|
||||
}
|
||||
|
||||
#endif // STLPLAYER_H
|
||||
|
||||
|
||||
@@ -44,12 +44,19 @@
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
|
||||
template<unsigned int BUSWIDTH = 128>
|
||||
struct TraceGenerator: public TracePlayer<BUSWIDTH>
|
||||
struct TraceGenerator: public TracePlayer
|
||||
{
|
||||
public:
|
||||
TraceGenerator(sc_module_name /*name*/, unsigned int clkMhz,
|
||||
TracePlayerListener* listener);
|
||||
TracePlayerListener* listener) : TracePlayer(listener), transCounter(0)
|
||||
{
|
||||
if(clkMhz == 0)
|
||||
clk = Configuration::getInstance().memSpec.clk;
|
||||
else
|
||||
clk = FrequencyToClk(clkMhz);
|
||||
|
||||
this->burstlenght = Configuration::getInstance().memSpec.BurstLength;
|
||||
}
|
||||
|
||||
virtual void nextPayload() override
|
||||
{
|
||||
@@ -67,32 +74,18 @@ public:
|
||||
payload->set_dmi_allowed(false);
|
||||
payload->set_byte_enable_length(0);
|
||||
payload->set_streaming_width(this->burstlenght);
|
||||
this->setDataPointer(payload, dataElement);
|
||||
this->setDataPointer(payload, dataElement, 16);
|
||||
payload->set_command(TLM_READ_COMMAND);
|
||||
|
||||
transCounter++;
|
||||
this->payloadEventQueue.notify(*payload, BEGIN_REQ, SC_ZERO_TIME);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned int burstlenght;
|
||||
sc_time clk;
|
||||
unsigned int transCounter;
|
||||
};
|
||||
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
TraceGenerator<BUSWIDTH>::TraceGenerator(sc_module_name /*name*/, unsigned int clkMhz,
|
||||
TracePlayerListener* listener) :
|
||||
TracePlayer<BUSWIDTH>(listener), transCounter(0)
|
||||
{
|
||||
if(clkMhz == 0)
|
||||
clk = Configuration::getInstance().memSpec.clk;
|
||||
else
|
||||
clk = FrequencyToClk(clkMhz);
|
||||
|
||||
this->burstlenght = Configuration::getInstance().memSpec.BurstLength;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
108
DRAMSys/simulator/src/simulation/TracePlayer.cpp
Normal file
108
DRAMSys/simulator/src/simulation/TracePlayer.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2015, University of Kaiserslautern
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
|
||||
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Authors:
|
||||
* Robert Gernhardt
|
||||
* Matthias Jung
|
||||
*/
|
||||
|
||||
#include "TracePlayer.h"
|
||||
|
||||
TracePlayer::TracePlayer(TracePlayerListener* listener) :
|
||||
payloadEventQueue(this, &TracePlayer::peqCallback), transactionsSent(0), listener(listener)
|
||||
{
|
||||
iSocket.register_nb_transport_bw(this, &TracePlayer::nb_transport_bw);
|
||||
}
|
||||
|
||||
gp *TracePlayer::allocatePayload()
|
||||
{
|
||||
return memoryManager.allocate();
|
||||
}
|
||||
|
||||
void TracePlayer::terminate()
|
||||
{
|
||||
cout << sc_time_stamp() << " " << this->name() << " terminated " << std::endl;
|
||||
listener->tracePlayerTerminates();
|
||||
}
|
||||
|
||||
void TracePlayer::printDebugMessage(std::string message)
|
||||
{
|
||||
DebugManager::getInstance().printDebugMessage(this->name(), message);
|
||||
}
|
||||
|
||||
//TODO: this doesn't depend on the tracePlayer, move it somewhere
|
||||
void TracePlayer::setDataPointer(gp* payload, unsigned char * dataElement, unsigned int size)
|
||||
{
|
||||
//check if payload takes ownership
|
||||
payload->set_data_length(size);
|
||||
payload->set_data_ptr(dataElement);
|
||||
for(unsigned i = 0; i < size; i++)
|
||||
dataElement[i] = 0;
|
||||
}
|
||||
|
||||
tlm_sync_enum TracePlayer::nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay)
|
||||
{
|
||||
payloadEventQueue.notify(payload, phase, bwDelay);
|
||||
return TLM_ACCEPTED;
|
||||
}
|
||||
|
||||
void TracePlayer::peqCallback(tlm_generic_payload &payload, const tlm_phase &phase)
|
||||
{
|
||||
|
||||
if (phase == BEGIN_REQ)
|
||||
{
|
||||
payload.acquire();
|
||||
GenerationExtension* genExtension = new GenerationExtension(sc_time_stamp());
|
||||
payload.set_auto_extension(genExtension);
|
||||
sendToTarget(payload, phase, SC_ZERO_TIME);
|
||||
|
||||
transactionsSent++;
|
||||
DebugManager::getInstance().printDebugMessage(name(), "Performing request #" + std::to_string(transactionsSent));
|
||||
}
|
||||
else if (phase == END_REQ)
|
||||
{
|
||||
nextPayload();
|
||||
}
|
||||
else if (phase == BEGIN_RESP)
|
||||
{
|
||||
sendToTarget(payload, END_RESP, SC_ZERO_TIME);
|
||||
payload.release();
|
||||
if(Configuration::getInstance().SimulationProgressBar)
|
||||
listener->transactionFinished();
|
||||
}
|
||||
else if (phase == END_RESP)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL(0, "TracePlayer PEQ was triggered with unknown phase");
|
||||
}
|
||||
}
|
||||
@@ -55,12 +55,11 @@
|
||||
using namespace std;
|
||||
using namespace tlm;
|
||||
|
||||
template<unsigned int BUSWIDTH = 128>
|
||||
struct TracePlayer: public sc_module
|
||||
{
|
||||
public:
|
||||
tlm_utils::simple_initiator_socket<TracePlayer> iSocket;
|
||||
TracePlayer(TracePlayerListener* listener);
|
||||
TracePlayer(TracePlayerListener *listener);
|
||||
virtual void nextPayload() = 0;
|
||||
|
||||
protected:
|
||||
@@ -73,112 +72,15 @@ protected:
|
||||
private:
|
||||
tlm_sync_enum nb_transport_bw(tlm_generic_payload& payload, tlm_phase& phase, sc_time& bwDelay);
|
||||
void peqCallback(tlm_generic_payload& payload, const tlm_phase& phase);
|
||||
void sendToTarget(tlm_generic_payload& payload, const tlm_phase& phase, const sc_time& delay);
|
||||
|
||||
void sendToTarget(tlm_generic_payload &payload, const tlm_phase &phase, const sc_time &delay)
|
||||
{
|
||||
tlm_phase TPhase = phase;
|
||||
sc_time TDelay = delay;
|
||||
iSocket->nb_transport_fw(payload, TPhase, TDelay);
|
||||
}
|
||||
MemoryManager memoryManager;
|
||||
unsigned int transactionsSent;
|
||||
TracePlayerListener* listener;
|
||||
};
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
TracePlayer<BUSWIDTH>::TracePlayer(TracePlayerListener* listener) :
|
||||
payloadEventQueue(this, &TracePlayer<BUSWIDTH>::peqCallback), transactionsSent(0), listener(listener)
|
||||
{
|
||||
iSocket.register_nb_transport_bw(this, &TracePlayer<BUSWIDTH>::nb_transport_bw);
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
gp *TracePlayer<BUSWIDTH>::allocatePayload()
|
||||
{
|
||||
return memoryManager.allocate();
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
void TracePlayer<BUSWIDTH>::terminate()
|
||||
{
|
||||
cout << sc_time_stamp() << " " << this->name() << " terminated " << std::endl;
|
||||
listener->tracePlayerTerminates();
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
void TracePlayer<BUSWIDTH>::printDebugMessage(std::string message)
|
||||
{
|
||||
DebugManager::getInstance().printDebugMessage(this->name(), message);
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
//TODO: this doesn't depend on the tracePlayer, move it somewhere
|
||||
void TracePlayer<BUSWIDTH>::setDataPointer(gp* payload, unsigned char * dataElement, unsigned int size)
|
||||
{
|
||||
//check if payload takes ownership
|
||||
payload->set_data_length(size);
|
||||
payload->set_data_ptr(dataElement);
|
||||
for(unsigned i = 0; i < size; i++)
|
||||
dataElement[i] = 0;
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
tlm_sync_enum TracePlayer<BUSWIDTH>::nb_transport_bw(tlm_generic_payload &payload, tlm_phase &phase, sc_time &bwDelay)
|
||||
{
|
||||
payloadEventQueue.notify(payload, phase, bwDelay);
|
||||
return TLM_ACCEPTED;
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
void TracePlayer<BUSWIDTH>::peqCallback(tlm_generic_payload &payload, const tlm_phase &phase)
|
||||
{
|
||||
|
||||
if (phase == BEGIN_REQ)
|
||||
{
|
||||
payload.acquire();
|
||||
GenerationExtension* genExtension = new GenerationExtension(sc_time_stamp());
|
||||
payload.set_auto_extension(genExtension);
|
||||
sendToTarget(payload, phase, SC_ZERO_TIME);
|
||||
|
||||
transactionsSent++;
|
||||
DebugManager::getInstance().printDebugMessage(name(), "Performing request #" + std::to_string(transactionsSent));
|
||||
}
|
||||
else if (phase == END_REQ)
|
||||
{
|
||||
nextPayload();
|
||||
}
|
||||
else if (phase == BEGIN_RESP)
|
||||
{
|
||||
//TODO: cleanup:
|
||||
// unsigned char * dataElement = payload.get_data_ptr();
|
||||
//
|
||||
// if(payload.get_command() == TLM_READ_COMMAND)
|
||||
// {
|
||||
// cout << "0x";
|
||||
// for(int i=0; i < 16*2; i++)
|
||||
// {
|
||||
// cout << hex << int(dataElement[i]);
|
||||
// }
|
||||
// cout << endl;
|
||||
// }
|
||||
|
||||
sendToTarget(payload, END_RESP, SC_ZERO_TIME);
|
||||
payload.release();
|
||||
if(Configuration::getInstance().SimulationProgressBar)
|
||||
listener->transactionFinished();
|
||||
|
||||
}
|
||||
else if (phase == END_RESP)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL(0, "TracePlayer PEQ was triggered with unknown phase");
|
||||
}
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
void TracePlayer<BUSWIDTH>::sendToTarget(tlm_generic_payload &payload, const tlm_phase &phase, const sc_time &delay)
|
||||
{
|
||||
tlm_phase TPhase = phase;
|
||||
sc_time TDelay = delay;
|
||||
iSocket->nb_transport_fw(payload, TPhase, TDelay);
|
||||
}
|
||||
|
||||
#endif /* TRACEPLAYER_H_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user