gem5 v23.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
base.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012-2013, 2015-2016, 2018-2019 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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2003-2005 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
46#ifndef __MEM_CACHE_BASE_HH__
47#define __MEM_CACHE_BASE_HH__
48
49#include <cassert>
50#include <cstdint>
51#include <string>
52
53#include "base/addr_range.hh"
54#include "base/compiler.hh"
55#include "base/statistics.hh"
56#include "base/trace.hh"
57#include "base/types.hh"
58#include "debug/Cache.hh"
59#include "debug/CachePort.hh"
60#include "enums/Clusivity.hh"
67#include "mem/packet.hh"
68#include "mem/packet_queue.hh"
69#include "mem/qport.hh"
70#include "mem/request.hh"
71#include "params/WriteAllocator.hh"
72#include "sim/clocked_object.hh"
73#include "sim/eventq.hh"
74#include "sim/probe/probe.hh"
75#include "sim/serialize.hh"
76#include "sim/sim_exit.hh"
77#include "sim/system.hh"
78
79namespace gem5
80{
81
82namespace prefetch
83{
84 class Base;
85}
86class MSHR;
87class RequestPort;
88class QueueEntry;
89struct BaseCacheParams;
90
95{
96 protected:
101 {
104 };
105
106 public:
111 {
116 };
117
124 {
133
134 DataUpdate(Addr _addr, bool is_secure)
135 : addr(_addr), isSecure(is_secure), oldData(), newData()
136 {
137 }
138 };
139
140 protected:
141
152 {
153
154 public:
155
161 {
162 DPRINTF(CachePort, "Scheduling send event at %llu\n", time);
164 }
165
166 protected:
167
168 CacheRequestPort(const std::string &_name,
169 ReqPacketQueue &_reqQueue,
170 SnoopRespPacketQueue &_snoopRespQueue) :
171 QueuedRequestPort(_name, _reqQueue, _snoopRespQueue)
172 { }
173
179 virtual bool isSnooping() const { return true; }
180 };
181
189 {
190
191 protected:
192
195
196 public:
197
199 SnoopRespPacketQueue &snoop_resp_queue,
200 const std::string &label) :
202 snoopRespQueue(snoop_resp_queue) { }
203
209 virtual void sendDeferredPacket();
210
220 {
222 DPRINTF(CachePort, "Waiting for snoop response to be "
223 "sent\n");
225 schedSendEvent(when);
226 return true;
227 }
228 return false;
229 }
230 };
231
232
238 {
239 private:
240
243
245
246 // a pointer to our specific cache implementation
248
249 protected:
250
251 virtual void recvTimingSnoopReq(PacketPtr pkt);
252
253 virtual bool recvTimingResp(PacketPtr pkt);
254
255 virtual Tick recvAtomicSnoop(PacketPtr pkt);
256
257 virtual void recvFunctionalSnoop(PacketPtr pkt);
258
259 public:
260
261 MemSidePort(const std::string &_name, BaseCache *_cache,
262 const std::string &_label);
263 };
264
274 {
275
276 public:
277
279 void setBlocked();
280
282 void clearBlocked();
283
284 bool isBlocked() const { return blocked; }
285
286 protected:
287
288 CacheResponsePort(const std::string &_name, BaseCache& _cache,
289 const std::string &_label);
290
292
295
297
299
300 private:
301
302 void processSendRetry();
303
305
306 };
307
313 {
314 protected:
315 virtual bool recvTimingSnoopResp(PacketPtr pkt) override;
316
317 virtual bool tryTiming(PacketPtr pkt) override;
318
319 virtual bool recvTimingReq(PacketPtr pkt) override;
320
321 virtual Tick recvAtomic(PacketPtr pkt) override;
322
323 virtual void recvFunctional(PacketPtr pkt) override;
324
325 virtual AddrRangeList getAddrRanges() const override;
326
327 public:
328
329 CpuSidePort(const std::string &_name, BaseCache& _cache,
330 const std::string &_label);
331
332 };
333
336
337 protected:
338
341
344
347
350
353
356
359
362
369
385
393
398 std::unique_ptr<Packet> pendingDelete;
399
404 void markInService(MSHR *mshr, bool pending_modified_resp)
405 {
406 bool wasFull = mshrQueue.isFull();
407 mshrQueue.markInService(mshr, pending_modified_resp);
408
409 if (wasFull && !mshrQueue.isFull()) {
411 }
412 }
413
415 {
416 bool wasFull = writeBuffer.isFull();
418
419 if (wasFull && !writeBuffer.isFull()) {
421 }
422 }
423
437 inline bool allocOnFill(MemCmd cmd) const
438 {
439 return clusivity == enums::mostly_incl ||
440 cmd == MemCmd::WriteLineReq ||
441 cmd == MemCmd::ReadReq ||
442 cmd == MemCmd::WriteReq ||
443 cmd.isPrefetch() ||
444 cmd.isLLSC();
445 }
446
456
465 Cycles calculateTagOnlyLatency(const uint32_t delay,
466 const Cycles lookup_lat) const;
476 Cycles calculateAccessLatency(const CacheBlk* blk, const uint32_t delay,
477 const Cycles lookup_lat) const;
478
487 virtual bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat,
488 PacketList &writebacks);
489
490 /*
491 * Handle a timing request that hit in the cache
492 *
493 * @param ptk The request packet
494 * @param blk The referenced block
495 * @param request_time The tick at which the block lookup is compete
496 */
497 virtual void handleTimingReqHit(PacketPtr pkt, CacheBlk *blk,
498 Tick request_time);
499
500 /*
501 * Handle a timing request that missed in the cache
502 *
503 * Implementation specific handling for different cache
504 * implementations
505 *
506 * @param ptk The request packet
507 * @param blk The referenced block
508 * @param forward_time The tick at which we can process dependent requests
509 * @param request_time The tick at which the block lookup is compete
510 */
511 virtual void handleTimingReqMiss(PacketPtr pkt, CacheBlk *blk,
512 Tick forward_time,
513 Tick request_time) = 0;
514
515 /*
516 * Handle a timing request that missed in the cache
517 *
518 * Common functionality across different cache implementations
519 *
520 * @param ptk The request packet
521 * @param blk The referenced block
522 * @param mshr Any existing mshr for the referenced cache block
523 * @param forward_time The tick at which we can process dependent requests
524 * @param request_time The tick at which the block lookup is compete
525 */
526 void handleTimingReqMiss(PacketPtr pkt, MSHR *mshr, CacheBlk *blk,
527 Tick forward_time, Tick request_time);
528
533 virtual void recvTimingReq(PacketPtr pkt);
534
540
551 virtual void serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt,
552 CacheBlk *blk) = 0;
553
558 virtual void recvTimingResp(PacketPtr pkt);
559
564 virtual void recvTimingSnoopReq(PacketPtr pkt) = 0;
565
570 virtual void recvTimingSnoopResp(PacketPtr pkt) = 0;
571
585 PacketList &writebacks) = 0;
586
592 virtual Tick recvAtomic(PacketPtr pkt);
593
601
608 virtual void functionalAccess(PacketPtr pkt, bool from_cpu_side);
609
619 void updateBlockData(CacheBlk *blk, const PacketPtr cpkt,
620 bool has_old_data);
621
625 void cmpAndSwap(CacheBlk *blk, PacketPtr pkt);
626
634
638 virtual void doWritebacks(PacketList& writebacks, Tick forward_time) = 0;
639
643 virtual void doWritebacksAtomic(PacketList& writebacks) = 0;
644
661 bool needs_writable,
662 bool is_whole_line_write) const = 0;
663
671 const bool writebackClean;
672
681
688 assert(tempBlockWriteback != nullptr);
689 PacketList writebacks{tempBlockWriteback};
690 doWritebacksAtomic(writebacks);
691 tempBlockWriteback = nullptr;
692 }
693
700
725 bool updateCompressionData(CacheBlk *&blk, const uint64_t* data,
726 PacketList &writebacks);
727
738 virtual void satisfyRequest(PacketPtr pkt, CacheBlk *blk,
739 bool deferred_response = false,
740 bool pending_downgrade = false);
741
751 void maintainClusivity(bool from_cache, CacheBlk *blk);
752
763 PacketList &writebacks);
764
784 PacketList &writebacks, bool allocate);
785
798 CacheBlk *allocateBlock(const PacketPtr pkt, PacketList &writebacks);
807 [[nodiscard]] virtual PacketPtr evictBlock(CacheBlk *blk) = 0;
808
817 void evictBlock(CacheBlk *blk, PacketList &writebacks);
818
824 void invalidateBlock(CacheBlk *blk);
825
833
846
850 virtual void memWriteback() override;
851
859 virtual void memInvalidate() override;
860
866 bool isDirty() const;
867
876 bool inRange(Addr addr) const;
877
881 Tick nextQueueReadyTime() const;
882
884 const unsigned blkSize;
885
891
897
904
907
914
919
921 const int numTarget;
922
925
931 const enums::Clusivity clusivity;
932
939 const bool isReadOnly;
940
948
956
961 uint8_t blocked;
962
964 uint64_t order;
965
968
971
974
979
980 public:
983
985 {
986 CacheCmdStats(BaseCache &c, const std::string &name);
987
994 void regStatsFromParent();
995
997
1036 };
1037
1039 {
1041
1042 void regStats() override;
1043
1045 return *cmd[p->cmdToIndex()];
1046 }
1047
1049
1058
1063
1068
1073
1078
1083
1088
1091
1094
1099
1104
1107
1112
1115
1120
1125
1128
1131
1134
1140
1144
1146 void regProbePoints() override;
1147
1148 public:
1149 BaseCache(const BaseCacheParams &p, unsigned blk_size);
1150 ~BaseCache();
1151
1152 void init() override;
1153
1154 Port &getPort(const std::string &if_name,
1155 PortID idx=InvalidPortID) override;
1156
1161 unsigned
1163 {
1164 return blkSize;
1165 }
1166
1167 const AddrRangeList &getAddrRanges() const { return addrRanges; }
1168
1169 MSHR *allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send = true)
1170 {
1172 pkt, time, order++,
1173 allocOnFill(pkt->cmd));
1174
1175 if (mshrQueue.isFull()) {
1177 }
1178
1179 if (sched_send) {
1180 // schedule the send
1182 }
1183
1184 return mshr;
1185 }
1186
1188 {
1189 // should only see writes or clean evicts here
1190 assert(pkt->isWrite() || pkt->cmd == MemCmd::CleanEvict);
1191
1192 Addr blk_addr = pkt->getBlockAddr(blkSize);
1193
1194 // If using compression, on evictions the block is decompressed and
1195 // the operation's latency is added to the payload delay. Consume
1196 // that payload delay here, meaning that the data is always stored
1197 // uncompressed in the writebuffer
1198 if (compressor) {
1199 time += pkt->payloadDelay;
1200 pkt->payloadDelay = 0;
1201 }
1202
1203 WriteQueueEntry *wq_entry =
1204 writeBuffer.findMatch(blk_addr, pkt->isSecure());
1205 if (wq_entry && !wq_entry->inService) {
1206 DPRINTF(Cache, "Potential to merge writeback %s", pkt->print());
1207 }
1208
1209 writeBuffer.allocate(blk_addr, blkSize, pkt, time, order++);
1210
1211 if (writeBuffer.isFull()) {
1213 }
1214
1215 // schedule the send
1217 }
1218
1222 bool isBlocked() const
1223 {
1224 return blocked != 0;
1225 }
1226
1233 {
1234 uint8_t flag = 1 << cause;
1235 if (blocked == 0) {
1236 stats.blockedCauses[cause]++;
1239 }
1240 blocked |= flag;
1241 DPRINTF(Cache,"Blocking for cause %d, mask=%d\n", cause, blocked);
1242 }
1243
1252 {
1253 uint8_t flag = 1 << cause;
1254 blocked &= ~flag;
1255 DPRINTF(Cache,"Unblocking for cause %d, mask=%d\n", cause, blocked);
1256 if (blocked == 0) {
1259 }
1260 }
1261
1271 {
1273 }
1274
1275 bool inCache(Addr addr, bool is_secure) const {
1276 return tags->findBlock(addr, is_secure);
1277 }
1278
1279 bool hasBeenPrefetched(Addr addr, bool is_secure) const {
1280 CacheBlk *block = tags->findBlock(addr, is_secure);
1281 if (block) {
1282 return block->wasPrefetched();
1283 } else {
1284 return false;
1285 }
1286 }
1287
1288 bool inMissQueue(Addr addr, bool is_secure) const {
1289 return mshrQueue.findMatch(addr, is_secure);
1290 }
1291
1293 {
1294 assert(pkt->req->requestorId() < system->maxRequestors());
1295 stats.cmdStats(pkt).misses[pkt->req->requestorId()]++;
1296 pkt->req->incAccessDepth();
1297 if (missCount) {
1298 --missCount;
1299 if (missCount == 0)
1300 exitSimLoop("A cache reached the maximum miss count");
1301 }
1302 }
1304 {
1305 assert(pkt->req->requestorId() < system->maxRequestors());
1306 stats.cmdStats(pkt).hits[pkt->req->requestorId()]++;
1307 }
1308
1314 bool coalesce() const;
1315
1316
1321 void writebackVisitor(CacheBlk &blk);
1322
1328 void invalidateVisitor(CacheBlk &blk);
1329
1338 virtual bool sendMSHRQueuePacket(MSHR* mshr);
1339
1348 bool sendWriteQueuePacket(WriteQueueEntry* wq_entry);
1349
1355 void serialize(CheckpointOut &cp) const override;
1356 void unserialize(CheckpointIn &cp) override;
1357};
1358
1375{
1376 public:
1377 WriteAllocator(const WriteAllocatorParams &p) :
1378 SimObject(p),
1379 coalesceLimit(p.coalesce_limit * p.block_size),
1380 noAllocateLimit(p.no_allocate_limit * p.block_size),
1381 delayThreshold(p.delay_threshold)
1382 {
1383 reset();
1384 }
1385
1392 bool coalesce() const {
1393 return mode != WriteMode::ALLOCATE;
1394 }
1395
1401 bool allocate() const {
1402 return mode != WriteMode::NO_ALLOCATE;
1403 }
1404
1411 void reset() {
1413 byteCount = 0;
1414 nextAddr = 0;
1415 }
1416
1423 bool delay(Addr blk_addr) {
1424 if (delayCtr[blk_addr] > 0) {
1425 --delayCtr[blk_addr];
1426 return true;
1427 } else {
1428 return false;
1429 }
1430 }
1431
1437 void resetDelay(Addr blk_addr) {
1438 delayCtr.erase(blk_addr);
1439 }
1440
1451 void updateMode(Addr write_addr, unsigned write_size, Addr blk_addr);
1452
1453 private:
1459 enum class WriteMode : char
1460 {
1461 ALLOCATE,
1462 COALESCE,
1464 };
1466
1469
1474 uint32_t byteCount;
1475
1479 const uint32_t coalesceLimit;
1480 const uint32_t noAllocateLimit;
1484 const uint32_t delayThreshold;
1485
1490 std::unordered_map<Addr, Counter> delayCtr;
1491};
1492
1493} // namespace gem5
1494
1495#endif //__MEM_CACHE_BASE_HH__
#define DPRINTF(x,...)
Definition trace.hh:210
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Definitions of a simple cache block class.
const char data[]
Override the default behaviour of sendDeferredPacket to enable the memory-side cache port to also sen...
Definition base.hh:189
bool checkConflictingSnoop(const PacketPtr pkt)
Check if there is a conflicting snoop response about to be send out, and if so simply stall any reque...
Definition base.hh:219
CacheReqPacketQueue(BaseCache &cache, RequestPort &port, SnoopRespPacketQueue &snoop_resp_queue, const std::string &label)
Definition base.hh:198
virtual void sendDeferredPacket()
Override the normal sendDeferredPacket and do not only consider the transmit list (used for responses...
Definition base.cc:2653
SnoopRespPacketQueue & snoopRespQueue
Definition base.hh:194
A cache request port is used for the memory-side port of the cache, and in addition to the basic timi...
Definition base.hh:152
CacheRequestPort(const std::string &_name, ReqPacketQueue &_reqQueue, SnoopRespPacketQueue &_snoopRespQueue)
Definition base.hh:168
void schedSendEvent(Tick time)
Schedule a send of a request packet (from the MSHR).
Definition base.hh:160
virtual bool isSnooping() const
Memory-side port always snoops.
Definition base.hh:179
A cache response port is used for the CPU-side port of the cache, and it is basically a simple timing...
Definition base.hh:274
void clearBlocked()
Return to normal operation and accept new requests.
Definition base.cc:161
EventFunctionWrapper sendRetryEvent
Definition base.hh:304
void setBlocked()
Do not accept any new requests.
Definition base.cc:146
RespPacketQueue queue
A normal packet queue used to store responses.
Definition base.hh:294
The CPU-side port extends the base cache response port with access functions for functional,...
Definition base.hh:313
virtual bool recvTimingSnoopResp(PacketPtr pkt) override
Receive a timing snoop response from the peer.
Definition base.cc:2523
virtual Tick recvAtomic(PacketPtr pkt) override
Receive an atomic request packet from the peer.
Definition base.cc:2570
virtual bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the peer.
Definition base.cc:2552
virtual bool tryTiming(PacketPtr pkt) override
Availability request from the peer.
Definition base.cc:2537
virtual void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the peer.
Definition base.cc:2581
virtual AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition base.cc:2595
The memory-side port extends the base cache request port with access functions for functional,...
Definition base.hh:238
virtual Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition base.cc:2632
virtual void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition base.cc:2641
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition base.cc:2614
virtual void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition base.cc:2622
CacheReqPacketQueue _reqQueue
The cache-specific queue.
Definition base.hh:242
SnoopRespPacketQueue _snoopRespQueue
Definition base.hh:244
A basic cache interface.
Definition base.hh:95
virtual void serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)=0
Service non-deferred MSHR targets using the received response.
virtual void functionalAccess(PacketPtr pkt, bool from_cpu_side)
Performs the access specified by the request.
Definition base.cc:715
const bool isReadOnly
Is this cache read only, for example the instruction cache, or table-walker cache.
Definition base.hh:939
virtual void recvTimingReq(PacketPtr pkt)
Performs the access specified by the request.
Definition base.cc:404
virtual void recvTimingSnoopReq(PacketPtr pkt)=0
Snoops bus transactions to maintain coherence.
virtual void doWritebacks(PacketList &writebacks, Tick forward_time)=0
Insert writebacks into the write buffer.
const Cycles fillLatency
The latency to fill a cache block.
Definition base.hh:906
const Cycles dataLatency
The latency of data access of a cache.
Definition base.hh:896
void invalidateVisitor(CacheBlk &blk)
Cache block visitor that invalidates all blocks in the cache.
Definition base.cc:1837
virtual Cycles handleAtomicReqMiss(PacketPtr pkt, CacheBlk *&blk, PacketList &writebacks)=0
Handle a request in atomic mode that missed in this cache.
ProbePointArg< DataUpdate > * ppDataUpdate
To probe when the contents of a block are updated.
Definition base.hh:368
virtual void doWritebacksAtomic(PacketList &writebacks)=0
Send writebacks down the memory hierarchy in atomic mode.
void updateBlockData(CacheBlk *blk, const PacketPtr cpkt, bool has_old_data)
Update the data contents of a block.
Definition base.cc:771
PacketPtr tempBlockWriteback
Writebacks from the tempBlock, resulting on the response path in atomic mode, must happen after the c...
Definition base.hh:680
MSHR * allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send=true)
Definition base.hh:1169
CpuSidePort cpuSidePort
Definition base.hh:334
bool isDirty() const
Determine if there are any dirty blocks in the cache.
Definition base.cc:1801
void invalidateBlock(CacheBlk *blk)
Invalidate a cache block.
Definition base.cc:1664
MSHR * noTargetMSHR
Pointer to the MSHR that has no targets.
Definition base.hh:970
const bool writebackClean
Determine if clean lines should be written back or not.
Definition base.hh:671
bool sendWriteQueuePacket(WriteQueueEntry *wq_entry)
Similar to sendMSHR, but for a write-queue entry instead.
Definition base.cc:1970
bool inRange(Addr addr) const
Determine if an address is in the ranges covered by this cache.
Definition base.cc:214
virtual void handleTimingReqMiss(PacketPtr pkt, CacheBlk *blk, Tick forward_time, Tick request_time)=0
bool allocOnFill(MemCmd cmd) const
Determine whether we should allocate on a fill or not.
Definition base.hh:437
bool forwardSnoops
Do we forward snoops from mem side port through to cpu side port?
Definition base.hh:924
uint64_t order
Increasing order number assigned to each incoming request.
Definition base.hh:964
void incHitCount(PacketPtr pkt)
Definition base.hh:1303
MSHRQueueIndex
Indexes to enumerate the MSHR queues.
Definition base.hh:101
@ MSHRQueue_WriteBuffer
Definition base.hh:103
virtual void satisfyRequest(PacketPtr pkt, CacheBlk *blk, bool deferred_response=false, bool pending_downgrade=false)
Perform any necessary updates to the block and perform any data exchange between the packet and the b...
Definition base.cc:1089
virtual void memWriteback() override
Write back dirty blocks in the cache using functional accesses.
Definition base.cc:1789
bool updateCompressionData(CacheBlk *&blk, const uint64_t *data, PacketList &writebacks)
When a block is overwriten, its compression information must be updated, and it may need to be recomp...
Definition base.cc:978
bool isBlocked() const
Returns true if the cache is blocked for accesses.
Definition base.hh:1222
gem5::BaseCache::CacheStats stats
bool inMissQueue(Addr addr, bool is_secure) const
Definition base.hh:1288
ProbePointArg< PacketPtr > * ppFill
To probe when a cache fill occurs.
Definition base.hh:361
const Cycles lookupLatency
The latency of tag lookup of a cache.
Definition base.hh:890
Cycles calculateAccessLatency(const CacheBlk *blk, const uint32_t delay, const Cycles lookup_lat) const
Calculate access latency in ticks given a tag lookup latency, and whether access was a hit or miss.
Definition base.cc:1196
Tick nextQueueReadyTime() const
Find next request ready time from among possible sources.
Definition base.cc:1850
ProbePointArg< PacketPtr > * ppHit
To probe when a cache hit occurs.
Definition base.hh:355
void regProbePoints() override
Registers probes.
Definition base.cc:2508
virtual void memInvalidate() override
Invalidates all blocks in the cache.
Definition base.cc:1795
MSHRQueue mshrQueue
Miss status registers.
Definition base.hh:340
virtual PacketPtr createMissPacket(PacketPtr cpu_pkt, CacheBlk *blk, bool needs_writable, bool is_whole_line_write) const =0
Create an appropriate downstream bus request packet.
bool hasBeenPrefetched(Addr addr, bool is_secure) const
Definition base.hh:1279
void markInService(WriteQueueEntry *entry)
Definition base.hh:414
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition base.cc:202
QueueEntry * getNextQueueEntry()
Return the next queue entry to service, either a pending miss from the MSHR queue,...
Definition base.cc:850
unsigned getBlockSize() const
Query block size of a cache.
Definition base.hh:1162
bool inCache(Addr addr, bool is_secure) const
Definition base.hh:1275
void handleUncacheableWriteResp(PacketPtr pkt)
Handling the special case of uncacheable write responses to make recvTimingResp less cluttered.
Definition base.cc:477
const unsigned blkSize
Block size of this cache.
Definition base.hh:884
void writebackTempBlockAtomic()
Send the outstanding tempBlock writeback.
Definition base.hh:687
BlockedCause
Reasons for caches to be blocked.
Definition base.hh:111
@ NUM_BLOCKED_CAUSES
Definition base.hh:115
@ Blocked_NoTargets
Definition base.hh:114
@ Blocked_NoWBBuffers
Definition base.hh:113
const Cycles forwardLatency
This is the forward latency of the cache.
Definition base.hh:903
compression::Base * compressor
Compression method being used.
Definition base.hh:349
const Cycles responseLatency
The latency of sending reponse to its upper level cache/core on a linefill.
Definition base.hh:913
PacketPtr writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
Create a writeclean request for the given block.
Definition base.cc:1743
void schedMemSideSendEvent(Tick time)
Schedule a send event for the memory-side port.
Definition base.hh:1270
ProbePointArg< PacketPtr > * ppMiss
To probe when a cache miss occurs.
Definition base.hh:358
MemSidePort memSidePort
Definition base.hh:335
virtual void handleTimingReqHit(PacketPtr pkt, CacheBlk *blk, Tick request_time)
Definition base.cc:225
virtual Tick recvAtomic(PacketPtr pkt)
Performs the access specified by the request.
Definition base.cc:635
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition base.cc:2014
Counter missCount
The number of misses to trigger an exit event.
Definition base.hh:973
void cmpAndSwap(CacheBlk *blk, PacketPtr pkt)
Handle doing the Compare and Swap function for SPARC.
Definition base.cc:797
virtual void recvTimingResp(PacketPtr pkt)
Handles a response (cache line fill/write ack) from the bus.
Definition base.cc:489
virtual void recvTimingSnoopResp(PacketPtr pkt)=0
Handle a snoop response.
virtual bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks)
Does all the processing necessary to perform the provided request.
Definition base.cc:1230
void setBlocked(BlockedCause cause)
Marks the access path of the cache as blocked for the given cause.
Definition base.hh:1232
Addr regenerateBlkAddr(CacheBlk *blk)
Regenerate block address using tags.
Definition base.cc:183
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
Definition base.hh:398
CacheBlk * allocateBlock(const PacketPtr pkt, PacketList &writebacks)
Allocate a new block and perform any necessary writebacks.
Definition base.cc:1607
prefetch::Base * prefetcher
Prefetcher.
Definition base.hh:352
uint8_t blocked
Bit vector of the blocking reasons for the access path.
Definition base.hh:961
virtual Tick recvAtomicSnoop(PacketPtr pkt)=0
Snoop for the provided request in the cache and return the estimated time taken.
TempCacheBlk * tempBlock
Temporary cache block for occasional transitory use.
Definition base.hh:392
const AddrRangeList addrRanges
The address range to which the cache responds on the CPU side.
Definition base.hh:978
const int numTarget
The number of targets for each MSHR.
Definition base.hh:921
const bool moveContractions
Similar to data expansions, after a block improves its compression, it may need to be moved elsewhere...
Definition base.hh:955
WriteAllocator *const writeAllocator
The writeAllocator drive optimizations for streaming writes.
Definition base.hh:384
void markInService(MSHR *mshr, bool pending_modified_resp)
Mark a request as in service (sent downstream in the memory system), effectively making this MSHR the...
Definition base.hh:404
void allocateWriteBuffer(PacketPtr pkt, Tick time)
Definition base.hh:1187
Cycles calculateTagOnlyLatency(const uint32_t delay, const Cycles lookup_lat) const
Calculate latency of accesses that only touch the tag array.
Definition base.cc:1187
CacheBlk * handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, bool allocate)
Handle a fill operation caused by a received packet.
Definition base.cc:1511
void incMissCount(PacketPtr pkt)
Definition base.hh:1292
WriteQueue writeBuffer
Write/writeback buffer.
Definition base.hh:343
const bool replaceExpansions
when a data expansion of a compressed block happens it will not be able to co-allocate where it is at...
Definition base.hh:947
void serialize(CheckpointOut &cp) const override
Serialize the state of the caches.
Definition base.cc:1994
bool coalesce() const
Checks if the cache is coalescing writes.
Definition base.cc:1808
Cycles blockedCycle
Stores time the cache blocked for statistics.
Definition base.hh:967
const bool sequentialAccess
Whether tags and data are accessed sequentially.
Definition base.hh:918
bool handleEvictions(std::vector< CacheBlk * > &evict_blks, PacketList &writebacks)
Try to evict the given blocks.
Definition base.cc:941
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition base.cc:193
PacketPtr writebackBlk(CacheBlk *blk)
Create a writeback request for the given block.
Definition base.cc:1693
void clearBlocked(BlockedCause cause)
Marks the cache as unblocked for the given cause.
Definition base.hh:1251
const AddrRangeList & getAddrRanges() const
Definition base.hh:1167
virtual PacketPtr evictBlock(CacheBlk *blk)=0
Evict a cache block.
void writebackVisitor(CacheBlk &blk)
Cache block visitor that writes back dirty cache blocks using functional writes.
Definition base.cc:1814
EventFunctionWrapper writebackTempBlockAtomicEvent
An event to writeback the tempBlock after recvAtomic finishes.
Definition base.hh:699
BaseTags * tags
Tag and data Storage.
Definition base.hh:346
const enums::Clusivity clusivity
Clusivity with respect to the upstream cache, determining if we fill into both this cache and the cac...
Definition base.hh:931
virtual bool sendMSHRQueuePacket(MSHR *mshr)
Take an MSHR, turn it into a suitable downstream packet, and send it out.
Definition base.cc:1867
void maintainClusivity(bool from_cache, CacheBlk *blk)
Maintain the clusivity of this cache by potentially invalidating a block.
Definition base.cc:1499
System * system
System we are currently operating in.
Definition base.hh:982
A common base class of Cache tagstore objects.
Definition base.hh:74
virtual CacheBlk * findBlock(Addr addr, bool is_secure) const
Finds the block in the cache without touching it.
Definition base.cc:80
A Basic Cache block.
Definition cache_blk.hh:71
bool wasPrefetched() const
Check if this block was the result of a hardware prefetch, yet to be touched.
Definition cache_blk.hh:249
A coherent cache that can be arranged in flexible topologies.
Definition cache.hh:68
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
A Class for maintaining a list of pending and allocated memory requests.
Definition mshr_queue.hh:62
void markInService(MSHR *mshr, bool pending_modified_resp)
Mark the given MSHR as in service.
MSHR * allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter order, bool alloc_on_fill)
Allocates a new MSHR for the request and size.
Definition mshr_queue.cc:63
Miss Status and handling Register.
Definition mshr.hh:75
bool isLLSC() const
Definition packet.hh:251
bool isPrefetch() const
Definition packet.hh:255
const std::string _name
Definition named.hh:41
virtual std::string name() const
Definition named.hh:47
const std::string label
Label to use for print request packets label stack.
bool checkConflict(const PacketPtr pkt, const int blk_size) const
Check if a packet corresponding to the same address exists in the queue.
void schedSendEvent(Tick when)
Schedule a send event if we are not already waiting for a retry.
Tick deferredPacketReadyTime() const
Get the next packet ready time.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
bool isSecure() const
Definition packet.hh:836
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
Definition packet.cc:368
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
Definition packet.hh:449
bool isWrite() const
Definition packet.hh:594
Addr getBlockAddr(unsigned int blk_size) const
Definition packet.hh:831
RequestPtr req
A pointer to the original request.
Definition packet.hh:377
MemCmd cmd
The command field of the packet.
Definition packet.hh:372
Ports are used to interface objects to each other.
Definition port.hh:62
ProbePointArg generates a point for the class of Arg.
Definition probe.hh:263
A queue entry base class, to be used by both the MSHRs and write-queue entries.
bool inService
True if the entry has been sent downstream.
Entry * findMatch(Addr blk_addr, bool is_secure, bool ignore_uncacheable=true) const
Find the first entry that matches the provided address.
Definition queue.hh:168
bool isFull() const
Definition queue.hh:150
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
Definition qport.hh:111
ReqPacketQueue & reqQueue
Packet queue used to store outgoing requests.
Definition qport.hh:116
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
Definition qport.hh:62
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:79
Abstract superclass for simulation objects.
RequestorID maxRequestors()
Get the number of requestors registered in the system.
Definition system.hh:495
Special instance of CacheBlk for use with tempBlk that deals with its block address regeneration.
Definition cache_blk.hh:501
The write allocator inspects write packets and detects streaming patterns.
Definition base.hh:1375
const uint32_t noAllocateLimit
Definition base.hh:1480
bool coalesce() const
Should writes be coalesced? This is true if the mode is set to NO_ALLOCATE.
Definition base.hh:1392
bool delay(Addr blk_addr)
Access whether we need to delay the current write.
Definition base.hh:1423
WriteAllocator(const WriteAllocatorParams &p)
Definition base.hh:1377
const uint32_t delayThreshold
The number of times the allocator will delay an WriteReq MSHR.
Definition base.hh:1484
std::unordered_map< Addr, Counter > delayCtr
Keep track of the number of times the allocator has delayed an WriteReq MSHR.
Definition base.hh:1490
WriteMode
The current mode for write coalescing and allocation, either normal operation (ALLOCATE),...
Definition base.hh:1460
void reset()
Reset the write allocator state, meaning that it allocates for writes and has not recorded any inform...
Definition base.hh:1411
bool allocate() const
Should writes allocate?
Definition base.hh:1401
void updateMode(Addr write_addr, unsigned write_size, Addr blk_addr)
Update the write mode based on the current write packet.
Definition base.cc:2698
const uint32_t coalesceLimit
Limits for when to switch between the different write modes.
Definition base.hh:1479
uint32_t byteCount
Bytes written contiguously.
Definition base.hh:1474
void resetDelay(Addr blk_addr)
Clear delay counter for the input block.
Definition base.hh:1437
Addr nextAddr
Address to match writes against to detect streams.
Definition base.hh:1468
A write queue for all eviction packets, i.e.
void markInService(WriteQueueEntry *entry)
Mark the given entry as in service.
WriteQueueEntry * allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter order)
Allocates a new WriteQueueEntry for the request and size.
Base cache compressor interface.
Definition base.hh:65
A formula for statistics that is calculated when printed.
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
A vector of scalar stats.
STL vector class.
Definition stl.hh:37
ClockedObject declaration and implementation.
Definition of a basic cache compressor.
Declaration of a common base class for cache tagstore objects.
Declaration of a structure to manage MSHRs.
Bitfield< 29 > c
Definition misc_types.hh:53
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
double Counter
All counters are of 64-bit values.
Definition types.hh:46
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const PortID InvalidPortID
Definition types.hh:246
std::ostream CheckpointOut
Definition serialize.hh:66
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
uint64_t PacketId
Definition packet.hh:74
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
Definition sim_events.cc:88
Declaration of the Packet class.
Declaration of a simple PacketQueue that is associated with a port on which it attempts to send packe...
Declaration of the queued port.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
Declaration of Statistics objects.
statistics::Formula accesses
The number of accesses per command and thread.
Definition base.hh:1015
statistics::Formula avgMshrMissLatency
The average latency of an MSHR miss, per command and thread.
Definition base.hh:1033
void regStatsFromParent()
Callback to register stats from parent CacheStats::regStats().
Definition base.cc:2066
statistics::Formula avgMshrUncacheableLatency
The average latency of an MSHR miss, per command and thread.
Definition base.hh:1035
statistics::Vector misses
Number of misses per thread for each type of command.
Definition base.hh:1003
statistics::Formula missRate
The miss rate per command and thread.
Definition base.hh:1017
statistics::Vector missLatency
Total number of ticks per thread/command spent waiting for a miss.
Definition base.hh:1013
statistics::Formula mshrMissRate
The miss rate in the MSHRs pre command and thread.
Definition base.hh:1031
const BaseCache & cache
Definition base.hh:996
statistics::Vector mshrUncacheableLatency
Total tick latency of each MSHR miss, per command and thread.
Definition base.hh:1029
statistics::Vector hitLatency
Total number of ticks per thread/command spent waiting for a hit.
Definition base.hh:1008
statistics::Vector mshrHits
Number of misses that hit in the MSHRs per command and thread.
Definition base.hh:1021
statistics::Vector mshrUncacheable
Number of misses that miss in the MSHRs, per command and thread.
Definition base.hh:1025
statistics::Formula avgMissLatency
The average miss latency per command and thread.
Definition base.hh:1019
statistics::Vector mshrMisses
Number of misses that miss in the MSHRs, per command and thread.
Definition base.hh:1023
statistics::Vector mshrMissLatency
Total tick latency of each MSHR miss, per command and thread.
Definition base.hh:1027
statistics::Vector hits
Number of hits per thread for each type of command.
Definition base.hh:1000
statistics::Formula overallMshrMissLatency
Total tick latency of overall MSHR misses.
Definition base.hh:1111
statistics::Formula demandMshrMissLatency
Total tick latency of demand MSHR misses.
Definition base.hh:1109
statistics::Formula overallAvgMshrUncacheableLatency
The average overall latency of an MSHR miss.
Definition base.hh:1127
const BaseCache & cache
Definition base.hh:1048
statistics::Formula demandHits
Number of hits for demand accesses.
Definition base.hh:1051
statistics::Formula demandHitLatency
Total number of ticks spent waiting for demand hits.
Definition base.hh:1055
statistics::Formula demandAccesses
The number of demand accesses.
Definition base.hh:1070
statistics::Scalar replacements
Number of replacements of valid blocks.
Definition base.hh:1130
statistics::Formula overallAvgMshrMissLatency
The average overall latency of an MSHR miss.
Definition base.hh:1124
statistics::Formula demandMissRate
The miss rate of all demand accesses.
Definition base.hh:1075
statistics::Formula overallMissRate
The miss rate for all accesses.
Definition base.hh:1077
statistics::Formula demandAvgMshrMissLatency
The average latency of a demand MSHR miss.
Definition base.hh:1122
statistics::Formula demandMshrMisses
Demand misses that miss in the MSHRs.
Definition base.hh:1101
statistics::Formula overallMshrMisses
Total number of misses that miss in the MSHRs.
Definition base.hh:1103
statistics::Formula overallMshrHits
Total number of misses that hit in the MSHRs.
Definition base.hh:1098
statistics::Formula overallHitLatency
Total number of ticks spent waiting for all hits.
Definition base.hh:1057
statistics::Scalar dataContractions
Number of data contractions (blocks that had their compression factor improved).
Definition base.hh:1139
void regStats() override
Callback to set stat parameters.
Definition base.cc:2283
statistics::Scalar dataExpansions
Number of data expansions.
Definition base.hh:1133
statistics::Formula overallMshrUncacheable
Total number of misses that miss in the MSHRs.
Definition base.hh:1106
statistics::Formula demandMissLatency
Total number of ticks spent waiting for demand misses.
Definition base.hh:1065
statistics::Formula overallMisses
Number of misses for all accesses.
Definition base.hh:1062
statistics::Formula overallMshrMissRate
The overall miss rate in the MSHRs.
Definition base.hh:1119
statistics::Formula overallAccesses
The number of overall accesses.
Definition base.hh:1072
std::vector< std::unique_ptr< CacheCmdStats > > cmd
Per-command statistics.
Definition base.hh:1142
statistics::Formula demandMshrMissRate
The demand miss rate in the MSHRs.
Definition base.hh:1117
statistics::Formula avgBlocked
The average number of cycles blocked for each blocked cause.
Definition base.hh:1090
statistics::Formula overallMshrUncacheableLatency
Total tick latency of overall MSHR misses.
Definition base.hh:1114
statistics::Formula demandMisses
Number of misses for demand accesses.
Definition base.hh:1060
statistics::Formula demandAvgMissLatency
The average miss latency for demand misses.
Definition base.hh:1080
statistics::Formula overallMissLatency
Total number of ticks spent waiting for all misses.
Definition base.hh:1067
statistics::Formula demandMshrHits
Demand misses that hit in the MSHRs.
Definition base.hh:1096
statistics::Formula overallAvgMissLatency
The average miss latency for all misses.
Definition base.hh:1082
statistics::Vector blockedCauses
The number of times this cache blocked for each blocked cause.
Definition base.hh:1087
statistics::Vector writebacks
Number of blocks written back per thread.
Definition base.hh:1093
statistics::Vector blockedCycles
The total number of cycles blocked for each blocked cause.
Definition base.hh:1085
statistics::Formula overallHits
Number of hit for all accesses.
Definition base.hh:1053
CacheCmdStats & cmdStats(const PacketPtr p)
Definition base.hh:1044
A data contents update is composed of the updated block's address, the old contents,...
Definition base.hh:124
Addr addr
The updated block's address.
Definition base.hh:126
std::vector< uint64_t > newData
The new data contents.
Definition base.hh:132
DataUpdate(Addr _addr, bool is_secure)
Definition base.hh:134
bool isSecure
Whether the block belongs to the secure address space.
Definition base.hh:128
std::vector< uint64_t > oldData
The stale data contents.
Definition base.hh:130
Write queue entry.

Generated on Mon Jul 10 2023 14:24:30 for gem5 by doxygen 1.9.7