gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CacheMemory.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020-2021 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) 1999-2012 Mark D. Hill and David A. Wood
15  * Copyright (c) 2013 Advanced Micro Devices, Inc.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
43 
44 #include "base/intmath.hh"
45 #include "base/logging.hh"
46 #include "debug/HtmMem.hh"
47 #include "debug/RubyCache.hh"
48 #include "debug/RubyCacheTrace.hh"
49 #include "debug/RubyResourceStalls.hh"
50 #include "debug/RubyStats.hh"
52 #include "mem/ruby/protocol/AccessPermission.hh"
54 
55 std::ostream&
56 operator<<(std::ostream& out, const CacheMemory& obj)
57 {
58  obj.print(out);
59  out << std::flush;
60  return out;
61 }
62 
64  : SimObject(p),
65  dataArray(p.dataArrayBanks, p.dataAccessLatency,
66  p.start_index_bit, p.ruby_system),
67  tagArray(p.tagArrayBanks, p.tagAccessLatency,
68  p.start_index_bit, p.ruby_system),
69  cacheMemoryStats(this)
70 {
71  m_cache_size = p.size;
72  m_cache_assoc = p.assoc;
73  m_replacementPolicy_ptr = p.replacement_policy;
74  m_start_index_bit = p.start_index_bit;
75  m_is_instruction_only_cache = p.is_icache;
76  m_resource_stalls = p.resourceStalls;
77  m_block_size = p.block_size; // may be 0 at this point. Updated in init()
79  m_replacementPolicy_ptr) ? true : false;
80 }
81 
82 void
84 {
85  if (m_block_size == 0) {
87  }
89  assert(m_cache_num_sets > 1);
91  assert(m_cache_num_set_bits > 0);
92 
97  // instantiate all the replacement_data here
98  for (int i = 0; i < m_cache_num_sets; i++) {
99  for ( int j = 0; j < m_cache_assoc; j++) {
100  replacement_data[i][j] =
102  }
103  }
104 }
105 
107 {
110  for (int i = 0; i < m_cache_num_sets; i++) {
111  for (int j = 0; j < m_cache_assoc; j++) {
112  delete m_cache[i][j];
113  }
114  }
115 }
116 
117 // convert a Address to its location in the cache
118 int64_t
120 {
121  assert(address == makeLineAddress(address));
122  return bitSelect(address, m_start_index_bit,
124 }
125 
126 // Given a cache index: returns the index of the tag in a set.
127 // returns -1 if the tag is not found.
128 int
129 CacheMemory::findTagInSet(int64_t cacheSet, Addr tag) const
130 {
131  assert(tag == makeLineAddress(tag));
132  // search the set for the tags
133  auto it = m_tag_index.find(tag);
134  if (it != m_tag_index.end())
135  if (m_cache[cacheSet][it->second]->m_Permission !=
136  AccessPermission_NotPresent)
137  return it->second;
138  return -1; // Not found
139 }
140 
141 // Given a cache index: returns the index of the tag in a set.
142 // returns -1 if the tag is not found.
143 int
145  Addr tag) const
146 {
147  assert(tag == makeLineAddress(tag));
148  // search the set for the tags
149  auto it = m_tag_index.find(tag);
150  if (it != m_tag_index.end())
151  return it->second;
152  return -1; // Not found
153 }
154 
155 // Given an unique cache block identifier (idx): return the valid address
156 // stored by the cache block. If the block is invalid/notpresent, the
157 // function returns the 0 address
158 Addr
160 {
161  Addr tmp(0);
162 
163  int set = idx / m_cache_assoc;
164  assert(set < m_cache_num_sets);
165 
166  int way = idx - set * m_cache_assoc;
167  assert (way < m_cache_assoc);
168 
169  AbstractCacheEntry* entry = m_cache[set][way];
170  if (entry == NULL ||
171  entry->m_Permission == AccessPermission_Invalid ||
172  entry->m_Permission == AccessPermission_NotPresent) {
173  return tmp;
174  }
175  return entry->m_Address;
176 }
177 
178 bool
179 CacheMemory::tryCacheAccess(Addr address, RubyRequestType type,
180  DataBlock*& data_ptr)
181 {
182  DPRINTF(RubyCache, "address: %#x\n", address);
183  AbstractCacheEntry* entry = lookup(address);
184  if (entry != nullptr) {
185  // Do we even have a tag match?
187  entry->setLastAccess(curTick());
188  data_ptr = &(entry->getDataBlk());
189 
190  if (entry->m_Permission == AccessPermission_Read_Write) {
191  return true;
192  }
193  if ((entry->m_Permission == AccessPermission_Read_Only) &&
194  (type == RubyRequestType_LD || type == RubyRequestType_IFETCH)) {
195  return true;
196  }
197  // The line must not be accessible
198  }
199  data_ptr = NULL;
200  return false;
201 }
202 
203 bool
204 CacheMemory::testCacheAccess(Addr address, RubyRequestType type,
205  DataBlock*& data_ptr)
206 {
207  DPRINTF(RubyCache, "address: %#x\n", address);
208  AbstractCacheEntry* entry = lookup(address);
209  if (entry != nullptr) {
210  // Do we even have a tag match?
212  entry->setLastAccess(curTick());
213  data_ptr = &(entry->getDataBlk());
214 
215  return entry->m_Permission != AccessPermission_NotPresent;
216  }
217 
218  data_ptr = NULL;
219  return false;
220 }
221 
222 // tests to see if an address is present in the cache
223 bool
225 {
226  const AbstractCacheEntry* const entry = lookup(address);
227  if (entry == nullptr) {
228  // We didn't find the tag
229  DPRINTF(RubyCache, "No tag match for address: %#x\n", address);
230  return false;
231  }
232  DPRINTF(RubyCache, "address: %#x found\n", address);
233  return true;
234 }
235 
236 // Returns true if there is:
237 // a) a tag match on this address or there is
238 // b) an unused line in the same cache "way"
239 bool
241 {
242  assert(address == makeLineAddress(address));
243 
244  int64_t cacheSet = addressToCacheSet(address);
245 
246  for (int i = 0; i < m_cache_assoc; i++) {
247  AbstractCacheEntry* entry = m_cache[cacheSet][i];
248  if (entry != NULL) {
249  if (entry->m_Address == address ||
250  entry->m_Permission == AccessPermission_NotPresent) {
251  // Already in the cache or we found an empty entry
252  return true;
253  }
254  } else {
255  return true;
256  }
257  }
258  return false;
259 }
260 
263 {
264  assert(address == makeLineAddress(address));
265  assert(!isTagPresent(address));
266  assert(cacheAvail(address));
267  DPRINTF(RubyCache, "address: %#x\n", address);
268 
269  // Find the first open slot
270  int64_t cacheSet = addressToCacheSet(address);
271  std::vector<AbstractCacheEntry*> &set = m_cache[cacheSet];
272  for (int i = 0; i < m_cache_assoc; i++) {
273  if (!set[i] || set[i]->m_Permission == AccessPermission_NotPresent) {
274  if (set[i] && (set[i] != entry)) {
275  warn_once("This protocol contains a cache entry handling bug: "
276  "Entries in the cache should never be NotPresent! If\n"
277  "this entry (%#x) is not tracked elsewhere, it will memory "
278  "leak here. Fix your protocol to eliminate these!",
279  address);
280  }
281  set[i] = entry; // Init entry
282  set[i]->m_Address = address;
283  set[i]->m_Permission = AccessPermission_Invalid;
284  DPRINTF(RubyCache, "Allocate clearing lock for addr: %x\n",
285  address);
286  set[i]->m_locked = -1;
287  m_tag_index[address] = i;
288  set[i]->setPosition(cacheSet, i);
289  set[i]->replacementData = replacement_data[cacheSet][i];
290  set[i]->setLastAccess(curTick());
291 
292  // Call reset function here to set initial value for different
293  // replacement policies.
295 
296  return entry;
297  }
298  }
299  panic("Allocate didn't find an available entry");
300 }
301 
302 void
304 {
305  DPRINTF(RubyCache, "address: %#x\n", address);
306  AbstractCacheEntry* entry = lookup(address);
307  assert(entry != nullptr);
309  uint32_t cache_set = entry->getSet();
310  uint32_t way = entry->getWay();
311  delete entry;
312  m_cache[cache_set][way] = NULL;
313  m_tag_index.erase(address);
314 }
315 
316 // Returns with the physical address of the conflicting cache line
317 Addr
319 {
320  assert(address == makeLineAddress(address));
321  assert(!cacheAvail(address));
322 
323  int64_t cacheSet = addressToCacheSet(address);
325  for (int i = 0; i < m_cache_assoc; i++) {
326  candidates.push_back(static_cast<ReplaceableEntry*>(
327  m_cache[cacheSet][i]));
328  }
329  return m_cache[cacheSet][m_replacementPolicy_ptr->
330  getVictim(candidates)->getWay()]->m_Address;
331 }
332 
333 // looks an address up in the cache
336 {
337  assert(address == makeLineAddress(address));
338  int64_t cacheSet = addressToCacheSet(address);
339  int loc = findTagInSet(cacheSet, address);
340  if (loc == -1) return NULL;
341  return m_cache[cacheSet][loc];
342 }
343 
344 // looks an address up in the cache
345 const AbstractCacheEntry*
346 CacheMemory::lookup(Addr address) const
347 {
348  assert(address == makeLineAddress(address));
349  int64_t cacheSet = addressToCacheSet(address);
350  int loc = findTagInSet(cacheSet, address);
351  if (loc == -1) return NULL;
352  return m_cache[cacheSet][loc];
353 }
354 
355 // Sets the most recently used bit for a cache block
356 void
358 {
359  AbstractCacheEntry* entry = lookup(makeLineAddress(address));
360  if (entry != nullptr) {
362  entry->setLastAccess(curTick());
363  }
364 }
365 
366 void
368 {
369  assert(entry != nullptr);
371  entry->setLastAccess(curTick());
372 }
373 
374 void
375 CacheMemory::setMRU(Addr address, int occupancy)
376 {
377  AbstractCacheEntry* entry = lookup(makeLineAddress(address));
378  if (entry != nullptr) {
379  // m_use_occupancy can decide whether we are using WeightedLRU
380  // replacement policy. Depending on different replacement policies,
381  // use different touch() function.
382  if (m_use_occupancy) {
383  static_cast<ReplacementPolicy::WeightedLRU*>(
384  m_replacementPolicy_ptr)->touch(
385  entry->replacementData, occupancy);
386  } else {
388  }
389  entry->setLastAccess(curTick());
390  }
391 }
392 
393 int
394 CacheMemory::getReplacementWeight(int64_t set, int64_t loc)
395 {
396  assert(set < m_cache_num_sets);
397  assert(loc < m_cache_assoc);
398  int ret = 0;
399  if (m_cache[set][loc] != NULL) {
400  ret = m_cache[set][loc]->getNumValidBlocks();
401  assert(ret >= 0);
402  }
403 
404  return ret;
405 }
406 
407 void
409 {
410  uint64_t warmedUpBlocks = 0;
411  M5_VAR_USED uint64_t totalBlocks = (uint64_t)m_cache_num_sets *
412  (uint64_t)m_cache_assoc;
413 
414  for (int i = 0; i < m_cache_num_sets; i++) {
415  for (int j = 0; j < m_cache_assoc; j++) {
416  if (m_cache[i][j] != NULL) {
417  AccessPermission perm = m_cache[i][j]->m_Permission;
418  RubyRequestType request_type = RubyRequestType_NULL;
419  if (perm == AccessPermission_Read_Only) {
421  request_type = RubyRequestType_IFETCH;
422  } else {
423  request_type = RubyRequestType_LD;
424  }
425  } else if (perm == AccessPermission_Read_Write) {
426  request_type = RubyRequestType_ST;
427  }
428 
429  if (request_type != RubyRequestType_NULL) {
430  Tick lastAccessTick;
431  lastAccessTick = m_cache[i][j]->getLastAccess();
432  tr->addRecord(cntrl, m_cache[i][j]->m_Address,
433  0, request_type, lastAccessTick,
434  m_cache[i][j]->getDataBlk());
435  warmedUpBlocks++;
436  }
437  }
438  }
439  }
440 
441  DPRINTF(RubyCacheTrace, "%s: %lli blocks of %lli total blocks"
442  "recorded %.2f%% \n", name().c_str(), warmedUpBlocks,
443  totalBlocks, (float(warmedUpBlocks) / float(totalBlocks)) * 100.0);
444 }
445 
446 void
447 CacheMemory::print(std::ostream& out) const
448 {
449  out << "Cache dump: " << name() << std::endl;
450  for (int i = 0; i < m_cache_num_sets; i++) {
451  for (int j = 0; j < m_cache_assoc; j++) {
452  if (m_cache[i][j] != NULL) {
453  out << " Index: " << i
454  << " way: " << j
455  << " entry: " << *m_cache[i][j] << std::endl;
456  } else {
457  out << " Index: " << i
458  << " way: " << j
459  << " entry: NULL" << std::endl;
460  }
461  }
462  }
463 }
464 
465 void
466 CacheMemory::printData(std::ostream& out) const
467 {
468  out << "printData() not supported" << std::endl;
469 }
470 
471 void
472 CacheMemory::setLocked(Addr address, int context)
473 {
474  DPRINTF(RubyCache, "Setting Lock for addr: %#x to %d\n", address, context);
475  AbstractCacheEntry* entry = lookup(address);
476  assert(entry != nullptr);
477  entry->setLocked(context);
478 }
479 
480 void
482 {
483  DPRINTF(RubyCache, "Clear Lock for addr: %#x\n", address);
484  AbstractCacheEntry* entry = lookup(address);
485  assert(entry != nullptr);
486  entry->clearLocked();
487 }
488 
489 void
491 {
492  // iterate through every set and way to get a cache line
493  for (auto i = m_cache.begin(); i != m_cache.end(); ++i) {
495  for (auto j = set.begin(); j != set.end(); ++j) {
496  AbstractCacheEntry *line = *j;
497  if (line && line->isLocked(context)) {
498  DPRINTF(RubyCache, "Clear Lock for addr: %#x\n",
499  line->m_Address);
500  line->clearLocked();
501  }
502  }
503  }
504 }
505 
506 bool
507 CacheMemory::isLocked(Addr address, int context)
508 {
509  AbstractCacheEntry* entry = lookup(address);
510  assert(entry != nullptr);
511  DPRINTF(RubyCache, "Testing Lock for addr: %#llx cur %d con %d\n",
512  address, entry->m_locked, context);
513  return entry->isLocked(context);
514 }
515 
518  : Stats::Group(parent),
519  ADD_STAT(numDataArrayReads, "Number of data array reads"),
520  ADD_STAT(numDataArrayWrites, "Number of data array writes"),
521  ADD_STAT(numTagArrayReads, "Number of tag array reads"),
522  ADD_STAT(numTagArrayWrites, "Number of tag array writes"),
523  ADD_STAT(numTagArrayStalls, "Number of stalls caused by tag array"),
524  ADD_STAT(numDataArrayStalls, "Number of stalls caused by data array"),
525  ADD_STAT(htmTransCommitReadSet, "Read set size of a committed "
526  "transaction"),
527  ADD_STAT(htmTransCommitWriteSet, "Write set size of a committed "
528  "transaction"),
529  ADD_STAT(htmTransAbortReadSet, "Read set size of a aborted transaction"),
530  ADD_STAT(htmTransAbortWriteSet, "Write set size of a aborted "
531  "transaction"),
532  ADD_STAT(m_demand_hits, "Number of cache demand hits"),
533  ADD_STAT(m_demand_misses, "Number of cache demand misses"),
534  ADD_STAT(m_demand_accesses, "Number of cache demand accesses",
535  m_demand_hits + m_demand_misses),
536  ADD_STAT(m_prefetch_hits, "Number of cache prefetch hits"),
537  ADD_STAT(m_prefetch_misses, "Number of cache prefetch misses"),
538  ADD_STAT(m_prefetch_accesses, "Number of cache prefetch accesses",
539  m_prefetch_hits + m_prefetch_misses),
540  ADD_STAT(m_accessModeType, "")
541 {
544 
547 
550 
553 
556 
559 
561  .init(8)
563 
565  .init(8)
567 
569  .init(8)
571 
573  .init(8)
575 
578 
581 
584 
586  .init(RubyRequestType_NUM)
588 
589  for (int i = 0; i < RubyAccessMode_NUM; i++) {
591  .subname(i, RubyAccessMode_to_string(RubyAccessMode(i)))
593  ;
594  }
595 }
596 
597 // assumption: SLICC generated files will only call this function
598 // once **all** resources are granted
599 void
600 CacheMemory::recordRequestType(CacheRequestType requestType, Addr addr)
601 {
602  DPRINTF(RubyStats, "Recorded statistic: %s\n",
603  CacheRequestType_to_string(requestType));
604  switch(requestType) {
605  case CacheRequestType_DataArrayRead:
606  if (m_resource_stalls)
609  return;
610  case CacheRequestType_DataArrayWrite:
611  if (m_resource_stalls)
614  return;
615  case CacheRequestType_TagArrayRead:
616  if (m_resource_stalls)
619  return;
620  case CacheRequestType_TagArrayWrite:
621  if (m_resource_stalls)
624  return;
625  default:
626  warn("CacheMemory access_type not found: %s",
627  CacheRequestType_to_string(requestType));
628  }
629 }
630 
631 bool
633 {
634  if (!m_resource_stalls) {
635  return true;
636  }
637 
638  if (res == CacheResourceType_TagArray) {
639  if (tagArray.tryAccess(addressToCacheSet(addr))) return true;
640  else {
641  DPRINTF(RubyResourceStalls,
642  "Tag array stall on addr %#x in set %d\n",
645  return false;
646  }
647  } else if (res == CacheResourceType_DataArray) {
648  if (dataArray.tryAccess(addressToCacheSet(addr))) return true;
649  else {
650  DPRINTF(RubyResourceStalls,
651  "Data array stall on addr %#x in set %d\n",
654  return false;
655  }
656  } else {
657  panic("Unrecognized cache resource type.");
658  }
659 }
660 
661 bool
662 CacheMemory::isBlockInvalid(int64_t cache_set, int64_t loc)
663 {
664  return (m_cache[cache_set][loc]->m_Permission == AccessPermission_Invalid);
665 }
666 
667 bool
668 CacheMemory::isBlockNotBusy(int64_t cache_set, int64_t loc)
669 {
670  return (m_cache[cache_set][loc]->m_Permission != AccessPermission_Busy);
671 }
672 
673 /* hardware transactional memory */
674 
675 void
677 {
678  uint64_t htmReadSetSize = 0;
679  uint64_t htmWriteSetSize = 0;
680 
681  // iterate through every set and way to get a cache line
682  for (auto i = m_cache.begin(); i != m_cache.end(); ++i)
683  {
685 
686  for (auto j = set.begin(); j != set.end(); ++j)
687  {
688  AbstractCacheEntry *line = *j;
689 
690  if (line != nullptr) {
691  htmReadSetSize += (line->getInHtmReadSet() ? 1 : 0);
692  htmWriteSetSize += (line->getInHtmWriteSet() ? 1 : 0);
693  if (line->getInHtmWriteSet()) {
694  line->invalidateEntry();
695  }
696  line->setInHtmWriteSet(false);
697  line->setInHtmReadSet(false);
698  line->clearLocked();
699  }
700  }
701  }
702 
705  DPRINTF(HtmMem, "htmAbortTransaction: read set=%u write set=%u\n",
706  htmReadSetSize, htmWriteSetSize);
707 }
708 
709 void
711 {
712  uint64_t htmReadSetSize = 0;
713  uint64_t htmWriteSetSize = 0;
714 
715  // iterate through every set and way to get a cache line
716  for (auto i = m_cache.begin(); i != m_cache.end(); ++i)
717  {
719 
720  for (auto j = set.begin(); j != set.end(); ++j)
721  {
722  AbstractCacheEntry *line = *j;
723  if (line != nullptr) {
724  htmReadSetSize += (line->getInHtmReadSet() ? 1 : 0);
725  htmWriteSetSize += (line->getInHtmWriteSet() ? 1 : 0);
726  line->setInHtmWriteSet(false);
727  line->setInHtmReadSet(false);
728  line->clearLocked();
729  }
730  }
731  }
732 
735  DPRINTF(HtmMem, "htmCommitTransaction: read set=%u write set=%u\n",
736  htmReadSetSize, htmWriteSetSize);
737 }
738 
739 void
741 {
743 }
744 
745 void
747 {
749 }
750 
751 void
753 {
755 }
756 
757 void
759 {
761 }
762 
weighted_lru_rp.hh
CacheMemory::recordCacheContents
void recordCacheContents(int cntrl, CacheRecorder *tr) const
Definition: CacheMemory.cc:408
CacheMemory::cacheMemoryStats
CacheMemory::CacheMemoryStats cacheMemoryStats
AbstractCacheEntry
Definition: AbstractCacheEntry.hh:57
ReplaceableEntry
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
Definition: replaceable_entry.hh:57
CacheMemory::findTagInSetIgnorePermissions
int findTagInSetIgnorePermissions(int64_t cacheSet, Addr tag) const
Definition: CacheMemory.cc:144
CacheMemory::m_cache_size
int m_cache_size
Definition: CacheMemory.hh:184
CacheMemory::Params
RubyCacheParams Params
Definition: CacheMemory.hh:66
CacheMemory::CacheMemoryStats::CacheMemoryStats
CacheMemoryStats(Stats::Group *parent)
Definition: CacheMemory.cc:517
AbstractCacheEntry::setInHtmWriteSet
void setInHtmWriteSet(bool val)
Definition: AbstractCacheEntry.cc:106
warn
#define warn(...)
Definition: logging.hh:239
CacheRecorder
Definition: CacheRecorder.hh:66
CacheMemory::CacheMemoryStats::numDataArrayWrites
Stats::Scalar numDataArrayWrites
Definition: CacheMemory.hh:214
CacheMemory::clearLocked
void clearLocked(Addr addr)
Definition: CacheMemory.cc:481
CacheMemory::lookup
AbstractCacheEntry * lookup(Addr address)
Definition: CacheMemory.cc:335
CacheMemory::tagArray
BankedArray tagArray
Definition: CacheMemory.hh:182
RubySystem::getBlockSizeBytes
static uint32_t getBlockSizeBytes()
Definition: RubySystem.hh:61
CacheMemory::isLocked
bool isLocked(Addr addr, int context)
Definition: CacheMemory.cc:507
makeLineAddress
Addr makeLineAddress(Addr addr)
Definition: Address.cc:54
ReplacementPolicy::Base::touch
virtual void touch(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Update replacement data.
AbstractCacheEntry::setLocked
void setLocked(int context)
Definition: AbstractCacheEntry.cc:78
AbstractCacheEntry::m_Permission
AccessPermission m_Permission
Definition: AbstractCacheEntry.hh:97
warn_once
#define warn_once(...)
Definition: logging.hh:243
ArmISA::i
Bitfield< 7 > i
Definition: miscregs_types.hh:63
CacheMemory::m_cache
std::vector< std::vector< AbstractCacheEntry * > > m_cache
Definition: CacheMemory.hh:176
CacheMemory::dataArray
BankedArray dataArray
Definition: CacheMemory.hh:181
CacheMemory::CacheMemoryStats::m_prefetch_accesses
Stats::Formula m_prefetch_accesses
Definition: CacheMemory.hh:233
CacheMemory::cacheProbe
Addr cacheProbe(Addr address) const
Definition: CacheMemory.cc:318
CacheMemory::~CacheMemory
~CacheMemory()
Definition: CacheMemory.cc:106
ReplaceableEntry::getSet
uint32_t getSet() const
Get set number.
Definition: replaceable_entry.hh:98
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:59
AbstractCacheEntry::m_locked
int m_locked
Definition: AbstractCacheEntry.hh:95
AbstractCacheEntry::getInHtmWriteSet
bool getInHtmWriteSet() const
Definition: AbstractCacheEntry.cc:118
AbstractCacheEntry::m_Address
Addr m_Address
Definition: AbstractCacheEntry.hh:92
AbstractCacheEntry::setInHtmReadSet
void setInHtmReadSet(bool val)
Definition: AbstractCacheEntry.cc:100
std::vector
STL vector class.
Definition: stl.hh:37
CacheMemory::m_tag_index
std::unordered_map< Addr, int > m_tag_index
Definition: CacheMemory.hh:175
CacheMemory::m_cache_num_set_bits
int m_cache_num_set_bits
Definition: CacheMemory.hh:186
AbstractCacheEntry::getInHtmReadSet
bool getInHtmReadSet() const
Definition: AbstractCacheEntry.cc:112
BankedArray::tryAccess
bool tryAccess(int64_t idx)
Definition: BankedArray.cc:53
CacheRecorder::addRecord
void addRecord(int cntrl, Addr data_addr, Addr pc_addr, RubyRequestType type, Tick time, DataBlock &data)
Definition: CacheRecorder.cc:152
CacheMemory::print
void print(std::ostream &out) const
Definition: CacheMemory.cc:447
CacheMemory::CacheMemoryStats::numDataArrayStalls
Stats::Scalar numDataArrayStalls
Definition: CacheMemory.hh:219
CacheMemory::setMRU
void setMRU(Addr address)
Definition: CacheMemory.cc:357
CacheMemory::CacheMemoryStats::numTagArrayReads
Stats::Scalar numTagArrayReads
Definition: CacheMemory.hh:215
CacheMemory::deallocate
void deallocate(Addr address)
Definition: CacheMemory.cc:303
CacheMemory::CacheMemoryStats::htmTransAbortReadSet
Stats::Histogram htmTransAbortReadSet
Definition: CacheMemory.hh:224
CacheMemory::testCacheAccess
bool testCacheAccess(Addr address, RubyRequestType type, DataBlock *&data_ptr)
Definition: CacheMemory.cc:204
CacheMemory::m_use_occupancy
bool m_use_occupancy
Set to true when using WeightedLRU replacement policy, otherwise, set to false.
Definition: CacheMemory.hh:206
DataBlock
Definition: DataBlock.hh:54
Stats::DataWrap::flags
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:339
AbstractCacheEntry::invalidateEntry
virtual void invalidateEntry()
Definition: AbstractCacheEntry.hh:111
ReplacementPolicy::Base::reset
virtual void reset(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Reset replacement data.
CacheMemory::CacheMemoryStats::htmTransCommitReadSet
Stats::Histogram htmTransCommitReadSet
Definition: CacheMemory.hh:222
CacheMemory::m_replacementPolicy_ptr
ReplacementPolicy::Base * m_replacementPolicy_ptr
We use the replacement policies from the Classic memory system.
Definition: CacheMemory.hh:179
ArmISA::j
Bitfield< 24 > j
Definition: miscregs_types.hh:54
CacheMemory::allocate
AbstractCacheEntry * allocate(Addr address, AbstractCacheEntry *new_entry)
Definition: CacheMemory.cc:262
CacheMemory::init
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: CacheMemory.cc:83
CacheMemory::replacement_data
std::vector< std::vector< ReplData > > replacement_data
We store all the ReplacementData in a 2-dimensional array.
Definition: CacheMemory.hh:200
CacheMemory.hh
CacheMemory::CacheMemoryStats::m_prefetch_hits
Stats::Scalar m_prefetch_hits
Definition: CacheMemory.hh:231
DPRINTF
#define DPRINTF(x,...)
Definition: trace.hh:237
ADD_STAT
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition: group.hh:71
CacheMemory::printData
void printData(std::ostream &out) const
Definition: CacheMemory.cc:466
CacheMemory::CacheMemory
CacheMemory(const Params &p)
Definition: CacheMemory.cc:63
CacheMemory::cacheAvail
bool cacheAvail(Addr address) const
Definition: CacheMemory.cc:240
CacheMemory
Definition: CacheMemory.hh:63
bitSelect
Addr bitSelect(Addr addr, unsigned int small, unsigned int big)
Definition: Address.cc:35
CacheMemory::m_cache_assoc
int m_cache_assoc
Definition: CacheMemory.hh:187
RiscvISA::perm
Bitfield< 3, 1 > perm
Definition: pagetable.hh:69
CacheMemory::CacheMemoryStats::m_prefetch_misses
Stats::Scalar m_prefetch_misses
Definition: CacheMemory.hh:232
AbstractCacheEntry::clearLocked
void clearLocked()
Definition: AbstractCacheEntry.cc:85
CacheMemory::isBlockInvalid
bool isBlockInvalid(int64_t cache_set, int64_t loc)
Definition: CacheMemory.cc:662
ReplaceableEntry::replacementData
std::shared_ptr< ReplacementPolicy::ReplacementData > replacementData
Replacement data associated to this entry.
Definition: replaceable_entry.hh:78
CacheMemory::CacheMemoryStats::htmTransCommitWriteSet
Stats::Histogram htmTransCommitWriteSet
Definition: CacheMemory.hh:223
RubySystem.hh
ReplacementPolicy::Base::invalidate
virtual void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Invalidate replacement data to set it as the next probable victim.
CacheMemory::CacheMemoryStats::numDataArrayReads
Stats::Scalar numDataArrayReads
Definition: CacheMemory.hh:213
CacheMemory::m_block_size
int m_block_size
Definition: CacheMemory.hh:190
CacheMemory::CacheMemoryStats::m_demand_hits
Stats::Scalar m_demand_hits
Definition: CacheMemory.hh:227
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:148
CacheMemory::findTagInSet
int findTagInSet(int64_t line, Addr tag) const
Definition: CacheMemory.cc:129
Stats::dist
const FlagsType dist
Print the distribution.
Definition: info.hh:56
Stats::VectorBase::init
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1028
AbstractCacheEntry::isLocked
bool isLocked(int context) const
Definition: AbstractCacheEntry.cc:92
CacheMemory::clearLockedAll
void clearLockedAll(int context)
Definition: CacheMemory.cc:490
CacheMemory::CacheMemoryStats::m_demand_misses
Stats::Scalar m_demand_misses
Definition: CacheMemory.hh:228
Stats::nozero
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:58
CacheMemory::m_start_index_bit
int m_start_index_bit
Definition: CacheMemory.hh:188
ReplacementPolicy::Base::instantiateEntry
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:80
SimObject::name
virtual const std::string name() const
Definition: sim_object.hh:182
AbstractCacheEntry::setLastAccess
void setLastAccess(Tick tick)
Definition: AbstractCacheEntry.hh:104
CacheMemory::tryCacheAccess
bool tryCacheAccess(Addr address, RubyRequestType type, DataBlock *&data_ptr)
Definition: CacheMemory.cc:179
floorLog2
std::enable_if_t< std::is_integral< T >::value, int > floorLog2(T x)
Definition: intmath.hh:63
CacheMemory::htmCommitTransaction
void htmCommitTransaction()
Definition: CacheMemory.cc:710
CacheMemory::setLocked
void setLocked(Addr addr, int context)
Definition: CacheMemory.cc:472
operator<<
std::ostream & operator<<(std::ostream &out, const CacheMemory &obj)
Definition: CacheMemory.cc:56
Stats::pdf
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:52
CacheMemory::isTagPresent
bool isTagPresent(Addr address) const
Definition: CacheMemory.cc:224
Stats::Group
Statistics container.
Definition: group.hh:87
CacheMemory::profilePrefetchHit
void profilePrefetchHit()
Definition: CacheMemory.cc:752
CacheMemory::CacheMemoryStats::m_accessModeType
Stats::Vector m_accessModeType
Definition: CacheMemory.hh:235
CacheMemory::getAddressAtIdx
Addr getAddressAtIdx(int idx) const
Definition: CacheMemory.cc:159
Stats::DistBase::sample
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
Definition: statistics.hh:1323
logging.hh
CacheMemory::m_is_instruction_only_cache
bool m_is_instruction_only_cache
Definition: CacheMemory.hh:171
CacheMemory::addressToCacheSet
int64_t addressToCacheSet(Addr address) const
Definition: CacheMemory.cc:119
CacheMemory::CacheMemoryStats::numTagArrayWrites
Stats::Scalar numTagArrayWrites
Definition: CacheMemory.hh:216
CacheMemory::profileDemandMiss
void profileDemandMiss()
Definition: CacheMemory.cc:746
Stats::DataWrapVec::subname
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation.
Definition: statistics.hh:383
X86ISA::type
type
Definition: misc.hh:727
CacheMemory::profileDemandHit
void profileDemandHit()
Definition: CacheMemory.cc:740
Stats
Definition: statistics.cc:53
curTick
Tick curTick()
The universal simulation clock.
Definition: cur_tick.hh:43
ReplacementPolicy::WeightedLRU
Definition: weighted_lru_rp.hh:46
CacheMemory::profilePrefetchMiss
void profilePrefetchMiss()
Definition: CacheMemory.cc:758
Stats::Histogram::init
Histogram & init(size_type size)
Set the parameters of this histogram.
Definition: statistics.hh:2153
CacheMemory::checkResourceAvailable
bool checkResourceAvailable(CacheResourceType res, Addr addr)
Definition: CacheMemory.cc:632
CacheMemory::CacheMemoryStats::htmTransAbortWriteSet
Stats::Histogram htmTransAbortWriteSet
Definition: CacheMemory.hh:225
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
intmath.hh
Stats::total
const FlagsType total
Print the total.
Definition: info.hh:50
BankedArray::reserve
void reserve(int64_t idx)
Definition: BankedArray.cc:69
CacheMemory::CacheMemoryStats::numTagArrayStalls
Stats::Scalar numTagArrayStalls
Definition: CacheMemory.hh:218
CacheMemory::recordRequestType
void recordRequestType(CacheRequestType requestType, Addr addr)
Definition: CacheMemory.cc:600
CacheMemory::htmAbortTransaction
void htmAbortTransaction()
Definition: CacheMemory.cc:676
CacheMemory::getReplacementWeight
int getReplacementWeight(int64_t set, int64_t loc)
Definition: CacheMemory.cc:394
CacheMemory::m_cache_num_sets
int m_cache_num_sets
Definition: CacheMemory.hh:185
Stats::nonan
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:60
AbstractCacheEntry::getDataBlk
virtual DataBlock & getDataBlk()
Definition: AbstractCacheEntry.hh:76
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171
CacheMemory::m_resource_stalls
bool m_resource_stalls
Definition: CacheMemory.hh:189
CacheMemory::isBlockNotBusy
bool isBlockNotBusy(int64_t cache_set, int64_t loc)
Definition: CacheMemory.cc:668
ReplaceableEntry::getWay
uint32_t getWay() const
Get way number.
Definition: replaceable_entry.hh:105
SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:141

Generated on Tue Jun 22 2021 15:28:30 for gem5 by doxygen 1.8.17