Otawa
0.10
|
This class provide a cache driver implementing the LRU 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 | |
LRUCacheDriver (const hard::Cache *cache) | |
Build a LRU cache driver. More... | |
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) |
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) |
This function is called each time a replacement in a set is required. More... | |
This class provide a cache driver implementing the LRU replacement policy.
|
inherited |
|
inherited |
|
inherited |
otawa::sim::LRUCacheDriver::LRUCacheDriver | ( | const hard::Cache * | cache | ) |
Build a LRU cache driver.
cache | Used cache. |
|
virtualinherited |
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 otawa::sim::AbstractCacheDriver::_cache, otawa::sim::CacheDriver::HIT, otawa::hard::Cache::line(), otawa::sim::AbstractCacheDriver::lines, otawa::sim::CacheDriver::MISS, otawa::sim::AbstractCacheDriver::replace(), otawa::hard::Cache::tag(), otawa::sim::AbstractCacheDriver::touch(), and otawa::hard::Cache::wayCount().
|
inlineinherited |
References otawa::sim::AbstractCacheDriver::_cache.
Referenced by replace(), and otawa::sim::FIFOCacheDriver::replace().
|
staticinherited |
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().
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. |
Implements otawa::sim::AbstractCacheDriver.
References otawa::sim::AbstractCacheDriver::cache().
|
protectedvirtual |
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. |
Implements otawa::sim::AbstractCacheDriver.
|
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.