22 #ifndef OTAWA_HARD_CACHE_H
23 #define OTAWA_HARD_CACHE_H
25 #include <elm/assert.h>
27 #include <elm/serial2/macros.h>
28 #include <elm/genstruct/Vector.h>
31 namespace otawa {
namespace hard {
153 #endif // OTAWA_HARD_CACHE_H
Address round(Address addr) const
Round the given address to the address of the container cache block.
Definition: Cache.h:124
void setReadPortSize(int read_port_size)
Set the read port size (at least 1).
Definition: hardware_Cache.cpp:333
ot::size blockSize(void) const
Get the block size.
Definition: Cache.h:95
int read_port_size
Definition: Cache.h:60
virtual ~Cache(void)
Definition: hardware_Cache.cpp:41
t::uint32 mask
Definition: base.h:45
ot::mask tagMask(void) const
Mask for selecting the tag in a memory address.
Definition: Cache.h:117
enum otawa::hard::Cache::write_policy_t write_policity_t
write_policy_t write
Definition: Cache.h:57
int miss_penalty
Definition: Cache.h:52
t::uint32 offset_t
Definition: Cache.h:67
info_t _info
Definition: Cache.h:83
int tagBits(void) const
Required bits count in the tag part of the address.
Definition: Cache.h:112
const Cache * _next
Definition: Cache.h:84
void setMissPenalty(int miss_penalty)
Set the miss penaly time.
Definition: hardware_Cache.cpp:250
write_policy_t
Definition: Cache.h:45
void setReplacePolicy(replace_policy_t replace)
Set the replace policy of the cache.
Definition: hardware_Cache.cpp:293
int way_bits
Definition: Cache.h:55
int write_buffer_size
Definition: Cache.h:59
t::uint32 tag_t
Definition: Cache.h:66
ENUM(otawa::hard::Cache::replace_policy_t)
void setWriteBufferSize(int write_buffer_size)
Set the write buffer size (0 for no write buffer).
Definition: hardware_Cache.cpp:323
void setBlockBits(int block_bits)
Definition: hardware_Cache.cpp:261
void setWritePolicy(write_policy_t write)
Set the write policy of the cache.
Definition: hardware_Cache.cpp:303
bool isNull(void) const
Test if the address is null.
Definition: base.h:72
replace_policy_t
Definition: Cache.h:36
int missPenalty(void) const
Return the time penaly of a missed access to memory.
Definition: Cache.h:104
t::uint32 set_t
Definition: Cache.h:65
t::uint32 size
Definition: base.h:46
int wayBits(void) const
Get the number of bits to count the ways in set associative cache.
Definition: Cache.h:113
int setBits(void) const
Definition: Cache.h:111
Field< T > field(CString name, T &value)
ot::size cacheSize(void) const
Get the cache size.
Definition: Cache.h:94
ot::mask blockMask(void) const
Mask for selecting the address of a byte in a block in a memory address.
Definition: Cache.h:115
This class contains the configuration of a level of cache of processor.
Definition: Cache.h:34
offset_t offset(void) const
Get the offset value.
Definition: base.h:70
Cache(void)
Definition: hardware_Cache.cpp:28
The representation of an address in OTAWA.
Definition: base.h:54
void setAccessTime(int access_time)
Set the access time.
Definition: hardware_Cache.cpp:240
bool doesWriteAllocate(void) const
Set the behaviour about write allocation.
Definition: Cache.h:103
int readPortSize(void) const
Get the read port size of this cache (default to 1, must be non-null).
Definition: Cache.h:106
void setRowBits(int set_bits)
Set the row count as a number of bits.
Definition: hardware_Cache.cpp:272
ot::mask line(const Address &addr) const
Compute the line number from the memory address.
Definition: Cache.h:144
void setAllocate(bool allocate)
Set the allocation state.
Definition: hardware_Cache.cpp:314
StringOption cache(command, 'c',"cache","used cache","path","")
write_policy_t writePolicy(void) const
Get the write policy.
Definition: Cache.h:102
int blockCount(void) const
Definition: Cache.h:99
tag_t tag(Address addr) const
Compute the tag from the memory address.
Definition: Cache.h:122
struct otawa::hard::Cache::info_t info_t
int writePortSize(void) const
Get the write port size of this cache (default to 1 for data cache).
Definition: Cache.h:107
int rowCount(void) const
Get the count of rows.
Definition: Cache.h:145
void setWayBits(int way_bits)
Set the way count as a number of bits.
Definition: hardware_Cache.cpp:283
ot::mask lineMask(void) const
Mask for selecting the line number in a memory address.
Definition: Cache.h:142
bool allocate
Definition: Cache.h:58
int access_time
Definition: Cache.h:51
replace_policy_t replace
Definition: Cache.h:56
t::uint32 block_t
Definition: Cache.h:64
int block_bits
Definition: Cache.h:53
int rowBits(void) const
Required bits count for a row index.
Definition: Cache.h:141
int row_bits
Definition: Cache.h:54
int writeBufferSize(void) const
Get the write buffer size of this cache (0 for no write buffer).
Definition: Cache.h:105
replace_policy_t replacementPolicy(void) const
Get the replacement policy.
Definition: Cache.h:101
int blockBits(void) const
Required bits count for a byte address in the block.
Definition: Cache.h:110
const Cache * nextLevel(void) const
Get the next level of cache.
Definition: Cache.h:93
int setCount(void) const
Definition: Cache.h:98
SERIALIZABLE(Cache, field("access_time", _info.access_time, 1)&field("miss_penalty", _info.miss_penalty, 10)&field("block_bits", _info.block_bits, 4)&field("row_bits", _info.row_bits, 12)&field("way_bits", _info.way_bits, 0)&field("allocate", _info.allocate, false)&field("next", _next,(const Cache *) 0)&field("replace", _info.replace, LRU)&field("write_buffer_size", _info.write_buffer_size, 0)&field("read_port_size", _info.read_port_size, 1)&field("write_port_size", _info.write_port_size, 1)&field("write", _info.write, WRITE_THROUGH))
block_t block(Address addr) const
Return the bits used for identifying uniquely a block, that is, tag and line number.
Definition: Cache.h:123
ot::mask setMask(void) const
Definition: Cache.h:116
set_t set(Address addr) const
Definition: Cache.h:121
offset_t offset(Address addr) const
Compute the offset of the accessed byte in the block from the memory address.
Definition: Cache.h:120
ot::mask rowMask(void) const
Definition: Cache.h:143
int write_port_size
Definition: Cache.h:61
int wayCount(void) const
Get the count of ways for associatives caches.
Definition: Cache.h:97
page_t page(void) const
Get the page number.
Definition: base.h:69
void setWritePortSize(int write_port_size)
Set the write port size (at least 1).
Definition: hardware_Cache.cpp:343