systemc: remove pipe through flag in TLM extension

Pipe through flag should be equal to whether we have the extension
in TLM payload or not. However, in the current implementation the
two are different and cause issues when we have gem5 - SystemC
connection.

Change-Id: I2c318777d91dca446c1a700d9f7cff356d29ae6d
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37375
Reviewed-by: Earl Ou <shunhsingou@google.com>
Maintainer: Earl Ou <shunhsingou@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Earl Ou
2020-11-11 14:22:02 +08:00
parent 02cd894598
commit fa4be29d17
8 changed files with 15 additions and 44 deletions

View File

@@ -41,7 +41,6 @@ namespace Gem5SystemC
Gem5Extension::Gem5Extension(PacketPtr packet)
{
Packet = packet;
pipeThrough = false;
}
Gem5Extension& Gem5Extension::getExtension(const tlm_generic_payload *payload)

View File

@@ -58,12 +58,8 @@ class Gem5Extension: public tlm::tlm_extension<Gem5Extension>
getExtension(const tlm::tlm_generic_payload &payload);
PacketPtr getPacket();
bool isPipeThrough() const { return pipeThrough; }
void setPipeThrough() { pipeThrough = true; }
private:
PacketPtr Packet;
bool pipeThrough;
};
}

View File

@@ -206,7 +206,6 @@ SCMasterPort::handleBeginReq(tlm::tlm_generic_payload& trans)
// world and we can pipe through the original packet. Otherwise, we
// generate a new packet based on the transaction.
if (extension != nullptr) {
extension->setPipeThrough();
pkt = extension->getPacket();
} else {
pkt = generatePacket(trans);
@@ -263,7 +262,6 @@ SCMasterPort::b_transport(tlm::tlm_generic_payload& trans,
// If there is an extension, this transaction was initiated by the gem5
// world and we can pipe through the original packet.
if (extension != nullptr) {
extension->setPipeThrough();
pkt = extension->getPacket();
} else {
pkt = generatePacket(trans);
@@ -297,7 +295,6 @@ SCMasterPort::transport_dbg(tlm::tlm_generic_payload& trans)
// If there is an extension, this transaction was initiated by the gem5
// world and we can pipe through the original packet.
if (extension != nullptr) {
extension->setPipeThrough();
sendFunctional(extension->getPacket());
} else {
auto pkt = generatePacket(trans);
@@ -353,8 +350,6 @@ SCMasterPort::recvTimingResp(PacketPtr pkt)
// delete it. The packet travels back with the transaction.
if (extension == nullptr)
destroyPacket(pkt);
else
sc_assert(extension->isPipeThrough());
sendBeginResp(trans, delay);
trans.release();

View File

@@ -293,19 +293,15 @@ SCSlavePort::pec(
bool need_retry = false;
/*
* If the packet was piped through and needs a response, we don't need
* to touch the packet and can forward it directly as a response.
* Otherwise, we need to make a response and send the transformed
* packet.
*/
if (extension.isPipeThrough()) {
if (packet->isResponse()) {
need_retry = !sendTimingResp(packet);
}
} else if (packet->needsResponse()) {
// If there is another gem5 model under the receiver side, and already
// make a response packet back, we can simply send it back. Otherwise,
// we make a response packet before sending it back to the initiator
// side gem5 module.
if (packet->needsResponse()) {
packet->makeResponse();
need_retry = !sendTimingResp(packet);
}
if (packet->isResponse()) {
need_retry = !bridgeResponsePort.sendTimingResp(packet);
}
if (need_retry) {