base_set_assoc.cc (13216:6ae030076b29) | base_set_assoc.cc (13217:725b1701b4ee) |
---|---|
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) { | 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 | 88 |
89 sets[i].blks.resize(assoc); 90 | |
91 // link in the data blocks 92 for (unsigned j = 0; j < assoc; ++j) { 93 // Select block within the set to be linked | 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]; |
95 96 // Locate next cache block 97 blk = &blks[blkIndex]; 98 99 // Associate a data chunk to the block 100 blk->data = &dataBlks[blkSize*blkIndex]; 101 102 // Associate a replacement data entry to the block --- 20 unchanged lines hidden (view full) --- 123 124 // Decrease the number of tags in use 125 tagsInUse--; 126 127 // Invalidate replacement data 128 replacementPolicy->invalidate(blk->replacementData); 129} 130 | 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 | |
140ReplaceableEntry* 141BaseSetAssoc::findBlockBySetAndWay(int set, int way) const 142{ | 129ReplaceableEntry* 130BaseSetAssoc::findBlockBySetAndWay(int set, int way) const 131{ |
143 return sets[set].blks[way]; | 132 return sets[set][way]; |
144} 145 146BaseSetAssoc * 147BaseSetAssocParams::create() 148{ 149 return new BaseSetAssoc(this); 150} | 133} 134 135BaseSetAssoc * 136BaseSetAssocParams::create() 137{ 138 return new BaseSetAssoc(this); 139} |