22 #ifndef OTAWA_HARD_MEMORY_H
23 #define OTAWA_HARD_MEMORY_H
25 #include <elm/assert.h>
26 #include <elm/genstruct/Table.h>
27 #include <elm/string.h>
29 #include <elm/serial2/macros.h>
30 #include <elm/serial2/collections.h>
31 #include <elm/system/Path.h>
32 #include <elm/genstruct/HashTable.h>
36 namespace elm {
namespace xom {
class Element; } }
38 namespace otawa {
namespace hard {
41 using namespace elm::genstruct;
47 field(
"latency", _latency) &
field(
"power", _power) &
field(
"dest", _dest));
50 inline int latency(
void)
const {
return _latency; }
51 inline int power(
void)
const {
return _power; }
52 inline const Mode *
dest(
void)
const {
return _dest; }
65 &
field(
"latency", _latency)
66 &
field(
"static_power", _static_power)
67 &
field(
"dynamic_power", _dynamic_power)
68 &
field(
"transitions", _transitions));
70 inline Mode(
void): _name(
"no name"), _latency(1), _static_power(0), _dynamic_power(0) { }
71 inline const string&
name(
void)
const {
return _name; }
72 inline int latency(
void)
const {
return _latency; }
97 field(
"name", _name) &
98 field(
"address", _address) &
99 field(
"size", _size) &
100 field(
"type", _type) &
101 field(
"latency", _latency) &
102 field(
"power", _power) &
103 field(
"block_bits", _block_bits) &
104 field(
"modes", _modes) &
105 field(
"cached", _cached) &
106 field(
"on_chip", _on_chip) &
107 field(
"writable", _writable) &
108 field(
"port_num", _port_num) &
110 field(
"write_latency", _write_latency));
116 inline const string&
name(
void)
const {
return _name; }
118 inline const int size(
void)
const {
return _size; }
120 inline int latency(
void)
const {
return _latency; }
121 inline int writeLatency(
void)
const {
if(!_write_latency)
return _latency;
else return _write_latency; }
122 inline int power(
void)
const {
return _power; }
123 inline int blockBits(
void)
const {
return _block_bits; }
124 inline int blockSize(
void)
const {
return 1 << _block_bits; }
126 inline bool isCached(
void)
const {
return _cached; }
127 inline bool isOnChip(
void)
const {
return _on_chip; }
129 inline int portNum(
void)
const {
return _port_num; }
130 inline const Bus *
bus(
void)
const {
return _bus; }
134 {
return addr.
page() ==
address().page() && addr >=
address() && addr <= (topAddress() - 1); }
160 SERIALIZABLE(
Bus,
field(
"name", _name) &
field(
"type", _type));
162 inline Bus(
void): _name(
"no name"), _type(LOCAL) { }
163 inline const string&
name(
void)
const {
return _name; }
178 Memory(
bool full =
false);
185 int worstAccess(
void)
const;
186 int worstReadAccess(
void)
const;
187 int worstWriteAccess(
void)
const;
206 namespace elm {
namespace serial2 {
211 #endif // OTAWA_HARD_MEMORY_H_
The usual Feature class has as drawback to exhibit completely the processing of the feature and there...
Definition: SilentFeature.h:32
Mode(void)
Constructor with default initialization:
Definition: Memory.h:70
AllocatedTable< const Bank * > _banks
Definition: Memory.h:190
int _static_power
Definition: Memory.h:80
int dynamicPower(void) const
Get the dynamic power consumed by this memory.
Definition: Memory.h:74
Identifier< const Memory * > MEMORY
Current memory.
const Bus * _bus
Definition: Memory.h:148
type_t
Type of used bus.
Definition: Memory.h:155
int latency(void) const
Get the latency of the transition.
Definition: Memory.h:50
int blockSize(void) const
Get the block size of this bank.
Definition: Memory.h:124
ModeTransition(void)
Build a default transition mode with :
Definition: Memory.h:49
type_t _type
Definition: Memory.h:168
Address topAddress(void) const
Get the top successor address of the bank, that is, bank address + bank size.
Definition: Memory.h:132
Definition: ClpValue.h:54
static const Memory null
Default null memory.
Definition: Memory.h:177
type_t type(void) const
Get the type of the bank.
Definition: Memory.h:119
int _power
Definition: Memory.h:56
int portNum(void) const
Get the number of port on the bank bus.
Definition: Memory.h:129
int writeLatency(void) const
Definition: Memory.h:121
const Bus * bus(void) const
Get the bus of the bank.
Definition: Memory.h:130
static Bank full
The full covering all page one memory.
Definition: Memory.h:112
int power(void) const
Get the default power for accessing this bank.
Definition: Memory.h:122
int _size
Definition: Memory.h:139
Address _address
Definition: Memory.h:138
Class to represent the whole memory of the platform.
Definition: Memory.h:173
elm::io::IntFormat address(Address addr)
Build a format to display addresses.
Definition: base.cpp:213
const Table< ModeTransition > & transitions(void) const
Get the mode transition table (may be empty).
Definition: Memory.h:75
int _latency
Definition: Memory.h:79
A bus that tie together several memory banks.
Definition: Memory.h:153
type_t
This type represents the type of banks:
Definition: Memory.h:88
int _block_bits
Definition: Memory.h:142
io::Output & operator<<(io::Output &out, const Platform::Identification &id)
Definition: Platform.h:140
const Mode * dest(void) const
Get the destination mode of the transition.
Definition: Memory.h:52
Field< T > field(CString name, T &value)
AllocatedTable< const Bus * > _buses
Definition: Memory.h:191
bool _cached
Definition: Memory.h:144
const int size(void) const
Get the size of the bank.
Definition: Memory.h:118
inst load(int d, int a, int t)
Definition: inst.h:153
bool isWritable(void) const
Test if the bank is writable.
Definition: Memory.h:128
The representation of an address in OTAWA.
Definition: base.h:54
Bus(void)
Default bus building:
Definition: Memory.h:162
AllocatedTable< ModeTransition > _transitions
Definition: Memory.h:81
Representation of a memory bank transition.
Definition: Memory.h:45
const Mode * _dest
Definition: Memory.h:57
int blockBits(void) const
Get the number of bits in the block size of the bank.
Definition: Memory.h:123
int staticPower(void) const
Get the static power consumed by this memory.
Definition: Memory.h:73
const string & name(void) const
Get the name of the bank.
Definition: Memory.h:116
ENUM(otawa::hard::Bus::type_t)
int power(void) const
Get the power consumed by the transition.
Definition: Memory.h:51
bool isCached(void) const
Test if the bank is cached.
Definition: Memory.h:126
bool contains(Address addr) const
Test if the address is contained in the bank.
Definition: Memory.h:133
SilentFeature MEMORY_FEATURE
This feature ensures we have obtained the memory configuration of the system.
A working mode for the hardware memory.
Definition: Memory.h:62
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
const Table< const Mode * > & modes(void) const
Get the mode transition table of the bank.
Definition: Memory.h:125
int _write_latency
Definition: Memory.h:141
int _latency
Definition: Memory.h:55
AllocatedTable< const Mode * > _modes
Definition: Memory.h:143
cstring name
Definition: odisasm.cpp:107
Exception thrown when a loader encounters an error during load.
Definition: Manager.h:52
A bank in the memory.
Definition: Memory.h:86
int latency(void) const
Get the default latency for accessing this bank.
Definition: Memory.h:120
bool _writable
Definition: Memory.h:146
const Table< const Bank * > & banks(void) const
Get the list of banks in memory.
Definition: Memory.h:180
bool isOnChip(void) const
Test if the bank is on the same chip than the processor.
Definition: Memory.h:127
const Table< const Bus * > & buses(void) const
Get the list of buses connected to memory banks.
Definition: Memory.h:181
int latency(void) const
Get the latency to access the memory in this mode.
Definition: Memory.h:72
const string & name(void) const
Definition: Memory.h:163
bool _on_chip
Definition: Memory.h:145
string _name
Definition: Memory.h:167
string _name
Definition: Memory.h:137
page_t page(void) const
Get the page number.
Definition: base.h:69
type_t type(void) const
Definition: Memory.h:164
const Address & address(void) const
Get the base address of the bank.
Definition: Memory.h:117
type_t _type
Definition: Memory.h:140
const string & name(void) const
Get the mode name.
Definition: Memory.h:71
type_t
Definition: features.h:57
string _name
Definition: Memory.h:78
int _port_num
Definition: Memory.h:147