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

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

48
49#ifndef __MEM_CACHE_TAGS_FA_LRU_HH__
50#define __MEM_CACHE_TAGS_FA_LRU_HH__
51
52#include <cstdint>
53#include <functional>
54#include <string>
55#include <unordered_map>
56#include <vector>
57
58#include "base/bitfield.hh"
59#include "base/intmath.hh"
60#include "base/logging.hh"
61#include "base/statistics.hh"
62#include "base/types.hh"
63#include "mem/cache/blk.hh"
64#include "mem/cache/tags/base.hh"

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

268 public:
269 CacheTracking(unsigned min_size, unsigned max_size,
270 unsigned block_size)
271 : blkSize(block_size),
272 minTrackedSize(min_size),
273 numTrackedCaches(max_size > min_size ?
274 floorLog2(max_size) - floorLog2(min_size) : 0),
275 inAllCachesMask(mask(numTrackedCaches)),
275 boundaries(new FALRUBlk *[numTrackedCaches])
276 boundaries(numTrackedCaches)
277 {
278 fatal_if(numTrackedCaches > sizeof(CachesMask) * 8,
279 "Not enough bits (%s) in type CachesMask type to keep "
280 "track of %d caches\n", sizeof(CachesMask),
281 numTrackedCaches);
282 }
283
283 ~CacheTracking()
284 {
285 delete[] boundaries;
286 }
287
284 /**
285 * Initialiaze cache blocks and the tracking mechanism
286 *
287 * All blocks in the cache need to be initialized once.
288 *
289 * @param blk the MRU block
290 * @param blk the LRU block
291 */

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

347 const unsigned blkSize;
348 /** The smallest cache we are tracking */
349 const unsigned minTrackedSize;
350 /** The number of different size caches being tracked. */
351 const int numTrackedCaches;
352 /** A mask for all cache being tracked. */
353 const CachesMask inAllCachesMask;
354 /** Array of pointers to blocks at the cache boundaries. */
359 FALRUBlk** boundaries;
355 std::vector<FALRUBlk*> boundaries;
356
357 protected:
358 /**
359 * @defgroup FALRUStats Fully Associative LRU specific statistics
360 * The FA lru stack lets us track multiple cache sizes at once. These
361 * statistics track the hits and misses for different cache sizes.
362 * @{
363 */

--- 16 unchanged lines hidden ---