Deleted Added
sdiff udiff text old ( 13217:725b1701b4ee ) new ( 13218:5e7df60c6cab )
full compact
1/*
2 * Copyright (c) 2018 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

87 SectorBlk*& sec_blk = sets[i][j];
88
89 // Locate next cache sector
90 sec_blk = &secBlks[sec_blk_index];
91
92 // Associate a replacement data entry to the sector
93 sec_blk->replacementData = replacementPolicy->instantiateEntry();
94
95 // Initialize all blocks in this sector
96 sec_blk->blks.resize(numBlocksPerSector);
97 for (unsigned k = 0; k < numBlocksPerSector; ++k){
98 // Select block within the set to be linked
99 SectorSubBlk*& blk = sec_blk->blks[k];
100
101 // Locate next cache block
102 blk = &blks[blk_index];
103
104 // Associate a data chunk to the block
105 blk->data = &dataBlks[blkSize*blk_index];
106
107 // Associate sector block to this block
108 blk->setSectorBlock(sec_blk);
109
110 // Associate the sector replacement data to this block
111 blk->replacementData = sec_blk->replacementData;
112
113 // Set its set, way and sector offset
114 blk->set = i;
115 blk->way = j;
116 blk->setSectorOffset(k);
117
118 // Update block index
119 ++blk_index;
120 }
121
122 // Update sector block index
123 ++sec_blk_index;

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

303 assert(!victim->isValid());
304 } else {
305 // The whole sector must be evicted to make room for the new sector
306 for (const auto& blk : victim_sector->blks){
307 evict_blks.push_back(blk);
308 }
309 }
310
311 DPRINTF(CacheRepl, "set %x, way %x, sector offset %x: %s\n",
312 "selecting blk for replacement\n", victim->set, victim->way,
313 victim->getSectorOffset());
314
315 return victim;
316}
317
318Addr
319SectorTags::extractTag(Addr addr) const
320{

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

332{
333 return (addr >> sectorShift) & sectorMask;
334}
335
336Addr
337SectorTags::regenerateBlkAddr(const CacheBlk* blk) const
338{
339 const SectorSubBlk* blk_cast = static_cast<const SectorSubBlk*>(blk);
340 return ((blk_cast->getTag() << tagShift) | ((Addr)blk->set << setShift) |
341 ((Addr)blk_cast->getSectorOffset() << sectorShift));
342}
343
344void
345SectorTags::forEachBlk(std::function<void(CacheBlk &)> visitor)
346{
347 for (SectorSubBlk& blk : blks) {
348 visitor(blk);

--- 19 unchanged lines hidden ---