Adapt simple arbiter and STL player to new protocol.
This commit is contained in:
@@ -45,7 +45,8 @@ using namespace tlm;
|
||||
Arbiter::Arbiter(sc_module_name name, std::string pathToAddressMapping) :
|
||||
sc_module(name), payloadEventQueue(this, &Arbiter::peqCallback),
|
||||
maxActiveTransactions(Configuration::getInstance().maxActiveTransactions),
|
||||
tCK(Configuration::getInstance().memSpec->tCK)
|
||||
tCK(Configuration::getInstance().memSpec->tCK),
|
||||
arbitrationDelay(Configuration::getInstance().arbitrationDelay)
|
||||
{
|
||||
iSocket.register_nb_transport_bw(this, &Arbiter::nb_transport_bw);
|
||||
tSocket.register_nb_transport_fw(this, &Arbiter::nb_transport_fw);
|
||||
@@ -117,11 +118,12 @@ 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 notDelay = fwDelay;
|
||||
|
||||
if (phase == BEGIN_REQ)
|
||||
{
|
||||
notDelay = std::ceil((sc_time_stamp() + fwDelay) / tCK) * tCK - sc_time_stamp();
|
||||
|
||||
// TODO: do not adjust address permanently
|
||||
// adjust address offset:
|
||||
uint64_t adjustedAddress = payload.get_address() - Configuration::getInstance().addressOffset;
|
||||
@@ -135,8 +137,6 @@ tlm_sync_enum Arbiter::nb_transport_fw(int id, tlm_generic_payload &payload,
|
||||
payload.get_streaming_width(), 0, 0);
|
||||
payload.acquire();
|
||||
}
|
||||
else if (phase == END_RESP)
|
||||
notDelay += tCK;
|
||||
|
||||
PRINTDEBUGMESSAGE(name(), "[fw] " + getPhaseName(phase) + " notification in " +
|
||||
notDelay.to_string());
|
||||
@@ -197,7 +197,8 @@ void ArbiterSimple::peqCallback(tlm_generic_payload &cbPayload, const tlm_phase
|
||||
tlm_generic_payload &tPayload = *pendingRequests[channelId].front();
|
||||
pendingRequests[channelId].pop();
|
||||
tlm_phase tPhase = BEGIN_REQ;
|
||||
sc_time tDelay = SC_ZERO_TIME;
|
||||
// do not send two requests in the same cycle
|
||||
sc_time tDelay = tCK;
|
||||
iSocket[static_cast<int>(channelId)]->nb_transport_fw(tPayload, tPhase, tDelay);
|
||||
}
|
||||
else
|
||||
@@ -231,7 +232,8 @@ void ArbiterSimple::peqCallback(tlm_generic_payload &cbPayload, const tlm_phase
|
||||
tlm_generic_payload &tPayload = *pendingResponses[threadId].front();
|
||||
pendingResponses[threadId].pop();
|
||||
tlm_phase tPhase = BEGIN_RESP;
|
||||
sc_time tDelay = SC_ZERO_TIME;
|
||||
// do not send two responses in the same cycle
|
||||
sc_time tDelay = tCK;
|
||||
tlm_sync_enum returnValue = tSocket[static_cast<int>(threadId)]->nb_transport_bw(tPayload, tPhase, tDelay);
|
||||
if (returnValue == TLM_UPDATED)
|
||||
payloadEventQueue.notify(tPayload, tPhase, tDelay);
|
||||
@@ -266,7 +268,7 @@ void ArbiterFifo::peqCallback(tlm_generic_payload &cbPayload, const tlm_phase &c
|
||||
outstandingEndReq[threadId] = &cbPayload;
|
||||
}
|
||||
|
||||
pendingRequests[channelId].push(&cbPayload);
|
||||
pendingRequests[channelId].push(&cbPayload); // TODO: wrong, only insert when END_REQ has been sent
|
||||
|
||||
if (!channelIsBusy[channelId])
|
||||
{
|
||||
@@ -275,7 +277,7 @@ void ArbiterFifo::peqCallback(tlm_generic_payload &cbPayload, const tlm_phase &c
|
||||
tlm_generic_payload *tPayload = pendingRequests[channelId].front();
|
||||
pendingRequests[channelId].pop();
|
||||
tlm_phase tPhase = BEGIN_REQ;
|
||||
sc_time tDelay = tCK;
|
||||
sc_time tDelay = tCK; // TODO: SC_ZERO_TIME
|
||||
|
||||
iSocket[static_cast<int>(channelId)]->nb_transport_fw(*tPayload, tPhase, tDelay);
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ protected:
|
||||
unsigned int transport_dbg(int /*id*/, tlm::tlm_generic_payload &trans);
|
||||
|
||||
sc_time tCK;
|
||||
sc_time arbitrationDelay;
|
||||
};
|
||||
|
||||
class ArbiterSimple final : public Arbiter
|
||||
|
||||
@@ -101,15 +101,19 @@ void StlPlayer::nextPayload()
|
||||
payload->set_command(lineIterator->cmd);
|
||||
std::copy(lineIterator->data.begin(), lineIterator->data.end(), payload->get_data_ptr());
|
||||
|
||||
if (!relative)
|
||||
{
|
||||
if (lineIterator->sendingTime <= sc_time_stamp())
|
||||
sendToTarget(*payload, BEGIN_REQ, SC_ZERO_TIME);
|
||||
else
|
||||
sendToTarget(*payload, BEGIN_REQ, lineIterator->sendingTime - sc_time_stamp());
|
||||
}
|
||||
sc_time sendingOffset;
|
||||
|
||||
if (lastSendingTime == sc_time_stamp())
|
||||
sendingOffset = playerClk;
|
||||
else
|
||||
sendToTarget(*payload, BEGIN_REQ, lineIterator->sendingTime);
|
||||
sendingOffset = SC_ZERO_TIME;
|
||||
|
||||
if (!relative)
|
||||
lastSendingTime = std::max(sc_time_stamp() + sendingOffset, lineIterator->sendingTime);
|
||||
else
|
||||
lastSendingTime = sc_time_stamp() + std::max(sendingOffset, lineIterator->sendingTime);
|
||||
|
||||
sendToTarget(*payload, BEGIN_REQ, lastSendingTime - sc_time_stamp());
|
||||
|
||||
transactionsSent++;
|
||||
PRINTDEBUGMESSAGE(name(), "Performing request #" + std::to_string(transactionsSent));
|
||||
|
||||
@@ -78,6 +78,7 @@ private:
|
||||
unsigned int burstlength;
|
||||
unsigned int dataLength;
|
||||
sc_time playerClk; // May be different from the memory clock!
|
||||
sc_time lastSendingTime = sc_max_time();
|
||||
|
||||
static constexpr unsigned lineBufferSize = 10000;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ void TraceGenerator::nextPayload()
|
||||
payload->set_command(tlm::TLM_READ_COMMAND);
|
||||
transCounter++;
|
||||
|
||||
// TODO: do not send two requests in the same cycle
|
||||
sendToTarget(*payload, tlm::BEGIN_REQ, SC_ZERO_TIME);
|
||||
transactionsSent++;
|
||||
PRINTDEBUGMESSAGE(name(), "Performing request #" + std::to_string(transactionsSent));
|
||||
|
||||
Reference in New Issue
Block a user