Otawa
0.10
|
This is an abstract implementation of the cache driver allowing to customize only the cache replacement policy. More...
#include <otawa/sim/AbstractCacheDriver.h>
Public Types | |
typedef unsigned long | tag_t |
enum | result_t { MISS = 0, HIT = 1 } |
This enumeration allows to know the result of a cache access. More... | |
enum | action_t { READ, WRITE } |
This enumeration identifies the kind of cache access. More... | |
Public Member Functions | |
AbstractCacheDriver (const hard::Cache *cache) | |
Build a cache driver with the given cache. More... | |
virtual | ~AbstractCacheDriver (void) |
virtual result_t | access (address_t address, size_t size, action_t action) |
This function is called each time the cache is accessed. More... | |
const hard::Cache * | cache (void) const |
Static Public Member Functions | |
static CacheDriver * | lookup (const hard::Cache *cache) |
This method retrieve the cache driver matching the given cache description. More... | |
Static Public Attributes | |
static CacheDriver & | ALWAYS_HIT = HIT_DRIVER |
This cache driver specialization generates a hit each time it is accessed. More... | |
static CacheDriver & | ALWAYS_MISS = MISS_DRIVER |
This cache driver specialization generates a miss each time it is accessed. More... | |
Protected Member Functions | |
virtual void | touch (int index, int num, tag_t *line)=0 |
This function is called each time a cache block in a set is accessed (read / write). More... | |
virtual void | replace (tag_t tag, int num, tag_t *line)=0 |
This function is called each time a replacement in a set is required. More... | |
Private Attributes | |
const hard::Cache * | _cache |
tag_t * | lines |
This is an abstract implementation of the cache driver allowing to customize only the cache replacement policy.
Implementations of this class includes:
typedef unsigned long otawa::sim::AbstractCacheDriver::tag_t |
|
inherited |
|
inherited |
otawa::sim::AbstractCacheDriver::AbstractCacheDriver | ( | const hard::Cache * | cache | ) |
|
virtual |
References lines.
|
virtual |
This function is called each time the cache is accessed.
It must be overload to specialize the cache behavior.
address | Address of the accessed data. |
size | Size of the accessed data. |
action | Action performed. |
Implements otawa::sim::CacheDriver.
References _cache, otawa::sim::CacheDriver::HIT, otawa::hard::Cache::line(), lines, otawa::sim::CacheDriver::MISS, replace(), otawa::hard::Cache::tag(), touch(), and otawa::hard::Cache::wayCount().
|
inline |
References _cache.
Referenced by otawa::sim::LRUCacheDriver::replace(), and otawa::sim::FIFOCacheDriver::replace().
|
static |
This method retrieve the cache driver matching the given cache description.
cache | Cache to look a driver for. |
References otawa::hard::Cache::FIFO, otawa::hard::Cache::LRU, otawa::hard::Cache::replacementPolicy(), and otawa::hard::Cache::wayCount().
|
protectedpure virtual |
This function is called each time a replacement in a set is required.
This method implementer must wipe out one of the block and replaced it by the given tag.
tag | New tag to store in the set. |
num | Number of the affected set/line. |
line | Array base containing tags of the line. |
Implemented in otawa::sim::FIFOCacheDriver, otawa::sim::DirectMappedCacheDriver, and otawa::sim::LRUCacheDriver.
Referenced by access().
|
protectedpure virtual |
This function is called each time a cache block in a set is accessed (read / write).
The implementer may use this call to update its tag order in the set.
index | Index of the accessed tag in the tag array. |
num | Number of the set/line accessed. |
line | Base of the array containing tags of the current set/line. |
Implemented in otawa::sim::FIFOCacheDriver, otawa::sim::DirectMappedCacheDriver, and otawa::sim::LRUCacheDriver.
Referenced by access().
|
private |
|
staticinherited |
This cache driver specialization generates a hit each time it is accessed.
|
staticinherited |
This cache driver specialization generates a miss each time it is accessed.
|
private |
Referenced by AbstractCacheDriver(), access(), and ~AbstractCacheDriver().