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;
sc_core::sc_time delay = request.delay;
// Align to next clock
if (delay < clkPeriod && transactionsSent != 0)
sc_core::sc_time sendingTime = sc_core::sc_time_stamp() + delay;
bool needsOffset = (sendingTime % clkPeriod) != sc_core::SC_ZERO_TIME;
if (needsOffset)
{
delay = delay + clkPeriod;
delay -= delay % clkPeriod;
sendingTime += clkPeriod;
sendingTime -= sendingTime % clkPeriod;
}
if (sendingTime == lastEndRequest)
{
sendingTime += clkPeriod;
}
delay = sendingTime - sc_core::sc_time_stamp();
iSocket->nb_transport_fw(payload, phase, delay);
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)
{
lastEndRequest = sc_core::sc_time_stamp();
if (nextRequestSendable())
sendNextRequest();
else

View File

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