43 const std::string &_tracename,
46 tracename(_tracename),
49 if (_tracename.size()) {
52 avr_error(
"registry not initialized for RWMemoryMember '%s'.", _tracename.c_str());
66 RWMemoryMember::operator
unsigned char()
const {
82 unsigned char v=mm.
get();
125 }
else if((v & 0x80) == 0) {
127 string buf =
"<invalid>";
128 unsigned char i = v & 0x0f;
132 avr_warning(
"CLKPR: change clock prescaler to %s (0x%x)", buf.c_str(), i);
147 bool old_enbl = (
value & 0x80) == 0x80, new_enbl = (v & 0x80) == 0x80;
151 avr_warning(
"XDIV: clock divider enabled, CKx%d", 129 - (v & 0x7f));
186 avr_warning(
"OSCCAL: change oscillator calibration value to 0x%x", v);
194 tv =
new TraceValue(8, corereg->GetTraceValuePrefix() + name, number);
196 avr_error(
"registry not initialized for RWMemoryMember '%s'.", name.c_str());
198 corereg->RegisterTraceSetValue(
tv, name, maxsize);
228 string s =
"Invalid write access to IO[0x" +
int2hex(
addr) +
299 avr_error(
"wrong register id for NotSimulatedRegister");
310 unsigned char val =
value;
311 for(
size_t i = 0; i <
clients.size(); i++)
312 val =
clients[i]->get_from_client(
this, val);
317 for(
size_t i = 0; i <
clients.size(); i++)
318 val =
clients[i]->set_from_reg(
this, val);
oscillator version 3.x and older, 8bit, one range
unsigned int CpuCycle(void)
Basic AVR device, contains the core functionality.
unsigned int GetMemERamSize(void)
Get configured external RAM size.
void read()
Log a read access.
virtual unsigned char get() const =0
void AddToCycleList(Hardware *hw)
void set(unsigned char v)
NotSimulatedRegister NSR_TWI_TWCR
unsigned int GetMemIRamSize(void)
Get configured internal RAM size.
NotSimulatedRegister NSR_TWI_TWAMR
void hardwareChange(unsigned char val)
TraceValueRegister * registry
XDIVRegister(AvrDevice *core, TraceValueRegister *registry)
NotSimulatedRegister NSR_MCU_SMCR
NotSimulatedRegister NSR_TWI_TWDR
unsigned int dataAddressMask
which bits in address are significant
NotSimulatedRegister NSR_MCU_MCUSR
NotSimulatedRegister NSR_TWI_TWSR
RAM(TraceValueCoreRegister *registry, const std::string &tracename, const size_t number, const size_t maxsize)
InvalidMem(AvrDevice *core, int addr)
void Reset(void)
Register reset functionality, sets internal register value to 0.
NotSimulatedRegister NSR_MCU_WDTCSR
NotSimulatedRegister NSR_MCU_PRR0
NotSimulatedRegister NSR_MCU_MCUCR
unsigned char value
Internal register value.
IOSpecialReg(TraceValueRegister *registry, const std::string &tracename)
Creates a IOSpecialReg instance, see RWMemoryMember for more info.
NotSimulatedRegister NSR_TWI_TWBR
std::string int2hex(int i)
Convert int into hex string.
NotSimulatedRegister NSR_MCU_PRR
NotSimulatedRegister NSR_XMC_XMCRB
NotSimulatedRegister NSR_XMC_XMCRA
Build a register for TraceValue's.
void RegisterTraceValue(TraceValue *t)
Registers a TraceValue for this register.
unsigned char get() const
Get value method, see RWMemoryMember.
bool abortOnInvalidAccess
Flag, that simulation abort if an invalid access occured, default is false.
std::vector< IOSpecialRegClient * > clients
clients-list with registered clients
NotSimulatedRegister * NSR[NotSimulatedRegister::NSR_size]
NotSimulatedRegister NSR_ADC_DIDR0
Member of any memory area in an AVR device.
unsigned int GetMemIOSize(void)
Get configured IO memory space size.
void write(unsigned val)
Log a write access on this value.
NotSimulatedRegister NSR_ADC_DIDR1
unsigned char get() const
std::string int2str(int i)
Convert an int into a string.
NotSimulatedRegister NSR_ADC_DIDR2
NotSimulatedRegister NSR_MCU_PRR1
NotSimulatedRegister NSR_OCD_OCDR
CLKPRRegister(AvrDevice *core, TraceValueRegister *registry)
unsigned char operator=(unsigned char val)
Write access on memory.
void set(unsigned char)
Set value method, see RWMemoryMember.
unsigned char get() const
NotSimulatedRegister(const char *oname, const char *rname)
unsigned int GetMemRegisterSize(void)
Get configured register space size.
oscillator version 4.x, 7bit, one range
const std::string GetTraceValuePrefix(void)
Returns the scope prefix.
const std::string tracename
OSCCALRegister(AvrDevice *core, TraceValueRegister *registry, int cal)
static NotSimulatedRegister * getRegister(int reg)
bool global_suppress_memory_warnings
flag to suppress invalid memory usage warnings
NotSimulatedRegister NSR_TWI_TWAR
bool GetFuseBit(int index)
Get fuse bit by bit index, starts with 0 on lfuse bit 0, bit = 0 means true!
void set(unsigned char v)
unsigned char get() const
void set(unsigned char v)
An IO register which is not simulated in the moment. Reads and writes are ignored and produce warning...