Fix clock sync in STL player.

This commit is contained in:
Lukas Steiner
2021-05-05 15:55:06 +02:00
parent 3c476f4925
commit 9b7e2611ef
3 changed files with 5 additions and 9 deletions

View File

@@ -101,18 +101,18 @@ void StlPlayer::nextPayload()
payload->set_command(lineIterator->cmd);
std::copy(lineIterator->data.begin(), lineIterator->data.end(), payload->get_data_ptr());
sc_time sendingOffset;
sc_time sendingTime;
sc_time sendingOffset;
if (lastEndReq == sc_time_stamp())
sendingOffset = playerClk;
else
if (numberOfTransactions == 1)
sendingOffset = SC_ZERO_TIME;
else
sendingOffset = playerClk - (sc_time_stamp() % playerClk);
if (!relative)
sendingTime = std::max(sc_time_stamp() + sendingOffset, lineIterator->sendingTime);
else
sendingTime = sc_time_stamp() + std::max(sendingOffset, lineIterator->sendingTime);
sendingTime = sc_time_stamp() + sendingOffset + lineIterator->sendingTime;
sendToTarget(*payload, BEGIN_REQ, sendingTime - sc_time_stamp());

View File

@@ -72,10 +72,7 @@ void TracePlayer::peqCallback(tlm_generic_payload &payload,
const tlm_phase &phase)
{
if (phase == END_REQ)
{
lastEndReq = sc_time_stamp();
nextPayload();
}
else if (phase == BEGIN_RESP)
{
payload.release();

View File

@@ -69,7 +69,6 @@ protected:
uint64_t numberOfTransactions = 0;
uint64_t transactionsSent = 0;
bool finished = false;
sc_time lastEndReq = sc_max_time();
private:
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase,