base.cc (12729:9870d6f73e04) | base.cc (12730:6c2ea88bf129) |
---|---|
1/* 2 * Copyright (c) 2012-2013, 2018 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 --- 99 unchanged lines hidden (view full) --- 108 // queue on every single allocation, whereas the write queue has 109 // as many reserve entries as we have MSHRs, since every MSHR may 110 // eventually require a writeback, and we do not check the write 111 // buffer before committing to an MSHR 112 113 // forward snoops is overridden in init() once we can query 114 // whether the connected master is actually snooping or not 115 | 1/* 2 * Copyright (c) 2012-2013, 2018 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 --- 99 unchanged lines hidden (view full) --- 108 // queue on every single allocation, whereas the write queue has 109 // as many reserve entries as we have MSHRs, since every MSHR may 110 // eventually require a writeback, and we do not check the write 111 // buffer before committing to an MSHR 112 113 // forward snoops is overridden in init() once we can query 114 // whether the connected master is actually snooping or not 115 |
116 tempBlock = new CacheBlk(); | 116 tempBlock = new TempCacheBlk(); |
117 tempBlock->data = new uint8_t[blkSize]; 118 119 tags->setCache(this); 120 if (prefetcher) 121 prefetcher->setCache(this); 122} 123 124BaseCache::~BaseCache() --- 34 unchanged lines hidden (view full) --- 159{ 160 DPRINTF(CachePort, "Port is sending retry\n"); 161 162 // reset the flag and call retry 163 mustSendRetry = false; 164 sendRetryReq(); 165} 166 | 117 tempBlock->data = new uint8_t[blkSize]; 118 119 tags->setCache(this); 120 if (prefetcher) 121 prefetcher->setCache(this); 122} 123 124BaseCache::~BaseCache() --- 34 unchanged lines hidden (view full) --- 159{ 160 DPRINTF(CachePort, "Port is sending retry\n"); 161 162 // reset the flag and call retry 163 mustSendRetry = false; 164 sendRetryReq(); 165} 166 |
167Addr 168BaseCache::regenerateBlkAddr(CacheBlk* blk) 169{ 170 if (blk != tempBlock) { 171 return tags->regenerateBlkAddr(blk); 172 } else { 173 return tempBlock->getAddr(); 174 } 175} 176 |
|
167void 168BaseCache::init() 169{ 170 if (!cpuSidePort.isConnected() || !memSidePort.isConnected()) 171 fatal("Cache ports on %s are not connected\n", name()); 172 cpuSidePort.sendRangeChange(); 173 forwardSnoops = cpuSidePort.isSnooping(); 174} --- 943 unchanged lines hidden (view full) --- 1118 blk = allocate ? allocateBlock(addr, is_secure, writebacks) : nullptr; 1119 1120 if (!blk) { 1121 // No replaceable block or a mostly exclusive 1122 // cache... just use temporary storage to complete the 1123 // current request and then get rid of it 1124 assert(!tempBlock->isValid()); 1125 blk = tempBlock; | 177void 178BaseCache::init() 179{ 180 if (!cpuSidePort.isConnected() || !memSidePort.isConnected()) 181 fatal("Cache ports on %s are not connected\n", name()); 182 cpuSidePort.sendRangeChange(); 183 forwardSnoops = cpuSidePort.isSnooping(); 184} --- 943 unchanged lines hidden (view full) --- 1128 blk = allocate ? allocateBlock(addr, is_secure, writebacks) : nullptr; 1129 1130 if (!blk) { 1131 // No replaceable block or a mostly exclusive 1132 // cache... just use temporary storage to complete the 1133 // current request and then get rid of it 1134 assert(!tempBlock->isValid()); 1135 blk = tempBlock; |
1126 tempBlock->set = tags->extractSet(addr); 1127 tempBlock->tag = tags->extractTag(addr); | 1136 tempBlock->insert(addr, is_secure); |
1128 DPRINTF(Cache, "using temp block for %#llx (%s)\n", addr, 1129 is_secure ? "s" : "ns"); 1130 } else { 1131 tags->insertBlock(pkt, blk); 1132 } 1133 1134 // we should never be overwriting a valid block 1135 assert(!blk->isValid()); --- 66 unchanged lines hidden (view full) --- 1202 // Find replacement victim 1203 CacheBlk *blk = tags->findVictim(addr); 1204 1205 // It is valid to return nullptr if there is no victim 1206 if (!blk) 1207 return nullptr; 1208 1209 if (blk->isValid()) { | 1137 DPRINTF(Cache, "using temp block for %#llx (%s)\n", addr, 1138 is_secure ? "s" : "ns"); 1139 } else { 1140 tags->insertBlock(pkt, blk); 1141 } 1142 1143 // we should never be overwriting a valid block 1144 assert(!blk->isValid()); --- 66 unchanged lines hidden (view full) --- 1211 // Find replacement victim 1212 CacheBlk *blk = tags->findVictim(addr); 1213 1214 // It is valid to return nullptr if there is no victim 1215 if (!blk) 1216 return nullptr; 1217 1218 if (blk->isValid()) { |
1210 Addr repl_addr = tags->regenerateBlkAddr(blk); | 1219 Addr repl_addr = regenerateBlkAddr(blk); |
1211 MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure()); 1212 if (repl_mshr) { 1213 // must be an outstanding upgrade or clean request 1214 // on a block we're about to replace... 1215 assert((!blk->isWritable() && repl_mshr->needsWritable()) || 1216 repl_mshr->isCleaning()); 1217 // too hard to replace block with transient state 1218 // allocation failed, block not inserted --- 27 unchanged lines hidden (view full) --- 1246BaseCache::writebackBlk(CacheBlk *blk) 1247{ 1248 chatty_assert(!isReadOnly || writebackClean, 1249 "Writeback from read-only cache"); 1250 assert(blk && blk->isValid() && (blk->isDirty() || writebackClean)); 1251 1252 writebacks[Request::wbMasterId]++; 1253 | 1220 MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure()); 1221 if (repl_mshr) { 1222 // must be an outstanding upgrade or clean request 1223 // on a block we're about to replace... 1224 assert((!blk->isWritable() && repl_mshr->needsWritable()) || 1225 repl_mshr->isCleaning()); 1226 // too hard to replace block with transient state 1227 // allocation failed, block not inserted --- 27 unchanged lines hidden (view full) --- 1255BaseCache::writebackBlk(CacheBlk *blk) 1256{ 1257 chatty_assert(!isReadOnly || writebackClean, 1258 "Writeback from read-only cache"); 1259 assert(blk && blk->isValid() && (blk->isDirty() || writebackClean)); 1260 1261 writebacks[Request::wbMasterId]++; 1262 |
1254 Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0, | 1263 Request *req = new Request(regenerateBlkAddr(blk), blkSize, 0, |
1255 Request::wbMasterId); 1256 if (blk->isSecure()) 1257 req->setFlags(Request::SECURE); 1258 1259 req->taskId(blk->task_id); 1260 1261 PacketPtr pkt = 1262 new Packet(req, blk->isDirty() ? --- 18 unchanged lines hidden (view full) --- 1281 pkt->setDataFromBlock(blk->data, blkSize); 1282 1283 return pkt; 1284} 1285 1286PacketPtr 1287BaseCache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id) 1288{ | 1264 Request::wbMasterId); 1265 if (blk->isSecure()) 1266 req->setFlags(Request::SECURE); 1267 1268 req->taskId(blk->task_id); 1269 1270 PacketPtr pkt = 1271 new Packet(req, blk->isDirty() ? --- 18 unchanged lines hidden (view full) --- 1290 pkt->setDataFromBlock(blk->data, blkSize); 1291 1292 return pkt; 1293} 1294 1295PacketPtr 1296BaseCache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id) 1297{ |
1289 Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0, | 1298 Request *req = new Request(regenerateBlkAddr(blk), blkSize, 0, |
1290 Request::wbMasterId); 1291 if (blk->isSecure()) { 1292 req->setFlags(Request::SECURE); 1293 } 1294 req->taskId(blk->task_id); 1295 1296 PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id); 1297 --- 43 unchanged lines hidden (view full) --- 1341} 1342 1343void 1344BaseCache::writebackVisitor(CacheBlk &blk) 1345{ 1346 if (blk.isDirty()) { 1347 assert(blk.isValid()); 1348 | 1299 Request::wbMasterId); 1300 if (blk->isSecure()) { 1301 req->setFlags(Request::SECURE); 1302 } 1303 req->taskId(blk->task_id); 1304 1305 PacketPtr pkt = new Packet(req, MemCmd::WriteClean, blkSize, id); 1306 --- 43 unchanged lines hidden (view full) --- 1350} 1351 1352void 1353BaseCache::writebackVisitor(CacheBlk &blk) 1354{ 1355 if (blk.isDirty()) { 1356 assert(blk.isValid()); 1357 |
1349 Request request(tags->regenerateBlkAddr(&blk), | 1358 Request request(regenerateBlkAddr(&blk), |
1350 blkSize, 0, Request::funcMasterId); 1351 request.taskId(blk.task_id); 1352 if (blk.isSecure()) { 1353 request.setFlags(Request::SECURE); 1354 } 1355 1356 Packet packet(&request, MemCmd::WriteReq); 1357 packet.dataStatic(blk.data); --- 942 unchanged lines hidden --- | 1359 blkSize, 0, Request::funcMasterId); 1360 request.taskId(blk.task_id); 1361 if (blk.isSecure()) { 1362 request.setFlags(Request::SECURE); 1363 } 1364 1365 Packet packet(&request, MemCmd::WriteReq); 1366 packet.dataStatic(blk.data); --- 942 unchanged lines hidden --- |