Earl Ou has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/37375 )
Change subject: systemc: remove pipe through flag in TLM extension
......................................................................
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 <shunhsin...@google.com>
Maintainer: Earl Ou <shunhsin...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/systemc/tlm_bridge/gem5_to_tlm.cc
M src/systemc/tlm_bridge/sc_ext.cc
M src/systemc/tlm_bridge/sc_ext.hh
M src/systemc/tlm_bridge/tlm_to_gem5.cc
M util/tlm/src/sc_ext.cc
M util/tlm/src/sc_ext.hh
M util/tlm/src/sc_master_port.cc
M util/tlm/src/sc_slave_port.cc
8 files changed, 15 insertions(+), 44 deletions(-)
Approvals:
Earl Ou: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/systemc/tlm_bridge/gem5_to_tlm.cc
b/src/systemc/tlm_bridge/gem5_to_tlm.cc
index f03548c..9d10876 100644
--- a/src/systemc/tlm_bridge/gem5_to_tlm.cc
+++ b/src/systemc/tlm_bridge/gem5_to_tlm.cc
@@ -167,18 +167,14 @@
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 ea188c4..194ecbc 100644
--- a/src/systemc/tlm_bridge/sc_ext.cc
+++ b/src/systemc/tlm_bridge/sc_ext.cc
@@ -41,7 +41,6 @@
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 0d9fc91..56a19a77 100644
--- a/src/systemc/tlm_bridge/sc_ext.hh
+++ b/src/systemc/tlm_bridge/sc_ext.hh
@@ -54,12 +54,8 @@
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 a1a8382..143eeac 100644
--- a/src/systemc/tlm_bridge/tlm_to_gem5.cc
+++ b/src/systemc/tlm_bridge/tlm_to_gem5.cc
@@ -181,7 +181,6 @@
// 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 @@
// 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 @@
// 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 @@
// 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 @@
// 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 5e45ed9..fb9613f 100644
--- a/util/tlm/src/sc_ext.cc
+++ b/util/tlm/src/sc_ext.cc
@@ -41,7 +41,6 @@
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 18221de..b370208 100644
--- a/util/tlm/src/sc_ext.hh
+++ b/util/tlm/src/sc_ext.hh
@@ -58,12 +58,8 @@
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 0008e9b..7b04921 100644
--- a/util/tlm/src/sc_master_port.cc
+++ b/util/tlm/src/sc_master_port.cc
@@ -206,7 +206,6 @@
// 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 @@
// 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 @@
// 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 @@
// 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 a3b8783..58b0134 100644
--- a/util/tlm/src/sc_slave_port.cc
+++ b/util/tlm/src/sc_slave_port.cc
@@ -293,19 +293,15 @@
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) {
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/37375
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2c318777d91dca446c1a700d9f7cff356d29ae6d
Gerrit-Change-Number: 37375
Gerrit-PatchSet: 7
Gerrit-Owner: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Christian Menard <christian.men...@gmx.de>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Jui-min Lee <f...@google.com>
Gerrit-Reviewer: Lukas Steiner <lstei...@rhrk.uni-kl.de>
Gerrit-Reviewer: Matthias Jung <jun...@eit.uni-kl.de>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s