Otawa  0.10
otawa::sim::FIFOCacheDriver Class Reference

This class provide a cache driver implementing a FIFO policy. More...

#include <otawa/sim/AbstractCacheDriver.h>

Inheritance diagram for otawa::sim::FIFOCacheDriver:
otawa::sim::AbstractCacheDriver otawa::sim::CacheDriver

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

 FIFOCacheDriver (const hard::Cache *cache)
 Build an associative cache driver with FIFO replacement policy. More...
 
 ~FIFOCacheDriver (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::Cachecache (void) const
 

Static Public Member Functions

static CacheDriverlookup (const hard::Cache *cache)
 This method retrieve the cache driver matching the given cache description. More...
 

Static Public Attributes

static CacheDriverALWAYS_HIT = HIT_DRIVER
 This cache driver specialization generates a hit each time it is accessed. More...
 
static CacheDriverALWAYS_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...
 

Private Attributes

int * counters
 

Detailed Description

This class provide a cache driver implementing a FIFO policy.

Member Typedef Documentation

typedef unsigned long otawa::sim::AbstractCacheDriver::tag_t
inherited

Member Enumeration Documentation

This enumeration identifies the kind of cache access.

Enumerator
READ 

A read is performed on the cache.

WRITE 

A write is performed on the cache.

This enumeration allows to know the result of a cache access.

Enumerator
MISS 

The result of a cache access produces a miss.

HIT 

The result of a cache access produces a hit.

Constructor & Destructor Documentation

otawa::sim::FIFOCacheDriver::FIFOCacheDriver ( const hard::Cache cache)

Build an associative cache driver with FIFO replacement policy.

Parameters
cacheUsed cache.

References counters, and otawa::hard::Cache::rowCount().

otawa::sim::FIFOCacheDriver::~FIFOCacheDriver ( void  )

References counters.

Member Function Documentation

CacheDriver::result_t otawa::sim::AbstractCacheDriver::access ( address_t  address,
size_t  size,
action_t  action 
)
virtualinherited

This function is called each time the cache is accessed.

It must be overload to specialize the cache behavior.

Parameters
addressAddress of the accessed data.
sizeSize of the accessed data.
actionAction performed.
Returns
HIT or MISS according presence of the block of data in the cache.

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().

const hard::Cache* otawa::sim::AbstractCacheDriver::cache ( void  ) const
inlineinherited
CacheDriver * otawa::sim::AbstractCacheDriver::lookup ( const hard::Cache cache)
staticinherited

This method retrieve the cache driver matching the given cache description.

Parameters
cacheCache to look a driver for.
Returns
Matching cache driver or null.

References otawa::hard::Cache::FIFO, otawa::hard::Cache::LRU, otawa::hard::Cache::replacementPolicy(), and otawa::hard::Cache::wayCount().

void otawa::sim::FIFOCacheDriver::replace ( tag_t  tag,
int  num,
tag_t line 
)
protectedvirtual

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.

Parameters
tagNew tag to store in the set.
numNumber of the affected set/line.
lineArray base containing tags of the line.

Implements otawa::sim::AbstractCacheDriver.

References otawa::sim::AbstractCacheDriver::cache(), counters, and otawa::hard::Cache::wayCount().

void otawa::sim::FIFOCacheDriver::touch ( int  index,
int  num,
tag_t line 
)
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.

Parameters
indexIndex of the accessed tag in the tag array.
numNumber of the set/line accessed.
lineBase of the array containing tags of the current set/line.

Implements otawa::sim::AbstractCacheDriver.

Member Data Documentation

CacheDriver & otawa::sim::CacheDriver::ALWAYS_HIT = HIT_DRIVER
staticinherited

This cache driver specialization generates a hit each time it is accessed.

CacheDriver & otawa::sim::CacheDriver::ALWAYS_MISS = MISS_DRIVER
staticinherited

This cache driver specialization generates a miss each time it is accessed.

int* otawa::sim::FIFOCacheDriver::counters
private

The documentation for this class was generated from the following files: