base_set_assoc.hh (12728:57bdea4f96aa) base_set_assoc.hh (12731:36a41bd85c0f)
1/*
2 * Copyright (c) 2012-2014,2017 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

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

274 * @return The tag of the address.
275 */
276 Addr extractTag(Addr addr) const override
277 {
278 return (addr >> tagShift);
279 }
280
281 /**
1/*
2 * Copyright (c) 2012-2014,2017 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

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

274 * @return The tag of the address.
275 */
276 Addr extractTag(Addr addr) const override
277 {
278 return (addr >> tagShift);
279 }
280
281 /**
282 * Calculate the set index from the address.
283 * @param addr The address to get the set from.
284 * @return The set index of the address.
285 */
286 int extractSet(Addr addr) const override
287 {
288 return ((addr >> setShift) & setMask);
289 }
290
291 /**
292 * Regenerate the block address from the tag and set.
293 *
294 * @param block The block.
295 * @return the block address.
296 */
297 Addr regenerateBlkAddr(const CacheBlk* blk) const override
298 {
299 return ((blk->tag << tagShift) | ((Addr)blk->set << setShift));

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

308 bool anyBlk(std::function<bool(CacheBlk &)> visitor) override {
309 for (CacheBlk& blk : blks) {
310 if (visitor(blk)) {
311 return true;
312 }
313 }
314 return false;
315 }
282 * Regenerate the block address from the tag and set.
283 *
284 * @param block The block.
285 * @return the block address.
286 */
287 Addr regenerateBlkAddr(const CacheBlk* blk) const override
288 {
289 return ((blk->tag << tagShift) | ((Addr)blk->set << setShift));

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

298 bool anyBlk(std::function<bool(CacheBlk &)> visitor) override {
299 for (CacheBlk& blk : blks) {
300 if (visitor(blk)) {
301 return true;
302 }
303 }
304 return false;
305 }
306
307 private:
308 /**
309 * Calculate the set index from the address.
310 *
311 * @param addr The address to get the set from.
312 * @return The set index of the address.
313 */
314 int extractSet(Addr addr) const
315 {
316 return ((addr >> setShift) & setMask);
317 }
316};
317
318#endif //__MEM_CACHE_TAGS_BASE_SET_ASSOC_HH__
318};
319
320#endif //__MEM_CACHE_TAGS_BASE_SET_ASSOC_HH__