fa_lru.hh (10693:c0979b2ebda5) fa_lru.hh (10815:169af9a2779f)
1/*
2 * Copyright (c) 2012-2013 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

--- 160 unchanged lines hidden (view full) ---

169 * @param name The name to prepend to the stats name.
170 */
171 void regStats();
172
173 /**
174 * Invalidate a cache block.
175 * @param blk The block to invalidate.
176 */
1/*
2 * Copyright (c) 2012-2013 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

--- 160 unchanged lines hidden (view full) ---

169 * @param name The name to prepend to the stats name.
170 */
171 void regStats();
172
173 /**
174 * Invalidate a cache block.
175 * @param blk The block to invalidate.
176 */
177 void invalidate(BlkType *blk);
177 void invalidate(CacheBlk *blk);
178
179 /**
180 * Access block and update replacement data. May not succeed, in which case
181 * NULL pointer is returned. This has all the implications of a cache
182 * access and should only be used as such.
183 * Returns the access latency and inCache flags as a side effect.
184 * @param addr The address to look for.
185 * @param is_secure True if the target memory space is secure.
186 * @param asid The address space ID.
187 * @param lat The latency of the access.
188 * @param inCache The FALRUBlk::inCache flags.
189 * @return Pointer to the cache block.
190 */
178
179 /**
180 * Access block and update replacement data. May not succeed, in which case
181 * NULL pointer is returned. This has all the implications of a cache
182 * access and should only be used as such.
183 * Returns the access latency and inCache flags as a side effect.
184 * @param addr The address to look for.
185 * @param is_secure True if the target memory space is secure.
186 * @param asid The address space ID.
187 * @param lat The latency of the access.
188 * @param inCache The FALRUBlk::inCache flags.
189 * @return Pointer to the cache block.
190 */
191 FALRUBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat,
192 int context_src, int *inCache = 0);
191 CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat,
192 int context_src, int *inCache);
193
194 /**
193
194 /**
195 * Just a wrapper of above function to conform with the base interface.
196 */
197 CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat,
198 int context_src);
199
200 /**
195 * Find the block in the cache, do not update the replacement data.
196 * @param addr The address to look for.
197 * @param is_secure True if the target memory space is secure.
198 * @param asid The address space ID.
199 * @return Pointer to the cache block.
200 */
201 * Find the block in the cache, do not update the replacement data.
202 * @param addr The address to look for.
203 * @param is_secure True if the target memory space is secure.
204 * @param asid The address space ID.
205 * @return Pointer to the cache block.
206 */
201 FALRUBlk* findBlock(Addr addr, bool is_secure) const;
207 CacheBlk* findBlock(Addr addr, bool is_secure) const;
202
203 /**
204 * Find a replacement block for the address provided.
205 * @param pkt The request to a find a replacement candidate for.
206 * @return The block to place the replacement in.
207 */
208
209 /**
210 * Find a replacement block for the address provided.
211 * @param pkt The request to a find a replacement candidate for.
212 * @return The block to place the replacement in.
213 */
208 FALRUBlk* findVictim(Addr addr);
214 CacheBlk* findVictim(Addr addr);
209
215
210 void insertBlock(PacketPtr pkt, BlkType *blk);
216 void insertBlock(PacketPtr pkt, CacheBlk *blk);
211
212 /**
213 * Return the block size of this cache.
214 * @return The block size.
215 */
216 unsigned
217 getBlockSize() const
218 {

--- 37 unchanged lines hidden (view full) ---

256 * @return 0.
257 */
258 int extractSet(Addr addr) const
259 {
260 return 0;
261 }
262
263 /**
217
218 /**
219 * Return the block size of this cache.
220 * @return The block size.
221 */
222 unsigned
223 getBlockSize() const
224 {

--- 37 unchanged lines hidden (view full) ---

262 * @return 0.
263 */
264 int extractSet(Addr addr) const
265 {
266 return 0;
267 }
268
269 /**
264 * Calculate the block offset of an address.
265 * @param addr the address to get the offset of.
266 * @return the block offset.
267 */
268 int extractBlkOffset(Addr addr) const
269 {
270 return (addr & (Addr)(blkSize-1));
271 }
272
273 /**
274 * Regenerate the block address from the tag and the set.
275 * @param tag The tag of the block.
276 * @param set The set the block belongs to.
277 * @return the block address.
278 */
270 * Regenerate the block address from the tag and the set.
271 * @param tag The tag of the block.
272 * @param set The set the block belongs to.
273 * @return the block address.
274 */
279 Addr regenerateBlkAddr(Addr tag, int set) const
275 Addr regenerateBlkAddr(Addr tag, unsigned set) const
280 {
281 return (tag);
282 }
283
284 /**
285 *iterated through all blocks and clear all locks
286 *Needed to clear all lock tracking at once
287 */

--- 11 unchanged lines hidden (view full) ---

299 * The visitor should be a function (or object that behaves like a
300 * function) that takes a cache block reference as its parameter
301 * and returns a bool. A visitor can request the traversal to be
302 * stopped by returning false, returning true causes it to be
303 * called for the next block in the tag store.
304 *
305 * \param visitor Visitor to call on each block.
306 */
276 {
277 return (tag);
278 }
279
280 /**
281 *iterated through all blocks and clear all locks
282 *Needed to clear all lock tracking at once
283 */

--- 11 unchanged lines hidden (view full) ---

295 * The visitor should be a function (or object that behaves like a
296 * function) that takes a cache block reference as its parameter
297 * and returns a bool. A visitor can request the traversal to be
298 * stopped by returning false, returning true causes it to be
299 * called for the next block in the tag store.
300 *
301 * \param visitor Visitor to call on each block.
302 */
307 template <typename V>
308 void forEachBlk(V &visitor) {
303 void forEachBlk(CacheBlkVisitor &visitor) M5_ATTR_OVERRIDE {
309 for (int i = 0; i < numBlocks; i++) {
310 if (!visitor(blks[i]))
311 return;
312 }
313 }
314
315};
316
317#endif // __MEM_CACHE_TAGS_FA_LRU_HH__
304 for (int i = 0; i < numBlocks; i++) {
305 if (!visitor(blks[i]))
306 return;
307 }
308 }
309
310};
311
312#endif // __MEM_CACHE_TAGS_FA_LRU_HH__