base.cc (12725:3dcb96899659) | base.cc (12728:57bdea4f96aa) |
---|---|
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 --- 1312 unchanged lines hidden (view full) --- 1321 1322 return pkt; 1323} 1324 1325 1326void 1327BaseCache::memWriteback() 1328{ | 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 --- 1312 unchanged lines hidden (view full) --- 1321 1322 return pkt; 1323} 1324 1325 1326void 1327BaseCache::memWriteback() 1328{ |
1329 CacheBlkVisitorWrapper visitor(*this, &BaseCache::writebackVisitor); 1330 tags->forEachBlk(visitor); | 1329 tags->forEachBlk([this](CacheBlk &blk) { writebackVisitor(blk); }); |
1331} 1332 1333void 1334BaseCache::memInvalidate() 1335{ | 1330} 1331 1332void 1333BaseCache::memInvalidate() 1334{ |
1336 CacheBlkVisitorWrapper visitor(*this, &BaseCache::invalidateVisitor); 1337 tags->forEachBlk(visitor); | 1335 tags->forEachBlk([this](CacheBlk &blk) { invalidateVisitor(blk); }); |
1338} 1339 1340bool 1341BaseCache::isDirty() const 1342{ | 1336} 1337 1338bool 1339BaseCache::isDirty() const 1340{ |
1343 CacheBlkIsDirtyVisitor visitor; 1344 tags->forEachBlk(visitor); 1345 1346 return visitor.isDirty(); | 1341 return tags->anyBlk([](CacheBlk &blk) { return blk.isDirty(); }); |
1347} 1348 | 1342} 1343 |
1349bool | 1344void |
1350BaseCache::writebackVisitor(CacheBlk &blk) 1351{ 1352 if (blk.isDirty()) { 1353 assert(blk.isValid()); 1354 1355 Request request(tags->regenerateBlkAddr(&blk), 1356 blkSize, 0, Request::funcMasterId); 1357 request.taskId(blk.task_id); 1358 if (blk.isSecure()) { 1359 request.setFlags(Request::SECURE); 1360 } 1361 1362 Packet packet(&request, MemCmd::WriteReq); 1363 packet.dataStatic(blk.data); 1364 1365 memSidePort.sendFunctional(&packet); 1366 1367 blk.status &= ~BlkDirty; 1368 } | 1345BaseCache::writebackVisitor(CacheBlk &blk) 1346{ 1347 if (blk.isDirty()) { 1348 assert(blk.isValid()); 1349 1350 Request request(tags->regenerateBlkAddr(&blk), 1351 blkSize, 0, Request::funcMasterId); 1352 request.taskId(blk.task_id); 1353 if (blk.isSecure()) { 1354 request.setFlags(Request::SECURE); 1355 } 1356 1357 Packet packet(&request, MemCmd::WriteReq); 1358 packet.dataStatic(blk.data); 1359 1360 memSidePort.sendFunctional(&packet); 1361 1362 blk.status &= ~BlkDirty; 1363 } |
1369 1370 return true; | |
1371} 1372 | 1364} 1365 |
1373bool | 1366void |
1374BaseCache::invalidateVisitor(CacheBlk &blk) 1375{ 1376 if (blk.isDirty()) 1377 warn_once("Invalidating dirty cache lines. " \ 1378 "Expect things to break.\n"); 1379 1380 if (blk.isValid()) { 1381 assert(!blk.isDirty()); 1382 invalidateBlock(&blk); 1383 } | 1367BaseCache::invalidateVisitor(CacheBlk &blk) 1368{ 1369 if (blk.isDirty()) 1370 warn_once("Invalidating dirty cache lines. " \ 1371 "Expect things to break.\n"); 1372 1373 if (blk.isValid()) { 1374 assert(!blk.isDirty()); 1375 invalidateBlock(&blk); 1376 } |
1384 1385 return true; | |
1386} 1387 1388Tick 1389BaseCache::nextQueueReadyTime() const 1390{ 1391 Tick nextReady = std::min(mshrQueue.nextReadyTime(), 1392 writeBuffer.nextReadyTime()); 1393 --- 916 unchanged lines hidden --- | 1377} 1378 1379Tick 1380BaseCache::nextQueueReadyTime() const 1381{ 1382 Tick nextReady = std::min(mshrQueue.nextReadyTime(), 1383 writeBuffer.nextReadyTime()); 1384 --- 916 unchanged lines hidden --- |