OpenASIP
2.0
|
#include <DirectAccessMemory.hh>
Public Member Functions | |
DirectAccessMemory (ULongWord start, ULongWord end, Word MAUSize, bool littleEndian) | |
virtual | ~DirectAccessMemory () |
void | write (ULongWord address, Memory::MAU data) override |
void | fastWriteMAU (ULongWord address, ULongWord data) |
void | fastWrite2MAUsBE (ULongWord address, ULongWord data) |
void | fastWrite4MAUsBE (ULongWord address, ULongWord data) |
void | fastWrite2MAUsLE (ULongWord address, ULongWord data) |
void | fastWrite4MAUsLE (ULongWord address, ULongWord data) |
Memory::MAU | read (ULongWord address) override |
void | fastReadMAU (ULongWord address, ULongWord &data) |
void | fastRead2MAUsBE (ULongWord address, ULongWord &data) |
void | fastRead4MAUsBE (ULongWord address, ULongWord &data) |
void | fastRead2MAUsLE (ULongWord address, ULongWord &data) |
void | fastRead4MAUsLE (ULongWord address, ULongWord &data) |
virtual void | advanceClock () |
virtual void | reset () |
virtual void | fillWithZeros () |
void | writeBE (ULongWord address, int count, ULongWord data) override |
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 | 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 ULongWord | start () |
virtual ULongWord | end () |
virtual ULongWord | MAUSize () |
bool | isLittleEndian () |
Private Member Functions | |
DirectAccessMemory (const DirectAccessMemory &) | |
Copying not allowed. More... | |
DirectAccessMemory & | operator= (const DirectAccessMemory &) |
Assignment not allowed. More... | |
Private Attributes | |
Word | start_ |
Starting point of the address space. More... | |
Word | end_ |
End point of the address space. More... | |
Word | MAUSize_ |
Size of the minimum adressable unit. More... | |
Word | MAUSize3_ |
precalculated MAUSize_ * 3 More... | |
Word | MAUSize2_ |
precalculated MAUSize_ * 2 More... | |
Word | wordSize_ |
Size of the natural word as MAUs. More... | |
Word | mask_ |
Mask bit pattern for unpacking IntWord to MAUs. More... | |
MemoryContents * | data_ |
Contains MAUs of the memory model, that is, the actual data of the memory. 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 to which updates are visible immediately.
This model is used in compiled simulation. It does not require an advance clock call: all writes to it are visible immediately. Thus, one has to make sure that all reads in the same cycle are executed before writes in order for the reads to read the old values.
Note that all range checking is disabled for fastest possible simulation model. In case you are unsure of your simulated input correctness, use the old simulation engine for verification.
Definition at line 55 of file DirectAccessMemory.hh.
DirectAccessMemory::DirectAccessMemory | ( | ULongWord | start, |
ULongWord | end, | ||
Word | MAUSize, | ||
bool | littleEndian | ||
) |
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. |
Definition at line 55 of file DirectAccessMemory.cc.
|
virtual |
|
private |
Copying not allowed.
|
inlinevirtual |
Advances clock for one cycle.
Commits all pending write requests to the memory. Cannot throw an exception, request legality is checked when request is initiated.
Reimplemented from Memory.
Definition at line 108 of file DirectAccessMemory.hh.
Reads 2 MAUs from the memory as fast as possible in BE
address | address to read |
data | reference to the read data |
Definition at line 236 of file DirectAccessMemory.cc.
References data_, MAUSize_, PagedArray< ValueType, PageSize, DefaultValue >::readData(), and start_.
Reads 2 MAUs from the memory as fast as possible in LE
address | address to read |
data | reference to the read data |
Definition at line 251 of file DirectAccessMemory.cc.
References data_, MAUSize_, PagedArray< ValueType, PageSize, DefaultValue >::readData(), and start_.
Reads 4 MAUs from the memory as fast as possible in BE
address | address to read |
data | reference to the read data |
Definition at line 266 of file DirectAccessMemory.cc.
References data_, MAUSize2_, MAUSize3_, MAUSize_, PagedArray< ValueType, PageSize, DefaultValue >::readData(), and start_.
Reads 4 MAUs from the memory as fast as possible in LE
address | address to read |
data | reference to the read data |
Definition at line 283 of file DirectAccessMemory.cc.
References data_, MAUSize2_, MAUSize3_, MAUSize_, PagedArray< ValueType, PageSize, DefaultValue >::readData(), and start_.
Reads 1 MAU from the memory as fast as possible
address | address to read |
data | reference to the read data |
Definition at line 223 of file DirectAccessMemory.cc.
References data_, PagedArray< ValueType, PageSize, DefaultValue >::readData(), and start_.
Referenced by read().
Writes 2 MAUs to the memory as fast as possible
address | address to write |
data | data to be written |
Definition at line 159 of file DirectAccessMemory.cc.
References data_, mask_, MAUSize_, start_, and PagedArray< ValueType, PageSize, DefaultValue >::writeData().
Writes 2 MAUs to the memory as fast as possible in little Endian
address | address to write |
data | data to be written |
Definition at line 174 of file DirectAccessMemory.cc.
References data_, mask_, MAUSize_, start_, and PagedArray< ValueType, PageSize, DefaultValue >::writeData().
Writes 4 MAUs to the memory as fast as possible in BE.
address | address to write |
data | data to be written |
Definition at line 189 of file DirectAccessMemory.cc.
References data_, mask_, MAUSize2_, MAUSize3_, MAUSize_, start_, and PagedArray< ValueType, PageSize, DefaultValue >::writeData().
Writes 4 MAUs to the memory as fast as possible in LE
address | address to write |
data | data to be written |
Definition at line 206 of file DirectAccessMemory.cc.
References data_, mask_, MAUSize2_, MAUSize3_, MAUSize_, start_, and PagedArray< ValueType, PageSize, DefaultValue >::writeData().
Writes 1 MAU to the memory as fast as possible
address | address to write |
data | data to be written |
Definition at line 146 of file DirectAccessMemory.cc.
References data_, mask_, start_, and PagedArray< ValueType, PageSize, DefaultValue >::writeData().
Referenced by write().
|
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 90 of file DirectAccessMemory.cc.
References PagedArray< ValueType, PageSize, DefaultValue >::clear(), and data_.
|
private |
Assignment not allowed.
|
overridevirtual |
Reads a single MAU using the fastest possible method.
address | The address. |
Implements Memory.
Definition at line 131 of file DirectAccessMemory.cc.
References fastReadMAU().
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.
|
inlinevirtual |
Resets the memory.
Clears any pending write requests.
Reimplemented from Memory.
Definition at line 109 of file DirectAccessMemory.hh.
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.
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. |
|
overridevirtual |
Writes a single MAU using the fastest possible method.
address | The address. |
data | The data. |
Implements Memory.
Definition at line 101 of file DirectAccessMemory.cc.
References fastWriteMAU().
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. |
Reimplemented from Memory.
Definition at line 116 of file DirectAccessMemory.cc.
References Memory::advanceClock(), and Memory::writeBE().
|
private |
Contains MAUs of the memory model, that is, the actual data of the memory.
Definition at line 140 of file DirectAccessMemory.hh.
Referenced by DirectAccessMemory(), fastRead2MAUsBE(), fastRead2MAUsLE(), fastRead4MAUsBE(), fastRead4MAUsLE(), fastReadMAU(), fastWrite2MAUsBE(), fastWrite2MAUsLE(), fastWrite4MAUsBE(), fastWrite4MAUsLE(), fastWriteMAU(), fillWithZeros(), and ~DirectAccessMemory().
|
private |
End point of the address space.
Definition at line 127 of file DirectAccessMemory.hh.
Referenced by DirectAccessMemory().
|
private |
Mask bit pattern for unpacking IntWord to MAUs.
Definition at line 137 of file DirectAccessMemory.hh.
Referenced by DirectAccessMemory(), fastWrite2MAUsBE(), fastWrite2MAUsLE(), fastWrite4MAUsBE(), fastWrite4MAUsLE(), and fastWriteMAU().
|
private |
precalculated MAUSize_ * 2
Definition at line 133 of file DirectAccessMemory.hh.
Referenced by fastRead4MAUsBE(), fastRead4MAUsLE(), fastWrite4MAUsBE(), and fastWrite4MAUsLE().
|
private |
precalculated MAUSize_ * 3
Definition at line 131 of file DirectAccessMemory.hh.
Referenced by fastRead4MAUsBE(), fastRead4MAUsLE(), fastWrite4MAUsBE(), and fastWrite4MAUsLE().
|
private |
Size of the minimum adressable unit.
Definition at line 129 of file DirectAccessMemory.hh.
Referenced by DirectAccessMemory(), fastRead2MAUsBE(), fastRead2MAUsLE(), fastRead4MAUsBE(), fastRead4MAUsLE(), fastWrite2MAUsBE(), fastWrite2MAUsLE(), fastWrite4MAUsBE(), and fastWrite4MAUsLE().
|
private |
Starting point of the address space.
Definition at line 125 of file DirectAccessMemory.hh.
Referenced by DirectAccessMemory(), fastRead2MAUsBE(), fastRead2MAUsLE(), fastRead4MAUsBE(), fastRead4MAUsLE(), fastReadMAU(), fastWrite2MAUsBE(), fastWrite2MAUsLE(), fastWrite4MAUsBE(), fastWrite4MAUsLE(), and fastWriteMAU().
|
private |
Size of the natural word as MAUs.
Definition at line 135 of file DirectAccessMemory.hh.