using namespace std;
-BaseCache::CacheSlavePort::CacheSlavePort(const std::string &_name,
+BaseCache::CacheResponsePort::CacheResponsePort(const std::string &_name,
BaseCache *_cache,
const std::string &_label)
- : QueuedSlavePort(_name, _cache, queue),
+ : QueuedResponsePort(_name, _cache, queue),
queue(*_cache, *this, true, _label),
blocked(false), mustSendRetry(false),
sendRetryEvent([this]{ processSendRetry(); }, _name)
BaseCache::BaseCache(const BaseCacheParams *p, unsigned blk_size)
: ClockedObject(p),
- cpuSidePort (p->name + ".cpu_side", this, "CpuSidePort"),
- memSidePort(p->name + ".mem_side", this, "MemSidePort"),
+ cpuSidePort (p->name + ".cpu_side_port", this, "CpuSidePort"),
+ memSidePort(p->name + ".mem_side_port", this, "MemSidePort"),
mshrQueue("MSHRs", p->mshrs, 0, p->demand_mshr_reserve), // see below
writeBuffer("write buffer", p->write_buffers, p->mshrs), // see below
tags(p->tags),
// buffer before committing to an MSHR
// forward snoops is overridden in init() once we can query
- // whether the connected master is actually snooping or not
+ // whether the connected requestor is actually snooping or not
tempBlock = new TempCacheBlk(blkSize);
}
void
-BaseCache::CacheSlavePort::setBlocked()
+BaseCache::CacheResponsePort::setBlocked()
{
assert(!blocked);
DPRINTF(CachePort, "Port is blocking new requests\n");
}
void
-BaseCache::CacheSlavePort::clearBlocked()
+BaseCache::CacheResponsePort::clearBlocked()
{
assert(blocked);
DPRINTF(CachePort, "Port is accepting new requests\n");
}
void
-BaseCache::CacheSlavePort::processSendRetry()
+BaseCache::CacheResponsePort::processSendRetry()
{
DPRINTF(CachePort, "Port is sending retry\n");
DPRINTF(Cache, "%s coalescing MSHR for %s\n", __func__,
pkt->print());
- assert(pkt->req->masterId() < system->maxMasters());
- stats.cmdStats(pkt).mshr_hits[pkt->req->masterId()]++;
+ assert(pkt->req->requestorId() < system->maxRequestors());
+ stats.cmdStats(pkt).mshr_hits[pkt->req->requestorId()]++;
// We use forward_time here because it is the same
// considering new targets. We have multiple
}
} else {
// no MSHR
- assert(pkt->req->masterId() < system->maxMasters());
- stats.cmdStats(pkt).mshr_misses[pkt->req->masterId()]++;
+ assert(pkt->req->requestorId() < system->maxRequestors());
+ stats.cmdStats(pkt).mshr_misses[pkt->req->requestorId()]++;
if (pkt->isEviction() || pkt->cmd == MemCmd::WriteClean) {
// We use forward_time here because there is an
const QueueEntry::Target *initial_tgt = mshr->getTarget();
const Tick miss_latency = curTick() - initial_tgt->recvTime;
if (pkt->req->isUncacheable()) {
- assert(pkt->req->masterId() < system->maxMasters());
+ assert(pkt->req->requestorId() < system->maxRequestors());
stats.cmdStats(initial_tgt->pkt)
- .mshr_uncacheable_lat[pkt->req->masterId()] += miss_latency;
+ .mshr_uncacheable_lat[pkt->req->requestorId()] += miss_latency;
} else {
- assert(pkt->req->masterId() < system->maxMasters());
+ assert(pkt->req->requestorId() < system->maxRequestors());
stats.cmdStats(initial_tgt->pkt)
- .mshr_miss_latency[pkt->req->masterId()] += miss_latency;
+ .mshr_miss_latency[pkt->req->requestorId()] += miss_latency;
}
PacketList writebacks;
// Request the bus for a prefetch if this deallocation freed enough
// MSHRs for a prefetch to take place
- if (prefetcher && mshrQueue.canPrefetch()) {
+ if (prefetcher && mshrQueue.canPrefetch() && !isBlocked()) {
Tick next_pf_time = std::max(prefetcher->nextPrefetchReadyTime(),
clockEdge());
if (next_pf_time != MaxTick)
// fall through... no pending requests. Try a prefetch.
assert(!miss_mshr && !wq_entry);
- if (prefetcher && mshrQueue.canPrefetch()) {
+ if (prefetcher && mshrQueue.canPrefetch() && !isBlocked()) {
// If we have a miss queue slot, we can try a prefetch
PacketPtr pkt = prefetcher->getPacket();
if (pkt) {
!writeBuffer.findMatch(pf_addr, pkt->isSecure())) {
// Update statistic on number of prefetches issued
// (hwpf_mshr_misses)
- assert(pkt->req->masterId() < system->maxMasters());
- stats.cmdStats(pkt).mshr_misses[pkt->req->masterId()]++;
+ assert(pkt->req->requestorId() < system->maxRequestors());
+ stats.cmdStats(pkt).mshr_misses[pkt->req->requestorId()]++;
// allocate an MSHR and return it, note
// that we send the packet straight away, so do not
// The compressor is called to compress the updated data, so that its
// metadata can be updated.
- std::size_t compression_size = 0;
Cycles compression_lat = Cycles(0);
Cycles decompression_lat = Cycles(0);
- compressor->compress(data, compression_lat, decompression_lat,
- compression_size);
+ const auto comp_data =
+ compressor->compress(data, compression_lat, decompression_lat);
+ std::size_t compression_size = comp_data->getSizeBits();
// If block's compression factor increased, it may not be co-allocatable
// anymore. If so, some blocks might need to be evicted to make room for
// satisfying a string of Read and ReadEx requests from
// upper-level caches, a Read will mark the block as shared but we
// can satisfy a following ReadEx anyway since we can rely on the
- // Read requester(s) to have buffered the ReadEx snoop and to
+ // Read requestor(s) to have buffered the ReadEx snoop and to
// invalidate their blocks after receiving them.
// assert(!pkt->needsWritable() || blk->isWritable());
assert(pkt->getOffset(blkSize) + pkt->getSize() <= blkSize);
// calculate the amount of extra cycles needed to read or write compressed
// blocks.
if (compressor && pkt->hasData()) {
- compressor->compress(pkt->getConstPtr<uint64_t>(), compression_lat,
- decompression_lat, blk_size_bits);
+ const auto comp_data = compressor->compress(
+ pkt->getConstPtr<uint64_t>(), compression_lat, decompression_lat);
+ blk_size_bits = comp_data->getSizeBits();
}
// Find replacement victim
"Writeback from read-only cache");
assert(blk && blk->isValid() && (blk->isDirty() || writebackClean));
- stats.writebacks[Request::wbMasterId]++;
+ stats.writebacks[Request::wbRequestorId]++;
RequestPtr req = std::make_shared<Request>(
- regenerateBlkAddr(blk), blkSize, 0, Request::wbMasterId);
+ regenerateBlkAddr(blk), blkSize, 0, Request::wbRequestorId);
if (blk->isSecure())
req->setFlags(Request::SECURE);
BaseCache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
{
RequestPtr req = std::make_shared<Request>(
- regenerateBlkAddr(blk), blkSize, 0, Request::wbMasterId);
+ regenerateBlkAddr(blk), blkSize, 0, Request::wbRequestorId);
if (blk->isSecure()) {
req->setFlags(Request::SECURE);
assert(blk.isValid());
RequestPtr request = std::make_shared<Request>(
- regenerateBlkAddr(&blk), blkSize, 0, Request::funcMasterId);
+ regenerateBlkAddr(&blk), blkSize, 0, Request::funcRequestorId);
request->taskId(blk.task_id);
if (blk.isSecure()) {
// Don't signal prefetch ready time if no MSHRs available
// Will signal once enoguh MSHRs are deallocated
- if (prefetcher && mshrQueue.canPrefetch()) {
+ if (prefetcher && mshrQueue.canPrefetch() && !isBlocked()) {
nextReady = std::min(nextReady,
prefetcher->nextPrefetchReadyTime());
}
Stats::Group::regStats();
System *system = cache.system;
- const auto max_masters = system->maxMasters();
+ const auto max_requestors = system->maxRequestors();
hits
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- hits.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ hits.subname(i, system->getRequestorName(i));
}
// Miss statistics
misses
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- misses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ misses.subname(i, system->getRequestorName(i));
}
// Miss latency statistics
missLatency
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- missLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ missLatency.subname(i, system->getRequestorName(i));
}
// access formulas
accesses.flags(total | nozero | nonan);
accesses = hits + misses;
- for (int i = 0; i < max_masters; i++) {
- accesses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ accesses.subname(i, system->getRequestorName(i));
}
// miss rate formulas
missRate.flags(total | nozero | nonan);
missRate = misses / accesses;
- for (int i = 0; i < max_masters; i++) {
- missRate.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ missRate.subname(i, system->getRequestorName(i));
}
// miss latency formulas
avgMissLatency.flags(total | nozero | nonan);
avgMissLatency = missLatency / misses;
- for (int i = 0; i < max_masters; i++) {
- avgMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ avgMissLatency.subname(i, system->getRequestorName(i));
}
// MSHR statistics
// MSHR hit statistics
mshr_hits
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- mshr_hits.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ mshr_hits.subname(i, system->getRequestorName(i));
}
// MSHR miss statistics
mshr_misses
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- mshr_misses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ mshr_misses.subname(i, system->getRequestorName(i));
}
// MSHR miss latency statistics
mshr_miss_latency
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- mshr_miss_latency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ mshr_miss_latency.subname(i, system->getRequestorName(i));
}
// MSHR uncacheable statistics
mshr_uncacheable
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- mshr_uncacheable.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ mshr_uncacheable.subname(i, system->getRequestorName(i));
}
// MSHR miss latency statistics
mshr_uncacheable_lat
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- mshr_uncacheable_lat.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ mshr_uncacheable_lat.subname(i, system->getRequestorName(i));
}
// MSHR miss rate formulas
mshrMissRate.flags(total | nozero | nonan);
mshrMissRate = mshr_misses / accesses;
- for (int i = 0; i < max_masters; i++) {
- mshrMissRate.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ mshrMissRate.subname(i, system->getRequestorName(i));
}
// mshrMiss latency formulas
avgMshrMissLatency.flags(total | nozero | nonan);
avgMshrMissLatency = mshr_miss_latency / mshr_misses;
- for (int i = 0; i < max_masters; i++) {
- avgMshrMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ avgMshrMissLatency.subname(i, system->getRequestorName(i));
}
// mshrUncacheable latency formulas
avgMshrUncacheableLatency.flags(total | nozero | nonan);
avgMshrUncacheableLatency = mshr_uncacheable_lat / mshr_uncacheable;
- for (int i = 0; i < max_masters; i++) {
- avgMshrUncacheableLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ avgMshrUncacheableLatency.subname(i, system->getRequestorName(i));
}
}
Stats::Group::regStats();
System *system = cache.system;
- const auto max_masters = system->maxMasters();
+ const auto max_requestors = system->maxRequestors();
for (auto &cs : cmd)
cs->regStatsFromParent();
demandHits.flags(total | nozero | nonan);
demandHits = SUM_DEMAND(hits);
- for (int i = 0; i < max_masters; i++) {
- demandHits.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandHits.subname(i, system->getRequestorName(i));
}
overallHits.flags(total | nozero | nonan);
overallHits = demandHits + SUM_NON_DEMAND(hits);
- for (int i = 0; i < max_masters; i++) {
- overallHits.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallHits.subname(i, system->getRequestorName(i));
}
demandMisses.flags(total | nozero | nonan);
demandMisses = SUM_DEMAND(misses);
- for (int i = 0; i < max_masters; i++) {
- demandMisses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMisses.subname(i, system->getRequestorName(i));
}
overallMisses.flags(total | nozero | nonan);
overallMisses = demandMisses + SUM_NON_DEMAND(misses);
- for (int i = 0; i < max_masters; i++) {
- overallMisses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMisses.subname(i, system->getRequestorName(i));
}
demandMissLatency.flags(total | nozero | nonan);
demandMissLatency = SUM_DEMAND(missLatency);
- for (int i = 0; i < max_masters; i++) {
- demandMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMissLatency.subname(i, system->getRequestorName(i));
}
overallMissLatency.flags(total | nozero | nonan);
overallMissLatency = demandMissLatency + SUM_NON_DEMAND(missLatency);
- for (int i = 0; i < max_masters; i++) {
- overallMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMissLatency.subname(i, system->getRequestorName(i));
}
demandAccesses.flags(total | nozero | nonan);
demandAccesses = demandHits + demandMisses;
- for (int i = 0; i < max_masters; i++) {
- demandAccesses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandAccesses.subname(i, system->getRequestorName(i));
}
overallAccesses.flags(total | nozero | nonan);
overallAccesses = overallHits + overallMisses;
- for (int i = 0; i < max_masters; i++) {
- overallAccesses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallAccesses.subname(i, system->getRequestorName(i));
}
demandMissRate.flags(total | nozero | nonan);
demandMissRate = demandMisses / demandAccesses;
- for (int i = 0; i < max_masters; i++) {
- demandMissRate.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMissRate.subname(i, system->getRequestorName(i));
}
overallMissRate.flags(total | nozero | nonan);
overallMissRate = overallMisses / overallAccesses;
- for (int i = 0; i < max_masters; i++) {
- overallMissRate.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMissRate.subname(i, system->getRequestorName(i));
}
demandAvgMissLatency.flags(total | nozero | nonan);
demandAvgMissLatency = demandMissLatency / demandMisses;
- for (int i = 0; i < max_masters; i++) {
- demandAvgMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandAvgMissLatency.subname(i, system->getRequestorName(i));
}
overallAvgMissLatency.flags(total | nozero | nonan);
overallAvgMissLatency = overallMissLatency / overallMisses;
- for (int i = 0; i < max_masters; i++) {
- overallAvgMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallAvgMissLatency.subname(i, system->getRequestorName(i));
}
blocked_cycles.init(NUM_BLOCKED_CAUSES);
unusedPrefetches.flags(nozero);
writebacks
- .init(max_masters)
+ .init(max_requestors)
.flags(total | nozero | nonan)
;
- for (int i = 0; i < max_masters; i++) {
- writebacks.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ writebacks.subname(i, system->getRequestorName(i));
}
demandMshrHits.flags(total | nozero | nonan);
demandMshrHits = SUM_DEMAND(mshr_hits);
- for (int i = 0; i < max_masters; i++) {
- demandMshrHits.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMshrHits.subname(i, system->getRequestorName(i));
}
overallMshrHits.flags(total | nozero | nonan);
overallMshrHits = demandMshrHits + SUM_NON_DEMAND(mshr_hits);
- for (int i = 0; i < max_masters; i++) {
- overallMshrHits.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMshrHits.subname(i, system->getRequestorName(i));
}
demandMshrMisses.flags(total | nozero | nonan);
demandMshrMisses = SUM_DEMAND(mshr_misses);
- for (int i = 0; i < max_masters; i++) {
- demandMshrMisses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMshrMisses.subname(i, system->getRequestorName(i));
}
overallMshrMisses.flags(total | nozero | nonan);
overallMshrMisses = demandMshrMisses + SUM_NON_DEMAND(mshr_misses);
- for (int i = 0; i < max_masters; i++) {
- overallMshrMisses.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMshrMisses.subname(i, system->getRequestorName(i));
}
demandMshrMissLatency.flags(total | nozero | nonan);
demandMshrMissLatency = SUM_DEMAND(mshr_miss_latency);
- for (int i = 0; i < max_masters; i++) {
- demandMshrMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMshrMissLatency.subname(i, system->getRequestorName(i));
}
overallMshrMissLatency.flags(total | nozero | nonan);
overallMshrMissLatency =
demandMshrMissLatency + SUM_NON_DEMAND(mshr_miss_latency);
- for (int i = 0; i < max_masters; i++) {
- overallMshrMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMshrMissLatency.subname(i, system->getRequestorName(i));
}
overallMshrUncacheable.flags(total | nozero | nonan);
overallMshrUncacheable =
SUM_DEMAND(mshr_uncacheable) + SUM_NON_DEMAND(mshr_uncacheable);
- for (int i = 0; i < max_masters; i++) {
- overallMshrUncacheable.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMshrUncacheable.subname(i, system->getRequestorName(i));
}
overallMshrUncacheableLatency =
SUM_DEMAND(mshr_uncacheable_lat) +
SUM_NON_DEMAND(mshr_uncacheable_lat);
- for (int i = 0; i < max_masters; i++) {
- overallMshrUncacheableLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMshrUncacheableLatency.subname(i, system->getRequestorName(i));
}
demandMshrMissRate.flags(total | nozero | nonan);
demandMshrMissRate = demandMshrMisses / demandAccesses;
- for (int i = 0; i < max_masters; i++) {
- demandMshrMissRate.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandMshrMissRate.subname(i, system->getRequestorName(i));
}
overallMshrMissRate.flags(total | nozero | nonan);
overallMshrMissRate = overallMshrMisses / overallAccesses;
- for (int i = 0; i < max_masters; i++) {
- overallMshrMissRate.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallMshrMissRate.subname(i, system->getRequestorName(i));
}
demandAvgMshrMissLatency.flags(total | nozero | nonan);
demandAvgMshrMissLatency = demandMshrMissLatency / demandMshrMisses;
- for (int i = 0; i < max_masters; i++) {
- demandAvgMshrMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ demandAvgMshrMissLatency.subname(i, system->getRequestorName(i));
}
overallAvgMshrMissLatency.flags(total | nozero | nonan);
overallAvgMshrMissLatency = overallMshrMissLatency / overallMshrMisses;
- for (int i = 0; i < max_masters; i++) {
- overallAvgMshrMissLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallAvgMshrMissLatency.subname(i, system->getRequestorName(i));
}
overallAvgMshrUncacheableLatency.flags(total | nozero | nonan);
overallAvgMshrUncacheableLatency =
overallMshrUncacheableLatency / overallMshrUncacheable;
- for (int i = 0; i < max_masters; i++) {
- overallAvgMshrUncacheableLatency.subname(i, system->getMasterName(i));
+ for (int i = 0; i < max_requestors; i++) {
+ overallAvgMshrUncacheableLatency.subname(i, system->getRequestorName(i));
}
dataExpansions.flags(nozero | nonan);
assert(pkt->isResponse());
- // Express snoop responses from master to slave, e.g., from L1 to L2
+ // Express snoop responses from requestor to responder, e.g., from L1 to L2
cache->recvTimingSnoopResp(pkt);
return true;
}
BaseCache::
CpuSidePort::CpuSidePort(const std::string &_name, BaseCache *_cache,
const std::string &_label)
- : CacheSlavePort(_name, _cache, _label), cache(_cache)
+ : CacheResponsePort(_name, _cache, _label), cache(_cache)
{
}
BaseCache::MemSidePort::MemSidePort(const std::string &_name,
BaseCache *_cache,
const std::string &_label)
- : CacheMasterPort(_name, _cache, _reqQueue, _snoopRespQueue),
+ : CacheRequestPort(_name, _cache, _reqQueue, _snoopRespQueue),
_reqQueue(*_cache, *this, _snoopRespQueue, _label),
_snoopRespQueue(*_cache, *this, true, _label), cache(_cache)
{