Deleted Added
sdiff udiff text old ( 12743:b5ccee582b40 ) new ( 12744:d1ff0b42b747 )
full compact
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

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

195 *
196 * @param set The set of the block.
197 * @param way The way of the block.
198 * @return The block.
199 */
200 ReplaceableEntry* findBlockBySetAndWay(int set, int way) const override;
201
202 /**
203 * Find replacement victim based on address.
204 *
205 * @param addr Address to find a victim for.
206 * @return Cache block to be replaced.
207 */
208 CacheBlk* findVictim(Addr addr) override
209 {
210 // Get possible locations for the victim block
211 std::vector<CacheBlk*> locations = getPossibleLocations(addr);
212
213 // Choose replacement victim from replacement candidates
214 CacheBlk* victim = static_cast<CacheBlk*>(replacementPolicy->getVictim(
215 std::vector<ReplaceableEntry*>(
216 locations.begin(), locations.end())));
217
218 DPRINTF(CacheRepl, "set %x, way %x: selecting blk for replacement\n",
219 victim->set, victim->way);
220
221 return victim;
222 }
223
224 /**
225 * Find all possible block locations for insertion and replacement of
226 * an address. Should be called immediately before ReplacementPolicy's
227 * findVictim() not to break cache resizing.
228 * Returns blocks in all ways belonging to the set of the address.
229 *
230 * @param addr The addr to a find possible locations for.
231 * @return The possible locations.
232 */
233 const std::vector getPossibleLocations(Addr addr)
234 {
235 return sets[extractSet(addr)].blks;
236 }
237
238 /**
239 * Insert the new block into the cache and update replacement data.
240 *
241 * @param pkt Packet holding the address to update

--- 80 unchanged lines hidden ---