OpenASIP
2.0
|
#include <IdealSRAM.hh>
Public Member Functions | |
IdealSRAM (ULongWord start, ULongWord end, Word MAUSize, bool littleEndian) | |
virtual | ~IdealSRAM () |
virtual void | write (ULongWord address, MAU data) override |
virtual Memory::MAU | read (ULongWord address) override |
virtual void | fillWithZeros () |
virtual void | write (ULongWord address, MAU data)=0 |
void | write (ULongWord address, int size, ULongWord data) |
void | write (ULongWord address, FloatWord data) |
void | write (ULongWord address, DoubleWord data) |
virtual Memory::MAU | read (ULongWord address)=0 |
void | read (ULongWord address, int size, ULongWord &data) |
void | read (ULongWord address, DoubleWord &data) |
void | read (ULongWord address, FloatWord &data) |
Public Member Functions inherited from Memory | |
Memory (ULongWord start, ULongWord end, ULongWord MAUSize, bool littleEndian_) | |
virtual | ~Memory () |
virtual void | advanceClock () |
virtual void | writeBE (ULongWord address, int size, ULongWord data) |
virtual void | writeLE (ULongWord address, int size, ULongWord data) |
void | write (ULongWord address, int size, ULongWord data) |
virtual void | writeDirectlyBE (ULongWord address, int size, ULongWord data) |
virtual void | writeDirectlyLE (ULongWord address, int size, ULongWord data) |
void | write (ULongWord address, FloatWord data) |
void | write (ULongWord address, DoubleWord data) |
void | read (ULongWord address, int size, ULongWord &data) |
void | read (ULongWord address, DoubleWord &data) |
void | read (ULongWord address, FloatWord &data) |
virtual void | writeBE (ULongWord address, FloatWord data) |
virtual void | writeBE (ULongWord address, DoubleWord data) |
virtual void | writeLE (ULongWord address, FloatWord data) |
virtual void | writeLE (ULongWord address, DoubleWord data) |
virtual void | readBE (ULongWord address, int size, ULongWord &data) |
virtual void | readLE (ULongWord address, int size, ULongWord &data) |
virtual void | readBE (ULongWord address, FloatWord &data) |
virtual void | readBE (ULongWord address, DoubleWord &data) |
virtual void | readLE (ULongWord address, FloatWord &data) |
virtual void | readLE (ULongWord address, DoubleWord &data) |
virtual void | reset () |
virtual ULongWord | start () |
virtual ULongWord | end () |
virtual ULongWord | MAUSize () |
bool | isLittleEndian () |
Private Member Functions | |
IdealSRAM (const IdealSRAM &) | |
Copying not allowed. More... | |
IdealSRAM & | operator= (const IdealSRAM &) |
Assignment not allowed. More... | |
Private Attributes | |
UIntWord | start_ |
Starting point of the address space. More... | |
UIntWord | end_ |
End point of the address space. More... | |
Word | MAUSize_ |
Size of the minimum adressable unit. More... | |
MemoryContents * | data_ |
Container for holding read/write requests. More... | |
Additional Inherited Members | |
Public Types inherited from Memory | |
typedef MinimumAddressableUnit | MAU |
typedef MAU * | MAUTable |
Protected Member Functions inherited from Memory | |
void | packBE (const Memory::MAUTable data, int size, ULongWord &value) |
void | unpackBE (const ULongWord &value, int size, Memory::MAUTable data) |
void | packLE (const Memory::MAUTable data, int size, ULongWord &value) |
void | unpackLE (const ULongWord &value, int size, Memory::MAUTable data) |
Protected Attributes inherited from Memory | |
bool | littleEndian_ |
Class that models an "ideal" memory.
An ideal memory is defined as a memory with read latency zero. The data is available at the same cycle in which the load is initiated. Also, after a store is initiated, data is written into memory as soon as the clock advances.
This implementation uses a "paged array" as the storage structure which avoids unnecessary allocation while providing O(1) access time. See PagedArray for more details.
Definition at line 55 of file IdealSRAM.hh.
Constructor. Create a model for a given memory.
The created memory model is empty. No data is allocated for its contents.
start | First address of the memory. |
end | Last address of the memory. |
MAUSize | Bit width of the minimum addressable unit of the memory. |
wordSize | Number of MAUs that make up a natural word. |
align | Alignment of natural words, expressed in number of MAUs. |
Definition at line 56 of file IdealSRAM.cc.
|
virtual |
Destructor.
The storage reserved for the memory contents is deallocated. Any data about pending access requests is freed, too.
Definition at line 69 of file IdealSRAM.cc.
References data_.
|
private |
Copying not allowed.
|
virtual |
Fills the whole memory with zeros.
This is needed due to some buggy simulated programs which expect uninitialized data to be zero.
Reimplemented from Memory.
Definition at line 107 of file IdealSRAM.cc.
References PagedArray< ValueType, PageSize, DefaultValue >::clear(), and data_.
|
overridevirtual |
Reads a single memory location.
The fastest way to read the memory.
address | The address to read. |
Implements Memory.
Definition at line 96 of file IdealSRAM.cc.
References data_, PagedArray< ValueType, PageSize, DefaultValue >::readData(), and start_.
Memory::MAU Memory::read |
void Memory::read |
A convenience method for reading data from the memory and interpreting it as a DoubleWord in order set by endian bit of memory.
address | The address to read. |
data | The data to write. |
OutOfRange | in case the address is out of range of the memory. |
Definition at line 513 of file Memory.cc.
void Memory::read |
A convenience method for reading data from the memory and interpreting it as a FloatWord in order set by the memory.
address | The address to read. |
data | The data to write. |
OutOfRange | in case the address is out of range of the memory. |
Definition at line 329 of file Memory.cc.
void Memory::read |
A convenience method for reading units of data from the memory.
The data is written to an UIntWord.
address | The address to read. |
count | Number of MAUs to read. |
data | The data to write. |
OutOfRange | in case the address is out of range of the memory. |
Definition at line 663 of file Memory.cc.
void Memory::write |
A convenience method for writing a DoubleWord to the memory.
address | The address to write. |
data | The data to write. |
OutOfRange | in case the address is out of range of the memory. |
Definition at line 531 of file Memory.cc.
void Memory::write |
void Memory::write |
A convenience method for writing units of data to the memory.
The data is stored in an UIntWord.
address | The address to write. |
count | Number of MAUs to write. |
data | The data to write. |
OutOfRange | in case the address is out of range of the memory. |
Definition at line 175 of file Memory.cc.
Writes a single memory location.
The fastest way to write to the memory.
address | The target address. |
data | The data to write. |
Implements Memory.
Definition at line 83 of file IdealSRAM.cc.
References data_, start_, and PagedArray< ValueType, PageSize, DefaultValue >::writeData().
void Memory::write |
Writes a single memory location.
Must be implemented in the derived class. No range checking. The fastest way to write to the memory.
address | The target address. |
data | The data to write. |
|
private |
Container for holding read/write requests.
Definition at line 81 of file IdealSRAM.hh.
Referenced by fillWithZeros(), IdealSRAM(), read(), write(), and ~IdealSRAM().
|
private |
End point of the address space.
Definition at line 77 of file IdealSRAM.hh.
Referenced by IdealSRAM().
|
private |
Size of the minimum adressable unit.
Definition at line 79 of file IdealSRAM.hh.
|
private |
Starting point of the address space.
Definition at line 75 of file IdealSRAM.hh.
Referenced by IdealSRAM(), read(), and write().