Deleted Added
sdiff udiff text old ( 12749:223c83ed9979 ) new ( 12754:15c1d281ce1a )
full compact
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

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

965 mshrQueue.findMatch(pkt->getAddr(), pkt->isSecure())) {
966 DPRINTF(Cache, "Clean writeback %#llx to block with MSHR, "
967 "dropping\n", pkt->getAddr());
968 return true;
969 }
970
971 if (!blk) {
972 // need to do a replacement
973 blk = allocateBlock(pkt->getAddr(), pkt->isSecure(), writebacks);
974 if (!blk) {
975 // no replaceable block available: give up, fwd to next level.
976 incMissCount(pkt);
977 return false;
978 }
979 tags->insertBlock(pkt, blk);
980
981 blk->status |= (BlkValid | BlkReadable);
982 }
983 // only mark the block dirty if we got a writeback command,
984 // and leave it as is for a clean writeback
985 if (pkt->cmd == MemCmd::WritebackDirty) {
986 // TODO: the coherent cache can assert(!blk->isDirty());
987 blk->status |= BlkDirty;

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

1023
1024 if (!blk) {
1025 if (pkt->writeThrough()) {
1026 // if this is a write through packet, we don't try to
1027 // allocate if the block is not present
1028 return false;
1029 } else {
1030 // a writeback that misses needs to allocate a new block
1031 blk = allocateBlock(pkt->getAddr(), pkt->isSecure(),
1032 writebacks);
1033 if (!blk) {
1034 // no replaceable block available: give up, fwd to
1035 // next level.
1036 incMissCount(pkt);
1037 return false;
1038 }
1039 tags->insertBlock(pkt, blk);
1040
1041 blk->status |= (BlkValid | BlkReadable);
1042 }
1043 }
1044
1045 // at this point either this is a writeback or a write-through
1046 // write clean operation and the block is already in this
1047 // cache, we need to update the data and the block flags

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

1119
1120 // only read responses and write-line requests have data;
1121 // note that we don't write the data here for write-line - that
1122 // happens in the subsequent call to satisfyRequest
1123 assert(pkt->isRead() || pkt->cmd == MemCmd::WriteLineReq);
1124
1125 // need to do a replacement if allocating, otherwise we stick
1126 // with the temporary storage
1127 blk = allocate ? allocateBlock(addr, is_secure, writebacks) : nullptr;
1128
1129 if (!blk) {
1130 // No replaceable block or a mostly exclusive
1131 // cache... just use temporary storage to complete the
1132 // current request and then get rid of it
1133 assert(!tempBlock->isValid());
1134 blk = tempBlock;
1135 tempBlock->insert(addr, is_secure);
1136 DPRINTF(Cache, "using temp block for %#llx (%s)\n", addr,
1137 is_secure ? "s" : "ns");
1138 } else {
1139 tags->insertBlock(pkt, blk);
1140 }
1141
1142 // we should never be overwriting a valid block
1143 assert(!blk->isValid());
1144 } else {
1145 // existing block... probably an upgrade
1146 assert(regenerateBlkAddr(blk) == addr);
1147 assert(blk->isSecure() == is_secure);

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

1200 // We pay for fillLatency here.
1201 blk->whenReady = clockEdge() + fillLatency * clockPeriod() +
1202 pkt->payloadDelay;
1203
1204 return blk;
1205}
1206
1207CacheBlk*
1208BaseCache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
1209{
1210 // Find replacement victim
1211 std::vector<CacheBlk*> evict_blks;
1212 CacheBlk *victim = tags->findVictim(addr, is_secure, evict_blks);
1213
1214 // It is valid to return nullptr if there is no victim
1215 if (!victim)
1216 return nullptr;
1217

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

1252 if (blk->wasPrefetched()) {
1253 unusedPrefetches++;
1254 }
1255
1256 evictBlock(blk, writebacks);
1257 }
1258 }
1259
1260 return victim;
1261}
1262
1263void
1264BaseCache::invalidateBlock(CacheBlk *blk)
1265{
1266 if (blk != tempBlock)
1267 tags->invalidate(blk);

--- 1061 unchanged lines hidden ---