Directly call arbiter PEQ from trace player.
This commit is contained in:
@@ -103,16 +103,16 @@ void StlPlayer::nextPayload()
|
||||
|
||||
if (!relative)
|
||||
{
|
||||
// Send the transaction directly or schedule it to be sent in the future.
|
||||
if (lineIterator->sendingTime <= sc_time_stamp())
|
||||
payloadEventQueue.notify(*payload, tlm::BEGIN_REQ, SC_ZERO_TIME);
|
||||
sendToTarget(*payload, BEGIN_REQ, SC_ZERO_TIME);
|
||||
else
|
||||
payloadEventQueue.notify(*payload, tlm::BEGIN_REQ,
|
||||
lineIterator->sendingTime - sc_time_stamp());
|
||||
sendToTarget(*payload, BEGIN_REQ, lineIterator->sendingTime - sc_time_stamp());
|
||||
}
|
||||
else
|
||||
payloadEventQueue.notify(*payload, tlm::BEGIN_REQ, lineIterator->sendingTime);
|
||||
sendToTarget(*payload, BEGIN_REQ, lineIterator->sendingTime);
|
||||
|
||||
transactionsSent++;
|
||||
PRINTDEBUGMESSAGE(name(), "Performing request #" + std::to_string(transactionsSent));
|
||||
lineIterator++;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ TracePlayer::TracePlayer(sc_module_name name, TraceSetup *setup) :
|
||||
payloadEventQueue(this, &TracePlayer::peqCallback),
|
||||
setup(setup)
|
||||
{
|
||||
SC_METHOD(nextPayload);
|
||||
iSocket.register_nb_transport_bw(this, &TracePlayer::nb_transport_bw);
|
||||
|
||||
if (Configuration::getInstance().storeMode == "NoStorage")
|
||||
@@ -75,13 +76,7 @@ tlm_sync_enum TracePlayer::nb_transport_bw(tlm_generic_payload &payload,
|
||||
void TracePlayer::peqCallback(tlm_generic_payload &payload,
|
||||
const tlm_phase &phase)
|
||||
{
|
||||
if (phase == BEGIN_REQ)
|
||||
{
|
||||
sendToTarget(payload, phase, SC_ZERO_TIME);
|
||||
transactionsSent++;
|
||||
PRINTDEBUGMESSAGE(name(), "Performing request #" + std::to_string(transactionsSent));
|
||||
}
|
||||
else if (phase == END_REQ)
|
||||
if (phase == END_REQ)
|
||||
{
|
||||
nextPayload();
|
||||
}
|
||||
@@ -97,10 +92,6 @@ void TracePlayer::peqCallback(tlm_generic_payload &payload,
|
||||
// If all answers were received:
|
||||
if (finished == true && numberOfTransactions == transactionsReceived)
|
||||
this->terminate();
|
||||
|
||||
}
|
||||
else if (phase == END_RESP)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ class TracePlayer : public sc_module
|
||||
public:
|
||||
tlm_utils::simple_initiator_socket<TracePlayer> iSocket;
|
||||
TracePlayer(sc_module_name name, TraceSetup *setup);
|
||||
SC_HAS_PROCESS(TracePlayer);
|
||||
virtual void nextPayload() = 0;
|
||||
unsigned int getNumberOfLines(std::string pathToTrace);
|
||||
|
||||
@@ -62,17 +63,17 @@ protected:
|
||||
tlm_utils::peq_with_cb_and_phase<TracePlayer> payloadEventQueue;
|
||||
void finish();
|
||||
void terminate();
|
||||
unsigned int numberOfTransactions = 0;
|
||||
bool storageEnabled = false;
|
||||
TraceSetup *setup;
|
||||
void sendToTarget(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase,
|
||||
const sc_time &delay);
|
||||
unsigned int numberOfTransactions = 0;
|
||||
unsigned int transactionsSent = 0;
|
||||
|
||||
private:
|
||||
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase,
|
||||
sc_time &bwDelay);
|
||||
void peqCallback(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase);
|
||||
void sendToTarget(tlm::tlm_generic_payload &payload, const tlm::tlm_phase &phase,
|
||||
const sc_time &delay);
|
||||
unsigned int transactionsSent = 0;
|
||||
unsigned int transactionsReceived = 0;
|
||||
bool finished = false;
|
||||
};
|
||||
|
||||
@@ -132,10 +132,6 @@ int sc_main(int argc, char **argv)
|
||||
// Store the starting of the simulation in wallclock time:
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
|
||||
// Kickstart the players:
|
||||
for (auto &p : players)
|
||||
p->nextPayload();
|
||||
|
||||
// Start SystemC Simulation:
|
||||
sc_set_stop_mode(SC_STOP_FINISH_DELTA);
|
||||
sc_start();
|
||||
|
||||
Reference in New Issue
Block a user