1/*
2 * Copyright (c) 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

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

46 * Definitions of BaseTags.
47 */
48
49#include "mem/cache/tags/base.hh"
50
51#include <cassert>
52
53#include "base/types.hh"
54#include "mem/cache/base.hh"
54#include "mem/cache/replacement_policies/replaceable_entry.hh"
55#include "mem/cache/tags/indexing_policies/base.hh"
56#include "mem/request.hh"
57#include "sim/core.hh"
58#include "sim/sim_exit.hh"
59#include "sim/system.hh"
60
61BaseTags::BaseTags(const Params *p)
62 : ClockedObject(p), blkSize(p->block_size), blkMask(blkSize - 1),
63 size(p->size), lookupLatency(p->tag_latency),
65 cache(nullptr), indexingPolicy(p->indexing_policy),
64 system(p->system), indexingPolicy(p->indexing_policy),
65 warmupBound((p->warmup_percentage/100.0) * (p->size / p->block_size)),
66 warmedUp(false), numBlocks(p->size / p->block_size),
67 dataBlks(new uint8_t[p->size]) // Allocate data storage in one big chunk
68{
69}
70
72void
73BaseTags::setCache(BaseCache *_cache)
74{
75 assert(!cache);
76 cache = _cache;
77}
78
71ReplaceableEntry*
72BaseTags::findBlockBySetAndWay(int set, int way) const
73{
74 return indexingPolicy->getEntry(set, way);
75}
76
77CacheBlk*
78BaseTags::findBlock(Addr addr, bool is_secure) const

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

102 const int src_master_ID, const uint32_t task_ID,
103 CacheBlk *blk)
104{
105 assert(!blk->isValid());
106
107 // Previous block, if existed, has been removed, and now we have
108 // to insert the new one
109 // Deal with what we are bringing in
118 assert(src_master_ID < cache->system->maxMasters());
110 assert(src_master_ID < system->maxMasters());
111 occupancies[src_master_ID]++;
112
113 // Insert block with tag, src master id and task id
114 blk->insert(extractTag(addr), is_secure, src_master_ID, task_ID);
115
116 // Check if cache warm up is done
117 if (!warmedUp && tagsInUse.value() >= warmupBound) {
118 warmedUp = true;

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

230 avgRefs = totalRefs/sampledRefs;
231
232 warmupCycle
233 .name(name() + ".warmup_cycle")
234 .desc("Cycle when the warmup percentage was hit.")
235 ;
236
237 occupancies
246 .init(cache->system->maxMasters())
238 .init(system->maxMasters())
239 .name(name() + ".occ_blocks")
240 .desc("Average occupied blocks per requestor")
241 .flags(nozero | nonan)
242 ;
251 for (int i = 0; i < cache->system->maxMasters(); i++) {
252 occupancies.subname(i, cache->system->getMasterName(i));
243 for (int i = 0; i < system->maxMasters(); i++) {
244 occupancies.subname(i, system->getMasterName(i));
245 }
246
247 avgOccs
248 .name(name() + ".occ_percent")
249 .desc("Average percentage of cache occupancy")
250 .flags(nozero | total)
251 ;
260 for (int i = 0; i < cache->system->maxMasters(); i++) {
261 avgOccs.subname(i, cache->system->getMasterName(i));
252 for (int i = 0; i < system->maxMasters(); i++) {
253 avgOccs.subname(i, system->getMasterName(i));
254 }
255
256 avgOccs = occupancies / Stats::constant(numBlocks);
257
258 occupanciesTaskId
259 .init(ContextSwitchTaskId::NumTaskId)
260 .name(name() + ".occ_task_id_blocks")
261 .desc("Occupied blocks per task id")

--- 31 unchanged lines hidden ---