Javier Bueno Hedo has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/16582
Change subject: mem-cache: Add a mechanism to iterate all entries of an
AssociativeSet
......................................................................
mem-cache: Add a mechanism to iterate all entries of an AssociativeSet
Added functions to obtain an iterator to access all entries of
an AssociativeSet container.
Change-Id: I1ec555bd97d97e3edaced2b8f61287e922279c26
---
M src/mem/cache/prefetch/associative_set.hh
1 file changed, 42 insertions(+), 0 deletions(-)
diff --git a/src/mem/cache/prefetch/associative_set.hh
b/src/mem/cache/prefetch/associative_set.hh
index 99b6a6d..e4e1b04 100644
--- a/src/mem/cache/prefetch/associative_set.hh
+++ b/src/mem/cache/prefetch/associative_set.hh
@@ -195,6 +195,48 @@
* @param entry pointer to the container entry to be inserted
*/
void insertEntry(Addr addr, bool is_secure, Entry* entry);
+
+ /** Iterator types */
+ using const_iterator = typename std::vector<Entry>::const_iterator;
+ using iterator = typename std::vector<Entry>::iterator;
+
+ /**
+ * Returns an iterator to the first entry of the dictionary
+ * @result iterator to the first element
+ */
+ iterator begin()
+ {
+ return entries.begin();
+ }
+
+ /**
+ * Returns an iterator pointing to the end of the the dictionary
+ * (placeholder element, should not be accessed)
+ * @result iterator to the end element
+ */
+ iterator end()
+ {
+ return entries.end();
+ }
+
+ /**
+ * Returns an iterator to the first entry of the dictionary
+ * @result iterator to the first element
+ */
+ const_iterator begin() const
+ {
+ return entries.begin();
+ }
+
+ /**
+ * Returns an iterator pointing to the end of the the dictionary
+ * (placeholder element, should not be accessed)
+ * @result iterator to the end element
+ */
+ const_iterator end() const
+ {
+ return entries.end();
+ }
};
#endif//__CACHE_PREFETCH_ASSOCIATIVE_SET_HH__
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16582
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I1ec555bd97d97e3edaced2b8f61287e922279c26
Gerrit-Change-Number: 16582
Gerrit-PatchSet: 1
Gerrit-Owner: Javier Bueno Hedo <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev