base_set_assoc.hh (12629:c17d4dc2379e) | base_set_assoc.hh (12636:9859213e2662) |
---|---|
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 --- 198 unchanged lines hidden (view full) --- 207 * @return The possible locations. 208 */ 209 const std::vector<CacheBlk*> getPossibleLocations(Addr addr) 210 { 211 return sets[extractSet(addr)].blks; 212 } 213 214 /** | 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 --- 198 unchanged lines hidden (view full) --- 207 * @return The possible locations. 208 */ 209 const std::vector<CacheBlk*> getPossibleLocations(Addr addr) 210 { 211 return sets[extractSet(addr)].blks; 212 } 213 214 /** |
215 * Insert the new block into the cache. | 215 * Insert the new block into the cache and update replacement data. 216 * |
216 * @param pkt Packet holding the address to update 217 * @param blk The block to update. 218 */ | 217 * @param pkt Packet holding the address to update 218 * @param blk The block to update. 219 */ |
219 void insertBlock(PacketPtr pkt, CacheBlk *blk) override 220 { 221 Addr addr = pkt->getAddr(); 222 MasterID master_id = pkt->req->masterId(); 223 uint32_t task_id = pkt->req->taskId(); | 220 void insertBlock(PacketPtr pkt, CacheBlk *blk) override 221 { 222 // Insert block 223 BaseTags::insertBlock(pkt, blk); |
224 | 224 |
225 if (!blk->isTouched) { 226 if (!warmedUp && tagsInUse.value() >= warmupBound) { 227 warmedUp = true; 228 warmupCycle = curTick(); 229 } 230 } | 225 // Update replacement policy 226 replacementPolicy->reset(blk); 227 } |
231 | 228 |
232 // If we're replacing a block that was previously valid update 233 // stats for it. This can't be done in findBlock() because a 234 // found block might not actually be replaced there if the 235 // coherence protocol says it can't be. 236 if (blk->isValid()) { 237 replacements[0]++; 238 totalRefs += blk->refCount; 239 ++sampledRefs; 240 241 invalidate(blk); 242 blk->invalidate(); 243 } 244 245 // Previous block, if existed, has been removed, and now we have 246 // to insert the new one 247 tagsInUse++; 248 249 // Set tag for new block. Caller is responsible for setting status. 250 blk->tag = extractTag(addr); 251 252 // deal with what we are bringing in 253 assert(master_id < cache->system->maxMasters()); 254 occupancies[master_id]++; 255 blk->srcMasterId = master_id; 256 blk->task_id = task_id; 257 258 // We only need to write into one tag and one data block. 259 tagAccesses += 1; 260 dataAccesses += 1; 261 262 replacementPolicy->reset(blk); 263 } 264 | |
265 /** 266 * Limit the allocation for the cache ways. 267 * @param ways The maximum number of ways available for replacement. 268 */ 269 virtual void setWayAllocationMax(int ways) override 270 { 271 fatal_if(ways < 1, "Allocation limit must be greater than zero"); 272 allocAssoc = ways; --- 78 unchanged lines hidden --- | 229 /** 230 * Limit the allocation for the cache ways. 231 * @param ways The maximum number of ways available for replacement. 232 */ 233 virtual void setWayAllocationMax(int ways) override 234 { 235 fatal_if(ways < 1, "Allocation limit must be greater than zero"); 236 allocAssoc = ways; --- 78 unchanged lines hidden --- |