OpenASIP
2.0
|
#include <MemoryProxy.hh>
Public Types | |
typedef std::pair< Word, int > | MemoryAccess |
Public Types inherited from Memory | |
typedef MinimumAddressableUnit | MAU |
typedef MAU * | MAUTable |
Public Member Functions | |
MemoryProxy (SimulatorFrontend &frontend, Memory *memory) | |
virtual | ~MemoryProxy () |
virtual void | advanceClock () |
virtual void | reset () |
virtual void | write (ULongWord address, MAU data) override |
virtual Memory::MAU | read (ULongWord address) override |
virtual void | write (ULongWord address, int size, ULongWord data) |
virtual void | read (ULongWord address, int size, ULongWord &data) |
virtual void | fillWithZeros () |
unsigned int | readAccessCount () const |
unsigned int | writeAccessCount () const |
MemoryAccess | readAccess (unsigned int idx) const |
MemoryAccess | writeAccess (unsigned int idx) const |
Public Member Functions inherited from Memory | |
Memory (ULongWord start, ULongWord end, ULongWord MAUSize, bool littleEndian_) | |
virtual | ~Memory () |
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 ULongWord | start () |
virtual ULongWord | end () |
virtual ULongWord | MAUSize () |
bool | isLittleEndian () |
Private Member Functions | |
MemoryProxy (const MemoryProxy &) | |
Copying not allowed. More... | |
MemoryProxy & | operator= (const MemoryProxy &) |
Assignment not allowed. More... | |
Private Attributes | |
SimulatorFrontend & | frontend_ |
Memory * | memory_ |
Wrapped memory. More... | |
std::vector< MemoryAccess > | reads_ |
List of initiated reads on the last cycle. More... | |
std::vector< MemoryAccess > | writes_ |
List of initiated writes on the last cycle. More... | |
std::vector< MemoryAccess > | newReads_ |
List of initiated reads. More... | |
std::vector< MemoryAccess > | newWrites_ |
List of initiated writes. More... | |
Additional Inherited Members | |
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_ |
MemoryProxy is a memory access tracker for simulator.
MemoryProxy tracks calls to reads and writes. Memory accesses on the last clock cycle can be listed with readAccessCount(), readAccess(idx), writeAccessCount() and writeAccess(idx) functions. Memory access information is stored for only one cycle. Tracks only single memory accesses, not those made with the block methods.
Definition at line 53 of file MemoryProxy.hh.
typedef std::pair<Word, int> MemoryProxy::MemoryAccess |
Definition at line 56 of file MemoryProxy.hh.
MemoryProxy::MemoryProxy | ( | SimulatorFrontend & | frontend, |
Memory * | memory | ||
) |
The Constructor.
MemoryProxy takes ownership of the wrapped Memory instance.
memory | Tracked memory. |
Definition at line 46 of file MemoryProxy.cc.
|
virtual |
The Destructor.
Deletes the tracked memory instance.
Definition at line 58 of file MemoryProxy.cc.
References memory_.
|
private |
Copying not allowed.
|
virtual |
Resets the memory access information for the last cycle when wrapped memory clock is advanced.
Reimplemented from Memory.
Definition at line 98 of file MemoryProxy.cc.
References Memory::advanceClock(), memory_, newReads_, newWrites_, reads_, and writes_.
|
inlinevirtual |
Fills the whole memory with zeros.
This is needed due to some buggy simulated programs which expect uninitialized data to be zero. The default implementation is a slow for-loop which can be overridden with a faster one depending on the storage used.
Reimplemented from Memory.
Definition at line 72 of file MemoryProxy.hh.
References Memory::fillWithZeros(), and memory_.
|
private |
Assignment not allowed.
|
overridevirtual |
Tracks read calls.
Passes the call to the wrapped memory.
Implements Memory.
Definition at line 68 of file MemoryProxy.cc.
References SimulatorFrontend::eventHandler(), frontend_, Informer::handleEvent(), memory_, newReads_, Memory::read(), and SimulationEventHandler::SE_MEMORY_ACCESS.
Definition at line 69 of file MemoryProxy.hh.
References memory_, and Memory::write().
MemoryProxy::MemoryAccess MemoryProxy::readAccess | ( | unsigned int | idx | ) | const |
Returns information of the given memory read access.
idx | Index of the read access. |
OutOfRange | If the index is invalid. |
Definition at line 133 of file MemoryProxy.cc.
References __func__, and reads_.
Referenced by ProximMemoryWindow::onSimulationStop().
unsigned int MemoryProxy::readAccessCount | ( | ) | const |
Returns number of read accesses on the last cycle.
Definition at line 122 of file MemoryProxy.cc.
References reads_.
Referenced by ProximMemoryWindow::onSimulationStop().
|
virtual |
Resets all memory access information when the wrapped memory is reset.
Reimplemented from Memory.
Definition at line 110 of file MemoryProxy.cc.
References memory_, newReads_, newWrites_, reads_, Memory::reset(), and writes_.
Definition at line 67 of file MemoryProxy.hh.
References memory_, and Memory::write().
Tracks write calls.
Passes the call to the wrapped memory.
Implements Memory.
Definition at line 83 of file MemoryProxy.cc.
References SimulatorFrontend::eventHandler(), frontend_, Informer::handleEvent(), memory_, newWrites_, SimulationEventHandler::SE_MEMORY_ACCESS, and Memory::write().
MemoryProxy::MemoryAccess MemoryProxy::writeAccess | ( | unsigned int | idx | ) | const |
Returns information of the given memory write access.
idx | Index of the write access. |
OutOfRange | If the index is invalid. |
Definition at line 157 of file MemoryProxy.cc.
References __func__, and writes_.
Referenced by ProximMemoryWindow::onSimulationStop().
unsigned int MemoryProxy::writeAccessCount | ( | ) | const |
Returns number of write accesses on the last cycle.
Definition at line 145 of file MemoryProxy.cc.
References writes_.
Referenced by ProximMemoryWindow::onSimulationStop().
|
private |
Definition at line 82 of file MemoryProxy.hh.
|
private |
Wrapped memory.
Definition at line 85 of file MemoryProxy.hh.
Referenced by advanceClock(), fillWithZeros(), read(), reset(), write(), and ~MemoryProxy().
|
private |
List of initiated reads.
Definition at line 96 of file MemoryProxy.hh.
Referenced by advanceClock(), read(), and reset().
|
private |
List of initiated writes.
Definition at line 98 of file MemoryProxy.hh.
Referenced by advanceClock(), reset(), and write().
|
private |
List of initiated reads on the last cycle.
Definition at line 92 of file MemoryProxy.hh.
Referenced by advanceClock(), readAccess(), readAccessCount(), and reset().
|
private |
List of initiated writes on the last cycle.
Definition at line 94 of file MemoryProxy.hh.
Referenced by advanceClock(), reset(), writeAccess(), and writeAccessCount().