Merge branch 'bugfix/initiator' into 'develop'

Fix a timing issue in the traffic initiator

See merge request ems/astdm/modeling.dram/dram.sys.5!37
This commit is contained in:
Lukas Steiner
2023-08-14 09:14:50 +00:00
2 changed files with 15 additions and 4 deletions

View File

@@ -81,13 +81,21 @@ void RequestIssuer::sendNextRequest()
tlm::tlm_phase phase = tlm::BEGIN_REQ; tlm::tlm_phase phase = tlm::BEGIN_REQ;
sc_core::sc_time delay = request.delay; sc_core::sc_time delay = request.delay;
// Align to next clock sc_core::sc_time sendingTime = sc_core::sc_time_stamp() + delay;
if (delay < clkPeriod && transactionsSent != 0)
bool needsOffset = (sendingTime % clkPeriod) != sc_core::SC_ZERO_TIME;
if (needsOffset)
{ {
delay = delay + clkPeriod; sendingTime += clkPeriod;
delay -= delay % clkPeriod; sendingTime -= sendingTime % clkPeriod;
} }
if (sendingTime == lastEndRequest)
{
sendingTime += clkPeriod;
}
delay = sendingTime - sc_core::sc_time_stamp();
iSocket->nb_transport_fw(payload, phase, delay); iSocket->nb_transport_fw(payload, phase, delay);
if (request.command == Request::Command::Read) if (request.command == Request::Command::Read)
@@ -116,6 +124,8 @@ void RequestIssuer::peqCallback(tlm::tlm_generic_payload &payload, const tlm::tl
{ {
if (phase == tlm::END_REQ) if (phase == tlm::END_REQ)
{ {
lastEndRequest = sc_core::sc_time_stamp();
if (nextRequestSendable()) if (nextRequestSendable())
sendNextRequest(); sendNextRequest();
else else

View File

@@ -71,6 +71,7 @@ private:
uint64_t transactionsSent = 0; uint64_t transactionsSent = 0;
uint64_t transactionsReceived = 0; uint64_t transactionsReceived = 0;
sc_core::sc_time lastEndRequest = sc_core::sc_max_time();
unsigned int pendingReadRequests = 0; unsigned int pendingReadRequests = 0;
unsigned int pendingWriteRequests = 0; unsigned int pendingWriteRequests = 0;