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

Change subject: fastmodel: add memory space id map and getter
......................................................................

fastmodel: add memory space id map and getter

Change-Id: Ia9bd467b72ed59ba2b3d2aaf402761779c4e76e9
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48867
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/arch/arm/fastmodel/iris/thread_context.cc
M src/arch/arm/fastmodel/iris/thread_context.hh
2 files changed, 19 insertions(+), 0 deletions(-)

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



diff --git a/src/arch/arm/fastmodel/iris/thread_context.cc b/src/arch/arm/fastmodel/iris/thread_context.cc
index 87e4e77..0d2f0b3 100644
--- a/src/arch/arm/fastmodel/iris/thread_context.cc
+++ b/src/arch/arm/fastmodel/iris/thread_context.cc
@@ -45,6 +45,7 @@
 #include <vector>

 #include "arch/arm/fastmodel/iris/cpu.hh"
+#include "arch/arm/fastmodel/iris/memory_spaces.hh"
 #include "arch/arm/system.hh"
 #include "arch/arm/utility.hh"
 #include "base/logging.hh"
@@ -70,6 +71,10 @@
     suspend();

     call().memory_getMemorySpaces(_instId, memorySpaces);
+    for (const auto &space: memorySpaces) {
+        memorySpaceIds.emplace(
+            Iris::CanonicalMsn(space.canonicalMsn), space.spaceId);
+    }
     call().memory_getUsefulAddressTranslations(_instId, translations);

     typedef ThreadContext Self;
@@ -120,6 +125,13 @@
     }
 }

+iris::MemorySpaceId
+ThreadContext::getMemorySpaceId(const Iris::CanonicalMsn& msn) const
+{
+    auto it = memorySpaceIds.find(msn);
+    return it == memorySpaceIds.end() ? iris::IRIS_UINT64_MAX : it->second;
+}
+
 void
 ThreadContext::maintainStepping()
 {
diff --git a/src/arch/arm/fastmodel/iris/thread_context.hh b/src/arch/arm/fastmodel/iris/thread_context.hh
index d16b480..ddc08eb1 100644
--- a/src/arch/arm/fastmodel/iris/thread_context.hh
+++ b/src/arch/arm/fastmodel/iris/thread_context.hh
@@ -31,7 +31,9 @@
 #include <list>
 #include <map>
 #include <memory>
+#include <unordered_map>

+#include "arch/arm/fastmodel/iris/memory_spaces.hh"
 #include "arch/arm/regs/vec.hh"
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
@@ -56,6 +58,9 @@
     typedef std::vector<iris::ResourceId> ResourceIds;
     typedef std::map<int, std::string> IdxNameMap;

+    typedef std::unordered_map<Iris::CanonicalMsn, iris::MemorySpaceId>
+        MemorySpaceMap;
+
   protected:
     gem5::BaseCPU *_cpu;
     int _threadId;
@@ -81,6 +86,7 @@
             const ResourceMap &resources, const std::string &name);
     void extractResourceMap(ResourceIds &ids,
             const ResourceMap &resources, const IdxNameMap &idx_names);
+ iris::MemorySpaceId getMemorySpaceId(const Iris::CanonicalMsn& msn) const;


     ResourceIds miscRegIds;
@@ -97,6 +103,7 @@

     std::vector<iris::MemorySpaceInfo> memorySpaces;
std::vector<iris::MemorySupportedAddressTranslationResult> translations;
+    MemorySpaceMap memorySpaceIds;

     // A queue to keep track of instruction count based events.
     EventQueue comInstEventQueue;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48867
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: Ia9bd467b72ed59ba2b3d2aaf402761779c4e76e9
Gerrit-Change-Number: 48867
Gerrit-PatchSet: 2
Gerrit-Owner: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
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

Reply via email to