simulavr
1.1.0
|
Hold a memory block and symbol informations. More...
#include <memory.h>
Public Member Functions | |
Memory (int size) | |
virtual | ~Memory () |
std::string | GetSymbolAtAddress (unsigned int add) |
unsigned int | GetAddressAtSymbol (const std::string &s) |
void | AddSymbol (std::pair< unsigned int, std::string > p) |
unsigned int | GetSize () |
virtual void | WriteMem (const unsigned char *, unsigned int offset, unsigned int size)=0 |
Public Attributes | |
unsigned char * | myMemory |
std::multimap< unsigned int, std::string > | sym |
Protected Attributes | |
unsigned int | size |
Hold a memory block and symbol informations.
Memory class to hold memory content and symbol informations to map symbols to addresses and vice versa.
Memory::Memory | ( | int | size | ) |
Creates the memory block
size | the memory block size |
Definition at line 109 of file memory.cpp.
|
inlinevirtual |
Destructor, frees myMemory
Definition at line 56 of file memory.h.
References avr_free(), GetAddressAtSymbol(), and GetSymbolAtAddress().
|
inline |
unsigned int Memory::GetAddressAtSymbol | ( | const std::string & | s | ) |
Returns the address for a symbol
If the given string is a hex string, the hex value will be converted and returned. If the symbol isn't found, program aborts.
s | the symbol string or hex string |
Definition at line 35 of file memory.cpp.
References avr_error, avr_free(), and avr_new.
Referenced by AvrDevice::RegisterTerminationSymbol(), and ~Memory().
|
inline |
Returns the size in bytes of memory block
Definition at line 85 of file memory.h.
References size, and WriteMem().
Referenced by avr_op_RCALL::operator()(), avr_op_RJMP::operator()(), HWEeprom::SetEearh(), and AvrDevice::Step().
string Memory::GetSymbolAtAddress | ( | unsigned int | add | ) |
Return string with symbols found at address
Seeks for symbols, which are registered for the given address. If the address isn't equal to a symbol address, but before the next one, then a offset to symbol address will be added. Returns a empty string, if nothing is found. (in case of no given symbols!)
add | the given address |
Definition at line 67 of file memory.cpp.
Referenced by AvrDevice::Step(), and ~Memory().
|
pure virtual |
unsigned char* Memory::myMemory |
THE memory block content itself
Definition at line 45 of file memory.h.
Referenced by AvrFlash::AvrFlash(), HWEeprom::CpuCycle(), AvrFlash::Decode(), HWEeprom::HWEeprom(), Memory(), avr_op_ILLEGAL::operator()(), HWEeprom::ReadFromAddress(), AvrFlash::ReadMem(), AvrFlash::ReadMemRaw(), AvrFlash::ReadMemRawWord(), AvrFlash::ReadMemWord(), HWEeprom::SetEecr(), HWEeprom::WriteAtAddress(), AvrFlash::WriteMem(), HWEeprom::WriteMem(), AvrFlash::WriteMemByte(), and HWEeprom::~HWEeprom().
|
protected |
allocated size (in bytes) of myMemory
Definition at line 41 of file memory.h.
Referenced by AvrFlash::AvrFlash(), HWEeprom::CpuCycle(), AvrFlash::Decode(), GetSize(), HWEeprom::HWEeprom(), AvrFlash::LooksLikeContextSwitch(), Memory(), AvrFlash::ReadMemWord(), HWEeprom::SetEecr(), AvrFlash::WriteMem(), HWEeprom::WriteMem(), AvrFlash::WriteMemByte(), and AvrFlash::~AvrFlash().
std::multimap<unsigned int, std::string> Memory::sym |