Yu-hsin Wang has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/44645 )

Change subject: fastmodel: add amba_to_tlm_bridge hooks before going to gem5
......................................................................

fastmodel: add amba_to_tlm_bridge hooks before going to gem5

To handle atomic transaction, we need to convert amba far atomic
extension into gem5 atomic extension before going to gem5 world. This cl
prepares hooks that enables us to do the conversion.

Change-Id: I1b5a99c38f619689bd318253356928091a4fdb02
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44645
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/arm/fastmodel/amba_to_tlm_bridge.cc
M src/arch/arm/fastmodel/amba_to_tlm_bridge.hh
2 files changed, 52 insertions(+), 4 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/fastmodel/amba_to_tlm_bridge.cc b/src/arch/arm/fastmodel/amba_to_tlm_bridge.cc
index a011e35..82f84d8 100644
--- a/src/arch/arm/fastmodel/amba_to_tlm_bridge.cc
+++ b/src/arch/arm/fastmodel/amba_to_tlm_bridge.cc
@@ -32,11 +32,21 @@
 namespace FastModel
 {

-AmbaToTlmBridge64::AmbaToTlmBridge64(const char *name) :
+AmbaToTlmBridge64::AmbaToTlmBridge64(const sc_core::sc_module_name& name) :
     amba_pv::amba_pv_to_tlm_bridge<64>(name),
-    tlmWrapper(tlm_m, std::string(name) + ".tlm", -1),
+    targetProxy("target_proxy"),
+    initiatorProxy("initiator_proxy"),
+    tlmWrapper(initiatorProxy, std::string(name) + ".tlm", -1),
     ambaWrapper(amba_pv_s, std::string(name) + ".amba", -1)
-{}
+{
+    targetProxy.register_b_transport(this, &AmbaToTlmBridge64::bTransport);
+    targetProxy.register_get_direct_mem_ptr(
+        this, &AmbaToTlmBridge64::getDirectMemPtr);
+ targetProxy.register_transport_dbg(this, &AmbaToTlmBridge64::transportDbg);
+    initiatorProxy.register_invalidate_direct_mem_ptr(
+        this, &AmbaToTlmBridge64::invalidateDirectMemPtr);
+    tlm_m(targetProxy);
+}

 Port &
 AmbaToTlmBridge64::gem5_getPort(const std::string &if_name, int idx)
@@ -49,6 +59,33 @@
return amba_pv::amba_pv_to_tlm_bridge<64>::gem5_getPort(if_name, idx);
 }

+void
+AmbaToTlmBridge64::bTransport(amba_pv::amba_pv_transaction &trans,
+                              sc_core::sc_time &t)
+{
+    return initiatorProxy->b_transport(trans, t);
+}
+
+bool
+AmbaToTlmBridge64::getDirectMemPtr(amba_pv::amba_pv_transaction &trans,
+                                   tlm::tlm_dmi &dmi_data)
+{
+    return initiatorProxy->get_direct_mem_ptr(trans, dmi_data);
+}
+
+unsigned int
+AmbaToTlmBridge64::transportDbg(amba_pv::amba_pv_transaction &trans)
+{
+    return initiatorProxy->transport_dbg(trans);
+}
+
+void
+AmbaToTlmBridge64::invalidateDirectMemPtr(sc_dt::uint64 start_range,
+                                          sc_dt::uint64 end_range)
+{
+    targetProxy->invalidate_direct_mem_ptr(start_range, end_range);
+}
+
 } // namespace FastModel

 FastModel::AmbaToTlmBridge64 *
diff --git a/src/arch/arm/fastmodel/amba_to_tlm_bridge.hh b/src/arch/arm/fastmodel/amba_to_tlm_bridge.hh
index 8baee6a..d0e52d0 100644
--- a/src/arch/arm/fastmodel/amba_to_tlm_bridge.hh
+++ b/src/arch/arm/fastmodel/amba_to_tlm_bridge.hh
@@ -43,11 +43,22 @@
 class AmbaToTlmBridge64 : public amba_pv::amba_pv_to_tlm_bridge<64>
 {
   public:
-    AmbaToTlmBridge64(const char *name);
+    AmbaToTlmBridge64(const sc_core::sc_module_name &name);

     ::Port &gem5_getPort(const std::string &if_name, int idx=-1) override;

   private:
+ void bTransport(amba_pv::amba_pv_transaction &trans, sc_core::sc_time &t);
+    bool getDirectMemPtr(amba_pv::amba_pv_transaction &trans,
+                         tlm::tlm_dmi &dmi_data);
+    unsigned int transportDbg(amba_pv::amba_pv_transaction &trans);
+    void invalidateDirectMemPtr(sc_dt::uint64 start_range,
+                                sc_dt::uint64 end_range);
+
+    tlm_utils::simple_target_socket<
+        AmbaToTlmBridge64, 64, tlm::tlm_base_protocol_types> targetProxy;
+    tlm_utils::simple_initiator_socket<
+ AmbaToTlmBridge64, 64, tlm::tlm_base_protocol_types> initiatorProxy;
     sc_gem5::TlmInitiatorWrapper<64> tlmWrapper;
     AmbaTarget ambaWrapper;
 };

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44645
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: I1b5a99c38f619689bd318253356928091a4fdb02
Gerrit-Change-Number: 44645
Gerrit-PatchSet: 4
Gerrit-Owner: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: Earl Ou <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Yu-hsin Wang <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-CC: Philip Metzler <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to