diff options
author | Javier Bueno <javier.bueno@metempsy.com> | 2019-02-21 21:56:09 +0100 |
---|---|---|
committer | Javier Bueno Hedo <javier.bueno@metempsy.com> | 2019-02-22 10:06:49 +0000 |
commit | 466d30cbbde67df7490a02149a92fa3e9be3c492 (patch) | |
tree | 746039bbfb54554ed21d19b2dd46eb28958fb7ef /src/mem | |
parent | 0a7372633a9542cf5ed6709ac87f1adfe9e87171 (diff) | |
download | gem5-466d30cbbde67df7490a02149a92fa3e9be3c492.tar.xz |
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
Reviewed-on: https://gem5-review.googlesource.com/c/16582
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem')
-rw-r--r-- | src/mem/cache/prefetch/associative_set.hh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mem/cache/prefetch/associative_set.hh b/src/mem/cache/prefetch/associative_set.hh index 99b6a6d07..e4e1b0428 100644 --- a/src/mem/cache/prefetch/associative_set.hh +++ b/src/mem/cache/prefetch/associative_set.hh @@ -195,6 +195,48 @@ class AssociativeSet { * @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__ |