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

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

79BaseSetAssoc::init(BaseCache* cache)
80{
81 // Set parent cache
82 setCache(cache);
83
84 // Initialize blocks
85 unsigned blkIndex = 0; // index into blks array
86 for (unsigned i = 0; i < numSets; ++i) {
87 sets[i].assoc = assoc;
87 sets[i].resize(assoc);
88
89 sets[i].blks.resize(assoc);
90
89 // link in the data blocks
90 for (unsigned j = 0; j < assoc; ++j) {
91 // Select block within the set to be linked
94 BlkType*& blk = sets[i].blks[j];
92 BlkType*& blk = sets[i][j];
93
94 // Locate next cache block
95 blk = &blks[blkIndex];
96
97 // Associate a data chunk to the block
98 blk->data = &dataBlks[blkSize*blkIndex];
99
100 // Associate a replacement data entry to the block

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

121
122 // Decrease the number of tags in use
123 tagsInUse--;
124
125 // Invalidate replacement data
126 replacementPolicy->invalidate(blk->replacementData);
127}
128
131CacheBlk*
132BaseSetAssoc::findBlock(Addr addr, bool is_secure) const
133{
134 Addr tag = extractTag(addr);
135 unsigned set = extractSet(addr);
136 BlkType *blk = sets[set].findBlk(tag, is_secure);
137 return blk;
138}
139
129ReplaceableEntry*
130BaseSetAssoc::findBlockBySetAndWay(int set, int way) const
131{
143 return sets[set].blks[way];
132 return sets[set][way];
133}
134
135BaseSetAssoc *
136BaseSetAssocParams::create()
137{
138 return new BaseSetAssoc(this);
139}