Han-sheng Liu has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/65371?usp=email )

Change subject: systemc: Add the stream id entry and its conversion in control extension
......................................................................

systemc: Add the stream id entry and its conversion in control extension

stream id and substream id are properties of gem5 Request. This CL adds
the information into gem5 ControlExtension to manipulate them in SystemC
level, and adds the conversion between ControlExtension and Packet.

Change-Id: Id13d181561ba496c2012f7237eb800f0a9786d05
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65371
Maintainer: Bobby Bruce <bbr...@ucdavis.edu>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Yu-hsin Wang <yuhsi...@google.com>
---
M src/systemc/tlm_bridge/sc_ext.cc
M src/systemc/tlm_bridge/sc_ext.hh
2 files changed, 83 insertions(+), 1 deletion(-)

Approvals:
  Bobby Bruce: Looks good to me, approved
  kokoro: Regressions pass
  Yu-hsin Wang: Looks good to me, approved




diff --git a/src/systemc/tlm_bridge/sc_ext.cc b/src/systemc/tlm_bridge/sc_ext.cc
index 4d12fb3..6e3cf11 100644
--- a/src/systemc/tlm_bridge/sc_ext.cc
+++ b/src/systemc/tlm_bridge/sc_ext.cc
@@ -33,6 +33,8 @@

 #include "systemc/tlm_bridge/sc_ext.hh"

+#include <optional>
+
 #include "systemc/ext/utils/sc_report_handler.hh"
 #include "systemc/tlm_bridge/gem5_to_tlm.hh"
 #include "systemc/tlm_bridge/tlm_to_gem5.hh"
@@ -76,6 +78,14 @@
                 }

                 pkt->qosValue(control_ex->getQos());
+
+                if (control_ex->hasStreamId()) {
+ pkt->req->setStreamId(control_ex->getStreamId().value());
+                }
+                if (control_ex->hasSubstreamId()) {
+                    pkt->req->setSubstreamId(
+                        control_ex->getSubstreamId().value());
+                }
             });
         sc_gem5::addPacketToPayloadConversionStep(
             [] (PacketPtr pkt, tlm::tlm_generic_payload &trans)
@@ -90,6 +100,12 @@
                 control_ex->setSecure(pkt->req->isSecure());
                 control_ex->setInstruction(pkt->req->isInstFetch());
                 control_ex->setQos(pkt->qosValue());
+                if (pkt->req->hasStreamId()) {
+                    control_ex->setStreamId(pkt->req->streamId());
+                }
+                if (pkt->req->hasSubstreamId()) {
+                    control_ex->setSubstreamId(pkt->req->substreamId());
+                }
             });
     }
 };
@@ -263,4 +279,40 @@
     qos = q;
 }

-} // namespace Gem5SystemC
+bool
+ControlExtension::hasStreamId() const
+{
+    return stream_id.has_value();
+}
+
+std::optional<uint32_t>
+ControlExtension::getStreamId() const
+{
+    return stream_id;
+}
+
+void
+ControlExtension::setStreamId(std::optional<uint32_t> s)
+{
+    stream_id = std::move(s);
+}
+
+bool
+ControlExtension::hasSubstreamId() const
+{
+    return substream_id.has_value();
+}
+
+std::optional<uint32_t>
+ControlExtension::getSubstreamId() const
+{
+    return substream_id;
+}
+
+void
+ControlExtension::setSubstreamId(std::optional<uint32_t> s)
+{
+    substream_id = std::move(s);
+}
+
+}  // namespace Gem5SystemC
diff --git a/src/systemc/tlm_bridge/sc_ext.hh b/src/systemc/tlm_bridge/sc_ext.hh
index bb67676..f23f3fa 100644
--- a/src/systemc/tlm_bridge/sc_ext.hh
+++ b/src/systemc/tlm_bridge/sc_ext.hh
@@ -36,6 +36,7 @@

 #include <cstdint>
 #include <memory>
+#include <optional>

 #include "base/amo.hh"
 #include "mem/packet.hh"
@@ -115,6 +116,14 @@
     uint8_t getQos() const;
     void setQos(uint8_t q);

+    /* Stream ID and Substream ID */
+    bool hasStreamId() const;
+    std::optional<uint32_t> getStreamId() const;
+    void setStreamId(std::optional<uint32_t> s);
+    bool hasSubstreamId() const;
+    std::optional<uint32_t> getSubstreamId() const;
+    void setSubstreamId(std::optional<uint32_t> s);
+
   private:
     /* Secure and privileged access */
     bool privileged;
@@ -123,6 +132,10 @@

     /* Quality of Service (AXI4) */
     uint8_t qos;
+
+    /* Stream ID and Substream ID */
+    std::optional<uint32_t> stream_id;
+    std::optional<uint32_t> substream_id;
 };

 } // namespace Gem5SystemC

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/65371?usp=email 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: Id13d181561ba496c2012f7237eb800f0a9786d05
Gerrit-Change-Number: 65371
Gerrit-PatchSet: 4
Gerrit-Owner: Han-sheng Liu <handsome...@google.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Han-sheng Liu <handsome...@google.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Earl Ou <shunhsin...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to