Merge branch 'clock_sync' into 'develop'

Fix clock sync in STL player.

See merge request ems/astdm/dram.sys!278
This commit is contained in:
Lukas Steiner
2021-05-05 14:04:26 +00:00
4 changed files with 7 additions and 10 deletions

View File

@@ -126,7 +126,8 @@ void ArbiterReorder::end_of_elaboration()
tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload,
tlm_phase &phase, sc_time &fwDelay)
{
sc_time notDelay = std::ceil((sc_time_stamp() + fwDelay) / tCK) * tCK - sc_time_stamp();
sc_time clockOffset = (sc_time_stamp() + fwDelay) % tCK;
sc_time notDelay = (clockOffset == SC_ZERO_TIME) ? fwDelay : (fwDelay + tCK - clockOffset);
if (phase == BEGIN_REQ)
{

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,