gem5  v20.0.0.3
CacheMemory.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2012 Mark D. Hill and David A. Wood
3  * Copyright (c) 2013 Advanced Micro Devices, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
31 
32 #include "base/intmath.hh"
33 #include "base/logging.hh"
34 #include "debug/RubyCache.hh"
35 #include "debug/RubyCacheTrace.hh"
36 #include "debug/RubyResourceStalls.hh"
37 #include "debug/RubyStats.hh"
39 #include "mem/ruby/protocol/AccessPermission.hh"
41 
42 using namespace std;
43 
44 ostream&
45 operator<<(ostream& out, const CacheMemory& obj)
46 {
47  obj.print(out);
48  out << flush;
49  return out;
50 }
51 
53 RubyCacheParams::create()
54 {
55  return new CacheMemory(this);
56 }
57 
59  : SimObject(p),
60  dataArray(p->dataArrayBanks, p->dataAccessLatency,
61  p->start_index_bit, p->ruby_system),
62  tagArray(p->tagArrayBanks, p->tagAccessLatency,
63  p->start_index_bit, p->ruby_system)
64 {
65  m_cache_size = p->size;
66  m_cache_assoc = p->assoc;
67  m_replacementPolicy_ptr = p->replacement_policy;
68  m_start_index_bit = p->start_index_bit;
69  m_is_instruction_only_cache = p->is_icache;
70  m_resource_stalls = p->resourceStalls;
71  m_block_size = p->block_size; // may be 0 at this point. Updated in init()
72  m_use_occupancy = dynamic_cast<WeightedLRUPolicy*>(
73  m_replacementPolicy_ptr) ? true : false;
74 }
75 
76 void
78 {
79  if (m_block_size == 0) {
81  }
83  assert(m_cache_num_sets > 1);
85  assert(m_cache_num_set_bits > 0);
86 
91  // instantiate all the replacement_data here
92  for (int i = 0; i < m_cache_num_sets; i++) {
93  for ( int j = 0; j < m_cache_assoc; j++) {
94  replacement_data[i][j] =
96  }
97  }
98 }
99 
101 {
104  for (int i = 0; i < m_cache_num_sets; i++) {
105  for (int j = 0; j < m_cache_assoc; j++) {
106  delete m_cache[i][j];
107  }
108  }
109 }
110 
111 // convert a Address to its location in the cache
112 int64_t
114 {
115  assert(address == makeLineAddress(address));
116  return bitSelect(address, m_start_index_bit,
118 }
119 
120 // Given a cache index: returns the index of the tag in a set.
121 // returns -1 if the tag is not found.
122 int
123 CacheMemory::findTagInSet(int64_t cacheSet, Addr tag) const
124 {
125  assert(tag == makeLineAddress(tag));
126  // search the set for the tags
127  auto it = m_tag_index.find(tag);
128  if (it != m_tag_index.end())
129  if (m_cache[cacheSet][it->second]->m_Permission !=
130  AccessPermission_NotPresent)
131  return it->second;
132  return -1; // Not found
133 }
134 
135 // Given a cache index: returns the index of the tag in a set.
136 // returns -1 if the tag is not found.
137 int
139  Addr tag) const
140 {
141  assert(tag == makeLineAddress(tag));
142  // search the set for the tags
143  auto it = m_tag_index.find(tag);
144  if (it != m_tag_index.end())
145  return it->second;
146  return -1; // Not found
147 }
148 
149 // Given an unique cache block identifier (idx): return the valid address
150 // stored by the cache block. If the block is invalid/notpresent, the
151 // function returns the 0 address
152 Addr
154 {
155  Addr tmp(0);
156 
157  int set = idx / m_cache_assoc;
158  assert(set < m_cache_num_sets);
159 
160  int way = idx - set * m_cache_assoc;
161  assert (way < m_cache_assoc);
162 
163  AbstractCacheEntry* entry = m_cache[set][way];
164  if (entry == NULL ||
165  entry->m_Permission == AccessPermission_Invalid ||
166  entry->m_Permission == AccessPermission_NotPresent) {
167  return tmp;
168  }
169  return entry->m_Address;
170 }
171 
172 bool
173 CacheMemory::tryCacheAccess(Addr address, RubyRequestType type,
174  DataBlock*& data_ptr)
175 {
176  assert(address == makeLineAddress(address));
177  DPRINTF(RubyCache, "address: %#x\n", address);
178  int64_t cacheSet = addressToCacheSet(address);
179  int loc = findTagInSet(cacheSet, address);
180  if (loc != -1) {
181  // Do we even have a tag match?
182  AbstractCacheEntry* entry = m_cache[cacheSet][loc];
184  m_cache[cacheSet][loc]->setLastAccess(curTick());
185  data_ptr = &(entry->getDataBlk());
186 
187  if (entry->m_Permission == AccessPermission_Read_Write) {
188  return true;
189  }
190  if ((entry->m_Permission == AccessPermission_Read_Only) &&
191  (type == RubyRequestType_LD || type == RubyRequestType_IFETCH)) {
192  return true;
193  }
194  // The line must not be accessible
195  }
196  data_ptr = NULL;
197  return false;
198 }
199 
200 bool
201 CacheMemory::testCacheAccess(Addr address, RubyRequestType type,
202  DataBlock*& data_ptr)
203 {
204  assert(address == makeLineAddress(address));
205  DPRINTF(RubyCache, "address: %#x\n", address);
206  int64_t cacheSet = addressToCacheSet(address);
207  int loc = findTagInSet(cacheSet, address);
208 
209  if (loc != -1) {
210  // Do we even have a tag match?
211  AbstractCacheEntry* entry = m_cache[cacheSet][loc];
213  m_cache[cacheSet][loc]->setLastAccess(curTick());
214  data_ptr = &(entry->getDataBlk());
215 
216  return m_cache[cacheSet][loc]->m_Permission !=
217  AccessPermission_NotPresent;
218  }
219 
220  data_ptr = NULL;
221  return false;
222 }
223 
224 // tests to see if an address is present in the cache
225 bool
227 {
228  assert(address == makeLineAddress(address));
229  int64_t cacheSet = addressToCacheSet(address);
230  int loc = findTagInSet(cacheSet, address);
231 
232  if (loc == -1) {
233  // We didn't find the tag
234  DPRINTF(RubyCache, "No tag match for address: %#x\n", address);
235  return false;
236  }
237  DPRINTF(RubyCache, "address: %#x found\n", address);
238  return true;
239 }
240 
241 // Returns true if there is:
242 // a) a tag match on this address or there is
243 // b) an unused line in the same cache "way"
244 bool
246 {
247  assert(address == makeLineAddress(address));
248 
249  int64_t cacheSet = addressToCacheSet(address);
250 
251  for (int i = 0; i < m_cache_assoc; i++) {
252  AbstractCacheEntry* entry = m_cache[cacheSet][i];
253  if (entry != NULL) {
254  if (entry->m_Address == address ||
255  entry->m_Permission == AccessPermission_NotPresent) {
256  // Already in the cache or we found an empty entry
257  return true;
258  }
259  } else {
260  return true;
261  }
262  }
263  return false;
264 }
265 
268 {
269  assert(address == makeLineAddress(address));
270  assert(!isTagPresent(address));
271  assert(cacheAvail(address));
272  DPRINTF(RubyCache, "address: %#x\n", address);
273 
274  // Find the first open slot
275  int64_t cacheSet = addressToCacheSet(address);
276  std::vector<AbstractCacheEntry*> &set = m_cache[cacheSet];
277  for (int i = 0; i < m_cache_assoc; i++) {
278  if (!set[i] || set[i]->m_Permission == AccessPermission_NotPresent) {
279  if (set[i] && (set[i] != entry)) {
280  warn_once("This protocol contains a cache entry handling bug: "
281  "Entries in the cache should never be NotPresent! If\n"
282  "this entry (%#x) is not tracked elsewhere, it will memory "
283  "leak here. Fix your protocol to eliminate these!",
284  address);
285  }
286  set[i] = entry; // Init entry
287  set[i]->m_Address = address;
288  set[i]->m_Permission = AccessPermission_Invalid;
289  DPRINTF(RubyCache, "Allocate clearing lock for addr: %x\n",
290  address);
291  set[i]->m_locked = -1;
292  m_tag_index[address] = i;
293  set[i]->setPosition(cacheSet, i);
294  // Call reset function here to set initial value for different
295  // replacement policies.
297  set[i]->setLastAccess(curTick());
298  return entry;
299  }
300  }
301  panic("Allocate didn't find an available entry");
302 }
303 
304 void
306 {
307  assert(address == makeLineAddress(address));
308  assert(isTagPresent(address));
309  DPRINTF(RubyCache, "address: %#x\n", address);
310  int64_t cacheSet = addressToCacheSet(address);
311  int loc = findTagInSet(cacheSet, address);
312  if (loc != -1) {
314  delete m_cache[cacheSet][loc];
315  m_cache[cacheSet][loc] = NULL;
316  m_tag_index.erase(address);
317  }
318 }
319 
320 // Returns with the physical address of the conflicting cache line
321 Addr
323 {
324  assert(address == makeLineAddress(address));
325  assert(!cacheAvail(address));
326 
327  int64_t cacheSet = addressToCacheSet(address);
329  for (int i = 0; i < m_cache_assoc; i++) {
330  // Pass the value of replacement_data to the cache entry so that we
331  // can use it in the getVictim() function.
332  m_cache[cacheSet][i]->replacementData = replacement_data[cacheSet][i];
333  candidates.push_back(static_cast<ReplaceableEntry*>(
334  m_cache[cacheSet][i]));
335  }
336  return m_cache[cacheSet][m_replacementPolicy_ptr->
337  getVictim(candidates)->getWay()]->m_Address;
338 }
339 
340 // looks an address up in the cache
343 {
344  assert(address == makeLineAddress(address));
345  int64_t cacheSet = addressToCacheSet(address);
346  int loc = findTagInSet(cacheSet, address);
347  if (loc == -1) return NULL;
348  return m_cache[cacheSet][loc];
349 }
350 
351 // looks an address up in the cache
352 const AbstractCacheEntry*
353 CacheMemory::lookup(Addr address) const
354 {
355  assert(address == makeLineAddress(address));
356  int64_t cacheSet = addressToCacheSet(address);
357  int loc = findTagInSet(cacheSet, address);
358  if (loc == -1) return NULL;
359  return m_cache[cacheSet][loc];
360 }
361 
362 // Sets the most recently used bit for a cache block
363 void
365 {
366  int64_t cacheSet = addressToCacheSet(address);
367  int loc = findTagInSet(cacheSet, address);
368 
369  if (loc != -1) {
371  m_cache[cacheSet][loc]->setLastAccess(curTick());
372  }
373 }
374 
375 void
377 {
378  uint32_t cacheSet = e->getSet();
379  uint32_t loc = e->getWay();
381  m_cache[cacheSet][loc]->setLastAccess(curTick());
382 }
383 
384 void
385 CacheMemory::setMRU(Addr address, int occupancy)
386 {
387  int64_t cacheSet = addressToCacheSet(address);
388  int loc = findTagInSet(cacheSet, address);
389 
390  if (loc != -1) {
391  // m_use_occupancy can decide whether we are using WeightedLRU
392  // replacement policy. Depending on different replacement policies,
393  // use different touch() function.
394  if (m_use_occupancy) {
395  static_cast<WeightedLRUPolicy*>(m_replacementPolicy_ptr)->touch(
396  replacement_data[cacheSet][loc], occupancy);
397  } else {
399  touch(replacement_data[cacheSet][loc]);
400  }
401  m_cache[cacheSet][loc]->setLastAccess(curTick());
402  }
403 }
404 
405 int
406 CacheMemory::getReplacementWeight(int64_t set, int64_t loc)
407 {
408  assert(set < m_cache_num_sets);
409  assert(loc < m_cache_assoc);
410  int ret = 0;
411  if (m_cache[set][loc] != NULL) {
412  ret = m_cache[set][loc]->getNumValidBlocks();
413  assert(ret >= 0);
414  }
415 
416  return ret;
417 }
418 
419 void
421 {
422  uint64_t warmedUpBlocks = 0;
423  uint64_t totalBlocks M5_VAR_USED = (uint64_t)m_cache_num_sets *
424  (uint64_t)m_cache_assoc;
425 
426  for (int i = 0; i < m_cache_num_sets; i++) {
427  for (int j = 0; j < m_cache_assoc; j++) {
428  if (m_cache[i][j] != NULL) {
429  AccessPermission perm = m_cache[i][j]->m_Permission;
430  RubyRequestType request_type = RubyRequestType_NULL;
431  if (perm == AccessPermission_Read_Only) {
433  request_type = RubyRequestType_IFETCH;
434  } else {
435  request_type = RubyRequestType_LD;
436  }
437  } else if (perm == AccessPermission_Read_Write) {
438  request_type = RubyRequestType_ST;
439  }
440 
441  if (request_type != RubyRequestType_NULL) {
442  Tick lastAccessTick;
443  lastAccessTick = m_cache[i][j]->getLastAccess();
444  tr->addRecord(cntrl, m_cache[i][j]->m_Address,
445  0, request_type, lastAccessTick,
446  m_cache[i][j]->getDataBlk());
447  warmedUpBlocks++;
448  }
449  }
450  }
451  }
452 
453  DPRINTF(RubyCacheTrace, "%s: %lli blocks of %lli total blocks"
454  "recorded %.2f%% \n", name().c_str(), warmedUpBlocks,
455  totalBlocks, (float(warmedUpBlocks) / float(totalBlocks)) * 100.0);
456 }
457 
458 void
459 CacheMemory::print(ostream& out) const
460 {
461  out << "Cache dump: " << name() << endl;
462  for (int i = 0; i < m_cache_num_sets; i++) {
463  for (int j = 0; j < m_cache_assoc; j++) {
464  if (m_cache[i][j] != NULL) {
465  out << " Index: " << i
466  << " way: " << j
467  << " entry: " << *m_cache[i][j] << endl;
468  } else {
469  out << " Index: " << i
470  << " way: " << j
471  << " entry: NULL" << endl;
472  }
473  }
474  }
475 }
476 
477 void
478 CacheMemory::printData(ostream& out) const
479 {
480  out << "printData() not supported" << endl;
481 }
482 
483 void
484 CacheMemory::setLocked(Addr address, int context)
485 {
486  DPRINTF(RubyCache, "Setting Lock for addr: %#x to %d\n", address, context);
487  assert(address == makeLineAddress(address));
488  int64_t cacheSet = addressToCacheSet(address);
489  int loc = findTagInSet(cacheSet, address);
490  assert(loc != -1);
491  m_cache[cacheSet][loc]->setLocked(context);
492 }
493 
494 void
496 {
497  DPRINTF(RubyCache, "Clear Lock for addr: %#x\n", address);
498  assert(address == makeLineAddress(address));
499  int64_t cacheSet = addressToCacheSet(address);
500  int loc = findTagInSet(cacheSet, address);
501  assert(loc != -1);
502  m_cache[cacheSet][loc]->clearLocked();
503 }
504 
505 bool
506 CacheMemory::isLocked(Addr address, int context)
507 {
508  assert(address == makeLineAddress(address));
509  int64_t cacheSet = addressToCacheSet(address);
510  int loc = findTagInSet(cacheSet, address);
511  assert(loc != -1);
512  DPRINTF(RubyCache, "Testing Lock for addr: %#llx cur %d con %d\n",
513  address, m_cache[cacheSet][loc]->m_locked, context);
514  return m_cache[cacheSet][loc]->isLocked(context);
515 }
516 
517 void
519 {
521 
523  .name(name() + ".demand_hits")
524  .desc("Number of cache demand hits")
525  ;
526 
528  .name(name() + ".demand_misses")
529  .desc("Number of cache demand misses")
530  ;
531 
533  .name(name() + ".demand_accesses")
534  .desc("Number of cache demand accesses")
535  ;
536 
538 
540  .name(name() + ".total_sw_prefetches")
541  .desc("Number of software prefetches")
543  ;
544 
546  .name(name() + ".total_hw_prefetches")
547  .desc("Number of hardware prefetches")
549  ;
550 
552  .name(name() + ".total_prefetches")
553  .desc("Number of prefetches")
555  ;
556 
558 
560  .init(RubyRequestType_NUM)
561  .name(name() + ".access_mode")
563  ;
564  for (int i = 0; i < RubyAccessMode_NUM; i++) {
566  .subname(i, RubyAccessMode_to_string(RubyAccessMode(i)))
568  ;
569  }
570 
572  .name(name() + ".num_data_array_reads")
573  .desc("number of data array reads")
575  ;
576 
578  .name(name() + ".num_data_array_writes")
579  .desc("number of data array writes")
581  ;
582 
584  .name(name() + ".num_tag_array_reads")
585  .desc("number of tag array reads")
587  ;
588 
590  .name(name() + ".num_tag_array_writes")
591  .desc("number of tag array writes")
593  ;
594 
596  .name(name() + ".num_tag_array_stalls")
597  .desc("number of stalls caused by tag array")
599  ;
600 
602  .name(name() + ".num_data_array_stalls")
603  .desc("number of stalls caused by data array")
605  ;
606 }
607 
608 // assumption: SLICC generated files will only call this function
609 // once **all** resources are granted
610 void
611 CacheMemory::recordRequestType(CacheRequestType requestType, Addr addr)
612 {
613  DPRINTF(RubyStats, "Recorded statistic: %s\n",
614  CacheRequestType_to_string(requestType));
615  switch(requestType) {
616  case CacheRequestType_DataArrayRead:
617  if (m_resource_stalls)
620  return;
621  case CacheRequestType_DataArrayWrite:
622  if (m_resource_stalls)
625  return;
626  case CacheRequestType_TagArrayRead:
627  if (m_resource_stalls)
630  return;
631  case CacheRequestType_TagArrayWrite:
632  if (m_resource_stalls)
635  return;
636  default:
637  warn("CacheMemory access_type not found: %s",
638  CacheRequestType_to_string(requestType));
639  }
640 }
641 
642 bool
644 {
645  if (!m_resource_stalls) {
646  return true;
647  }
648 
649  if (res == CacheResourceType_TagArray) {
650  if (tagArray.tryAccess(addressToCacheSet(addr))) return true;
651  else {
652  DPRINTF(RubyResourceStalls,
653  "Tag array stall on addr %#x in set %d\n",
654  addr, addressToCacheSet(addr));
656  return false;
657  }
658  } else if (res == CacheResourceType_DataArray) {
659  if (dataArray.tryAccess(addressToCacheSet(addr))) return true;
660  else {
661  DPRINTF(RubyResourceStalls,
662  "Data array stall on addr %#x in set %d\n",
663  addr, addressToCacheSet(addr));
665  return false;
666  }
667  } else {
668  panic("Unrecognized cache resource type.");
669  }
670 }
671 
672 bool
673 CacheMemory::isBlockInvalid(int64_t cache_set, int64_t loc)
674 {
675  return (m_cache[cache_set][loc]->m_Permission == AccessPermission_Invalid);
676 }
677 
678 bool
679 CacheMemory::isBlockNotBusy(int64_t cache_set, int64_t loc)
680 {
681  return (m_cache[cache_set][loc]->m_Permission != AccessPermission_Busy);
682 }
Stats::Scalar m_demand_misses
Definition: CacheMemory.hh:136
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:163
#define DPRINTF(x,...)
Definition: trace.hh:225
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:51
Addr cacheProbe(Addr address) const
Definition: CacheMemory.cc:322
BankedArray tagArray
Definition: CacheMemory.hh:187
Stats::Vector m_accessModeType
Definition: CacheMemory.hh:143
void recordCacheContents(int cntrl, CacheRecorder *tr) const
Definition: CacheMemory.cc:420
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:376
Addr bitSelect(Addr addr, unsigned int small, unsigned int big)
Definition: Address.cc:35
BankedArray dataArray
Definition: CacheMemory.hh:186
void recordRequestType(CacheRequestType requestType, Addr addr)
Definition: CacheMemory.cc:611
Bitfield< 7 > i
Stats::Formula m_demand_accesses
Definition: CacheMemory.hh:137
int m_cache_num_set_bits
Definition: CacheMemory.hh:191
bool tryAccess(int64_t idx)
Definition: BankedArray.cc:53
void print(std::ostream &out) const
Definition: CacheMemory.cc:459
virtual DataBlock & getDataBlk()
bool m_resource_stalls
Definition: CacheMemory.hh:194
bool isBlockNotBusy(int64_t cache_set, int64_t loc)
Definition: CacheMemory.cc:679
virtual void touch(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Update replacement data.
bool testCacheAccess(Addr address, RubyRequestType type, DataBlock *&data_ptr)
Definition: CacheMemory.cc:201
int findTagInSetIgnorePermissions(int64_t cacheSet, Addr tag) const
Definition: CacheMemory.cc:138
ip6_addr_t addr
Definition: inet.hh:330
RubyCacheParams Params
Definition: CacheMemory.hh:54
Stats::Scalar m_hw_prefetches
Definition: CacheMemory.hh:140
void addRecord(int cntrl, Addr data_addr, Addr pc_addr, RubyRequestType type, Tick time, DataBlock &data)
void clearLocked(Addr addr)
Definition: CacheMemory.cc:495
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:587
AbstractCacheEntry * allocate(Addr address, AbstractCacheEntry *new_entry)
Definition: CacheMemory.cc:267
bool isLocked(Addr addr, int context)
Definition: CacheMemory.cc:506
void regStats()
Callback to set stat parameters.
Definition: CacheMemory.cc:518
bool m_use_occupancy
Set to true when using WeightedLRU replacement policy, otherwise, set to false.
Definition: CacheMemory.hh:211
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:333
Stats::Scalar numTagArrayStalls
Definition: CacheMemory.hh:150
void printData(std::ostream &out) const
Definition: CacheMemory.cc:478
STL vector class.
Definition: stl.hh:37
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1149
std::enable_if< std::is_integral< T >::value, int >::type floorLog2(T x)
Definition: intmath.hh:57
Bitfield< 3, 1 > perm
Definition: pagetable.hh:68
void deallocate(Addr address)
Definition: CacheMemory.cc:305
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: CacheMemory.cc:77
bool cacheAvail(Addr address) const
Definition: CacheMemory.cc:245
BaseReplacementPolicy * m_replacementPolicy_ptr
We use BaseReplacementPolicy from Classic system here, hence we can use different replacement policie...
Definition: CacheMemory.hh:184
uint8_t type
Definition: inet.hh:328
std::unordered_map< Addr, int > m_tag_index
Definition: CacheMemory.hh:177
Tick curTick()
The current simulated tick.
Definition: core.hh:44
void setMRU(Addr address)
Definition: CacheMemory.cc:364
std::vector< std::vector< ReplData > > replacement_data
We store all the ReplacementData in a 2-dimensional array.
Definition: CacheMemory.hh:205
uint64_t Tick
Tick count type.
Definition: types.hh:61
CacheMemory(const Params *p)
Definition: CacheMemory.cc:58
bool isBlockInvalid(int64_t cache_set, int64_t loc)
Definition: CacheMemory.cc:673
bool tryCacheAccess(Addr address, RubyRequestType type, DataBlock *&data_ptr)
Definition: CacheMemory.cc:173
Stats::Scalar m_demand_hits
Definition: CacheMemory.hh:135
int findTagInSet(int64_t line, Addr tag) const
Definition: CacheMemory.cc:123
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
Addr makeLineAddress(Addr addr)
Definition: Address.cc:54
#define warn_once(...)
Definition: logging.hh:212
Stats::Scalar numDataArrayWrites
Definition: CacheMemory.hh:146
Addr getAddressAtIdx(int idx) const
Definition: CacheMemory.cc:153
const FlagsType total
Print the total.
Definition: info.hh:49
bool m_is_instruction_only_cache
Definition: CacheMemory.hh:173
Bitfield< 24 > j
virtual void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Invalidate replacement data to set it as the next probable victim.
virtual void reset(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Reset replacement data.
Bitfield< 9 > e
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:276
AccessPermission m_Permission
virtual const std::string name() const
Definition: sim_object.hh:129
bool isTagPresent(Addr address) const
Definition: CacheMemory.cc:226
int m_start_index_bit
Definition: CacheMemory.hh:193
uint32_t getWay() const
Get way number.
void reserve(int64_t idx)
Definition: BankedArray.cc:69
Stats::Scalar m_sw_prefetches
Definition: CacheMemory.hh:139
int getReplacementWeight(int64_t set, int64_t loc)
Definition: CacheMemory.cc:406
void setLocked(Addr addr, int context)
Definition: CacheMemory.cc:484
ostream & operator<<(ostream &out, const CacheMemory &obj)
Definition: CacheMemory.cc:45
Stats::Scalar numTagArrayWrites
Definition: CacheMemory.hh:148
Stats::Scalar numDataArrayStalls
Definition: CacheMemory.hh:151
Stats::Scalar numDataArrayReads
Definition: CacheMemory.hh:145
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:309
uint32_t getSet() const
Get set number.
#define warn(...)
Definition: logging.hh:208
virtual void regStats()
Callback to set stat parameters.
Definition: group.cc:64
Stats::Scalar numTagArrayReads
Definition: CacheMemory.hh:147
Stats::Formula m_prefetches
Definition: CacheMemory.hh:141
const FlagsType nozero
Don&#39;t print if this is zero.
Definition: info.hh:57
Bitfield< 0 > p
bool checkResourceAvailable(CacheResourceType res, Addr addr)
Definition: CacheMemory.cc:643
AbstractCacheEntry * lookup(Addr address)
Definition: CacheMemory.cc:342
static uint32_t getBlockSizeBytes()
Definition: RubySystem.hh:59
Abstract superclass for simulation objects.
Definition: sim_object.hh:93
int64_t addressToCacheSet(Addr address) const
Definition: CacheMemory.cc:113
std::vector< std::vector< AbstractCacheEntry * > > m_cache
Definition: CacheMemory.hh:178
int m_cache_num_sets
Definition: CacheMemory.hh:190

Generated on Fri Jul 3 2020 15:53:04 for gem5 by doxygen 1.8.13