base.cc (13418:08101e89101e) | base.cc (13419:aaadcfae091a) |
---|---|
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" | 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" | |
55#include "mem/cache/replacement_policies/replaceable_entry.hh" 56#include "mem/cache/tags/indexing_policies/base.hh" 57#include "mem/request.hh" 58#include "sim/core.hh" 59#include "sim/sim_exit.hh" 60#include "sim/system.hh" 61 62BaseTags::BaseTags(const Params *p) 63 : ClockedObject(p), blkSize(p->block_size), blkMask(blkSize - 1), 64 size(p->size), lookupLatency(p->tag_latency), | 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), |
66 warmupBound((p->warmup_percentage/100.0) * (p->size / p->block_size)), 67 warmedUp(false), numBlocks(p->size / p->block_size), 68 dataBlks(new uint8_t[p->size]) // Allocate data storage in one big chunk 69{ 70} 71 | 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 | |
79ReplaceableEntry* 80BaseTags::findBlockBySetAndWay(int set, int way) const 81{ 82 return indexingPolicy->getEntry(set, way); 83} 84 85CacheBlk* 86BaseTags::findBlock(Addr addr, bool is_secure) const --- 23 unchanged lines hidden (view full) --- 110 const int src_master_ID, const uint32_t task_ID, 111 CacheBlk *blk) 112{ 113 assert(!blk->isValid()); 114 115 // Previous block, if existed, has been removed, and now we have 116 // to insert the new one 117 // Deal with what we are bringing in | 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()); |
119 occupancies[src_master_ID]++; 120 121 // Insert block with tag, src master id and task id 122 blk->insert(extractTag(addr), is_secure, src_master_ID, task_ID); 123 124 // Check if cache warm up is done 125 if (!warmedUp && tagsInUse.value() >= warmupBound) { 126 warmedUp = true; --- 111 unchanged lines hidden (view full) --- 238 avgRefs = totalRefs/sampledRefs; 239 240 warmupCycle 241 .name(name() + ".warmup_cycle") 242 .desc("Cycle when the warmup percentage was hit.") 243 ; 244 245 occupancies | 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()) |
247 .name(name() + ".occ_blocks") 248 .desc("Average occupied blocks per requestor") 249 .flags(nozero | nonan) 250 ; | 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)); |
253 } 254 255 avgOccs 256 .name(name() + ".occ_percent") 257 .desc("Average percentage of cache occupancy") 258 .flags(nozero | total) 259 ; | 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)); |
262 } 263 264 avgOccs = occupancies / Stats::constant(numBlocks); 265 266 occupanciesTaskId 267 .init(ContextSwitchTaskId::NumTaskId) 268 .name(name() + ".occ_task_id_blocks") 269 .desc("Occupied blocks per task id") --- 31 unchanged lines hidden --- | 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 --- |