An L1 Cache with coherence protocol and replacement policy.
More...
#include <cache.h>
An L1 Cache with coherence protocol and replacement policy.
◆ Cache()
Construct a new cache.
- Parameters
-
memory_system | The parent memory system |
cache_id | The ID of this cache |
config | The configuration of the parent memory system |
◆ allocate()
Initialize a line in the cache, performing a writeback if necessary.
- Parameters
-
addr | The address that requires caching |
- Returns
- A pointer to the newly initialized cache line
- Note
- The line's state will be 'Invalid'
◆ findLine()
Locate a line in the cache.
- Parameters
-
addr | The address being accessed |
- Returns
- A pointer to the line if found, else nullptr
◆ getLineState()
state_e Cache::getLineState |
( |
uint32_t |
set_idx, |
|
|
uint32_t |
way_idx |
|
) |
| |
|
virtual |
Get the state of a line in the cache.
- Parameters
-
set_idx | The index of the set containing the line |
way_idx | The index of the way containing the line (0 to assoc-1) |
- Returns
- The state of the cache line
Implements CacheABC.
◆ getTimestamp()
size_t Cache::getTimestamp |
( |
addr_t |
addr | ) |
|
Get the access number of the most recent edit to a cache line.
- Parameters
-
- Returns
- The timestamp of the cache line if the address is in the cache, otherwise 0
◆ issueBusMsg()
Issue a BusRd message to neighboring caches.
- Parameters
-
bus_msg | The specific bus message |
- Returns
- True if the 'COPIES-EXIST' line was asserted
Implements CacheABC.
◆ printStats()
void Cache::printStats |
( |
| ) |
|
Print simulation run statistics in CSV format (headerless)
- Note
- Does not produce output if the cache is unused
◆ receiveBusMsg()
Issue a bus message to this cache.
- Parameters
-
bus_msg | The specific bus message |
addr | The address accessed |
◆ receivePrRd()
void Cache::receivePrRd |
( |
addr_t |
addr | ) |
|
Issue a PrRd message to this cache.
- Parameters
-
◆ receivePrWr()
void Cache::receivePrWr |
( |
addr_t |
addr | ) |
|
Issue a PrWr message to this cache.
- Parameters
-
◆ stateChangeStatistic()
Update the correct state transition statistic.
- Parameters
-
before | The state the line was in before |
after | The new state of the line |
◆ curr_access_addr
addr_t Cache::curr_access_addr |
|
private |
The address being accessed by the current processor read or write.
- Note
- Remembering the currently accessed address only works because each memory access is atomic, i.e. all resulting bus messages will finish before the next memory access
The documentation for this class was generated from the following files: