diff --git a/src/systemc/tlm_bridge/gem5_to_tlm.cc b/src/systemc/tlm_bridge/gem5_to_tlm.cc index f03548ced9..9d108761b2 100644 --- a/src/systemc/tlm_bridge/gem5_to_tlm.cc +++ b/src/systemc/tlm_bridge/gem5_to_tlm.cc @@ -167,18 +167,14 @@ Gem5ToTlmBridge::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 = !bridgeResponsePort.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(); + } + if (packet->isResponse()) { need_retry = !bridgeResponsePort.sendTimingResp(packet); } diff --git a/src/systemc/tlm_bridge/sc_ext.cc b/src/systemc/tlm_bridge/sc_ext.cc index ea188c4728..194ecbc055 100644 --- a/src/systemc/tlm_bridge/sc_ext.cc +++ b/src/systemc/tlm_bridge/sc_ext.cc @@ -41,7 +41,6 @@ namespace Gem5SystemC Gem5Extension::Gem5Extension(PacketPtr _packet) { packet = _packet; - pipeThrough = false; } Gem5Extension & diff --git a/src/systemc/tlm_bridge/sc_ext.hh b/src/systemc/tlm_bridge/sc_ext.hh index 0d9fc91013..56a19a7728 100644 --- a/src/systemc/tlm_bridge/sc_ext.hh +++ b/src/systemc/tlm_bridge/sc_ext.hh @@ -54,12 +54,8 @@ class Gem5Extension: public tlm::tlm_extension const tlm::tlm_generic_payload &payload); PacketPtr getPacket(); - bool isPipeThrough() const { return pipeThrough; } - void setPipeThrough() { pipeThrough = true; } - private: PacketPtr packet; - bool pipeThrough; }; } // namespace Gem5SystemC diff --git a/src/systemc/tlm_bridge/tlm_to_gem5.cc b/src/systemc/tlm_bridge/tlm_to_gem5.cc index a1a8382cd4..143eeacae1 100644 --- a/src/systemc/tlm_bridge/tlm_to_gem5.cc +++ b/src/systemc/tlm_bridge/tlm_to_gem5.cc @@ -181,7 +181,6 @@ TlmToGem5Bridge::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 = payload2packet(_id, trans); @@ -306,7 +305,6 @@ TlmToGem5Bridge::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 = payload2packet(_id, trans); @@ -343,7 +341,6 @@ TlmToGem5Bridge::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(); bmp.sendFunctional(extension->getPacket()); } else { auto pkt = payload2packet(_id, trans); @@ -369,7 +366,6 @@ TlmToGem5Bridge::get_direct_mem_ptr(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 = payload2packet(_id, trans); @@ -447,8 +443,6 @@ TlmToGem5Bridge::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(); diff --git a/util/tlm/src/sc_ext.cc b/util/tlm/src/sc_ext.cc index 5e45ed9f65..fb9613fa02 100644 --- a/util/tlm/src/sc_ext.cc +++ b/util/tlm/src/sc_ext.cc @@ -41,7 +41,6 @@ namespace Gem5SystemC Gem5Extension::Gem5Extension(PacketPtr packet) { Packet = packet; - pipeThrough = false; } Gem5Extension& Gem5Extension::getExtension(const tlm_generic_payload *payload) diff --git a/util/tlm/src/sc_ext.hh b/util/tlm/src/sc_ext.hh index 18221de26a..b370208991 100644 --- a/util/tlm/src/sc_ext.hh +++ b/util/tlm/src/sc_ext.hh @@ -58,12 +58,8 @@ class Gem5Extension: public tlm::tlm_extension getExtension(const tlm::tlm_generic_payload &payload); PacketPtr getPacket(); - bool isPipeThrough() const { return pipeThrough; } - void setPipeThrough() { pipeThrough = true; } - private: PacketPtr Packet; - bool pipeThrough; }; } diff --git a/util/tlm/src/sc_master_port.cc b/util/tlm/src/sc_master_port.cc index 0008e9bedd..7b04921deb 100644 --- a/util/tlm/src/sc_master_port.cc +++ b/util/tlm/src/sc_master_port.cc @@ -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(); diff --git a/util/tlm/src/sc_slave_port.cc b/util/tlm/src/sc_slave_port.cc index a3b8783493..58b01345b3 100644 --- a/util/tlm/src/sc_slave_port.cc +++ b/util/tlm/src/sc_slave_port.cc @@ -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) {