fa_lru.hh (12773:387fa9e5c9ff) | fa_lru.hh (12775:84d56bc8cd8b) |
---|---|
1/* 2 * Copyright (c) 2012-2013,2016,2018 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 97 unchanged lines hidden (view full) --- 106 FALRUBlk *blks; 107 108 /** The MRU block. */ 109 FALRUBlk *head; 110 /** The LRU block. */ 111 FALRUBlk *tail; 112 113 /** Hash table type mapping addresses to cache block pointers. */ | 1/* 2 * Copyright (c) 2012-2013,2016,2018 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 97 unchanged lines hidden (view full) --- 106 FALRUBlk *blks; 107 108 /** The MRU block. */ 109 FALRUBlk *head; 110 /** The LRU block. */ 111 FALRUBlk *tail; 112 113 /** Hash table type mapping addresses to cache block pointers. */ |
114 typedef std::unordered_map<Addr, FALRUBlk *, std::hash<Addr> > hash_t; 115 /** Iterator into the address hash table. */ 116 typedef hash_t::const_iterator tagIterator; | 114 struct PairHash 115 { 116 template <class T1, class T2> 117 std::size_t operator()(const std::pair<T1, T2> &p) const 118 { 119 return std::hash<T1>()(p.first) ^ std::hash<T2>()(p.second); 120 } 121 }; 122 typedef std::pair<Addr, bool> TagHashKey; 123 typedef std::unordered_map<TagHashKey, FALRUBlk *, PairHash> TagHash; |
117 118 /** The address hash table. */ | 124 125 /** The address hash table. */ |
119 hash_t tagHash; | 126 TagHash tagHash; |
120 121 /** | 127 128 /** |
122 * Find the cache block for the given address. 123 * @param addr The address to find. 124 * @return The cache block of the address, if any. 125 */ 126 FALRUBlk * hashLookup(Addr addr) const; 127 128 /** | |
129 * Move a cache block to the MRU position. 130 * 131 * @param blk The block to promote. 132 */ 133 void moveToHead(FALRUBlk *blk); 134 135 /** 136 * Move a cache block to the LRU position. --- 245 unchanged lines hidden --- | 129 * Move a cache block to the MRU position. 130 * 131 * @param blk The block to promote. 132 */ 133 void moveToHead(FALRUBlk *blk); 134 135 /** 136 * Move a cache block to the LRU position. --- 245 unchanged lines hidden --- |