simulavr
1.1.0
|
Basic AVR device, contains the core functionality. More...
#include <avrdevice.h>
Public Member Functions | |
AvrDevice (unsigned int ioSpaceSize, unsigned int IRamSize, unsigned int ERamSize, unsigned int flashSize, unsigned int pcSize=2) | |
virtual | ~AvrDevice () |
void | AddToResetList (Hardware *hw) |
void | AddToCycleList (Hardware *hw) |
void | RemoveFromCycleList (Hardware *hw) |
Removes from the cycle list, if possible. More... | |
void | Load (const char *n) |
Load flash, eeprom, signature, fuses from elf file, wrapper for LoadBFD or LoadSimpleELF. More... | |
void | ReplaceIoRegister (unsigned int offset, RWMemoryMember *) |
bool | ReplaceMemRegister (unsigned int offset, RWMemoryMember *) |
RWMemoryMember * | GetMemRegisterInstance (unsigned int offset) |
void | RegisterTerminationSymbol (const char *symbol) |
Pin * | GetPin (const char *name) |
int | Step (bool &untilCoreStepFinished, SystemClockOffset *nextStepIn_ns=0) |
void | Reset () |
void | SetClockFreq (SystemClockOffset f) |
SystemClockOffset | GetClockFreq () |
void | RegisterPin (const std::string &name, Pin *p) |
void | DeleteAllBreakpoints (void) |
Clear all breakpoints in device. More... | |
const std::string & | GetFname (void) |
Return filename from loaded program. More... | |
const std::string & | GetDeviceName (void) |
Return device name. More... | |
unsigned int | GetDeviceSignature (void) |
Return device signature. More... | |
void | SetDeviceNameAndSignature (const std::string &name, unsigned int signature) |
Set device signature and name. More... | |
unsigned int | GetMemTotalSize (void) |
Get configured total memory space size. More... | |
unsigned int | GetMemIOSize (void) |
Get configured IO memory space size. More... | |
unsigned int | GetMemRegisterSize (void) |
Get configured register space size. More... | |
unsigned int | GetMemIRamSize (void) |
Get configured internal RAM size. More... | |
unsigned int | GetMemERamSize (void) |
Get configured external RAM size. More... | |
unsigned char | GetRWMem (unsigned addr) |
Get a value of RW memory cell. More... | |
bool | SetRWMem (unsigned addr, unsigned char val) |
Set a value to RW memory cell. More... | |
unsigned char | GetCoreReg (unsigned addr) |
Get a value from core register. More... | |
bool | SetCoreReg (unsigned addr, unsigned char val) |
Set a value to core register. More... | |
unsigned char | GetIOReg (unsigned addr) |
Get a value from IO register (without offset of 0x20!) More... | |
bool | SetIOReg (unsigned addr, unsigned char val) |
Set a value to IO register (without offset of 0x20!) More... | |
bool | SetIORegBit (unsigned addr, unsigned bitaddr) |
Set a bit value to lower IO register (without offset of 0x20!) More... | |
bool | ClearIORegBit (unsigned addr, unsigned bitaddr) |
Clear a bit value to lower IO register (without offset of 0x20!) More... | |
unsigned | GetRegX (void) |
Get value of X register (16bit) More... | |
unsigned | GetRegY (void) |
Get value of Y register (16bit) More... | |
unsigned | GetRegZ (void) |
Get value of Z register (16bit) More... | |
void | DebugOnJump () |
When a call/jump/cond-jump instruction was executed. For debugging. More... | |
![]() | |
virtual | ~SimulationMember () |
![]() | |
TraceValueRegister (TraceValueRegister *parent, const std::string &name) | |
Create a TraceValueRegister, with a scope prefix built on parent scope + name. More... | |
TraceValueRegister () | |
Create a TraceValueRegister, with a empty scope name, single device application. More... | |
virtual | ~TraceValueRegister () |
const std::string | GetTraceValuePrefix (void) |
Returns the scope prefix. More... | |
const std::string | GetScopeName (void) |
Returns the scope name. More... | |
void | RegisterTraceValue (TraceValue *t) |
Registers a TraceValue for this register. More... | |
void | UnregisterTraceValue (TraceValue *t) |
Unregisters a TraceValue, remove it from register. More... | |
TraceValueRegister * | GetScopeGroupByName (const std::string &name) |
Get a here registered TraceValueRegister by it's name. More... | |
virtual TraceValue * | GetTraceValueByName (const std::string &name) |
Get a here registered TraceValue by it's name. More... | |
TraceValueRegister * | FindScopeGroupByName (const std::string &name) |
Seek for a TraceValueRegister by it's name. More... | |
TraceValue * | FindTraceValueByName (const std::string &name) |
Seek for a TraceValue by it's name. More... | |
TraceSet * | GetAllTraceValues (void) |
Get all here registered TraceValue's only (not with descending values) More... | |
TraceSet * | GetAllTraceValuesRecursive (void) |
Get all here registered TraceValue's with descending values. More... | |
Public Attributes | |
int | trace_on |
Breakpoints | BP |
Exitpoints | EP |
unsigned int | PC |
unsigned int | cPC |
When mupti-cycle instruction is "processed" this holds its address, PC holds the next instruction. More... | |
const unsigned int | PC_size |
unsigned int | dataAddressMask |
which bits in address are significant More... | |
AvrFlash * | Flash |
FlashProgramming * | spmRegister |
AvrFuses * | fuses |
AvrLockBits * | lockbits |
HWEeprom * | eeprom |
Data * | data |
a hack for symbol look-up More... | |
HWIrqSystem * | irqSystem |
AddressExtensionRegister * | rampz |
RAMPZ address extension register. More... | |
AddressExtensionRegister * | eind |
EIND address extension register. More... | |
bool | abortOnInvalidAccess |
Flag, that simulation abort if an invalid access occured, default is false. More... | |
TraceValueCoreRegister | coreTraceGroup |
bool | deferIrq |
Almost always false. More... | |
unsigned int | newIrqPc |
unsigned int | actualIrqVector |
Pin | v_supply |
represents supply voltage level, needed for analog peripherals More... | |
Pin | v_bandgap |
represents bandgap (ref) voltage level, needed for analog peripherals More... | |
bool | flagIWInstructions |
ADIW and SBIW instructions are available (not on most tiny's!) More... | |
bool | flagJMPInstructions |
CALL and JMP instructions are available (only on devices with bigger flash) More... | |
bool | flagIJMPInstructions |
ICALL and IJMP instructions are available (not on attiny1x devices) More... | |
bool | flagEIJMPInstructions |
EICALL and EIJMP instructions are available (only on some devices with bigger flash) More... | |
bool | flagLPMInstructions |
LPM and SPM instructions are available (not on some tiny devices) More... | |
bool | flagELPMInstructions |
ELPM instructions are available (only on devices with bigger flash) More... | |
bool | flagMULInstructions |
(F)MULxx instructions are available More... | |
bool | flagMOVWInstruction |
MOVW instruction is available. More... | |
bool | flagTiny10 |
core is a tiny4/5/9/10, change used clocks on some instructions and disables instructions More... | |
bool | flagTiny1x |
core is a tiny1x (but not tiny10!), change used clocks on some instructions and disables instructions More... | |
bool | flagXMega |
core is a XMEGA device, change used clocks on some instructions More... | |
int | DebugRecentJumps [20] |
Addresses of last few 'call' and 'jump' executed. For debugging. More... | |
int | DebugRecentJumpsIndex |
Index to address of the most recent jump. More... | |
RWMemoryMember ** | rw |
The whole memory: R0-R31, IO, Internal RAM. More... | |
HWStack * | stack |
HWSreg * | status |
the status register itself More... | |
RWSreg * | statusRegister |
the memory interface for status More... | |
HWWado * | wado |
WDT timer. More... | |
std::vector< Hardware * > | hwResetList |
std::vector< Hardware * > | hwCycleList |
DumpManager * | dumpManager |
Protected Attributes | |
SystemClockOffset | clockFreq |
Period of a tick (1/F_OSC) in [ns]. More... | |
std::map< std::string, Pin * > | allPins |
std::string | actualFilename |
int | cpuCycles |
Count of cycles before next instruction is executed (i.e. countdown) More... | |
Private Member Functions | |
void | detachDumpManager () |
Private Attributes | |
RWMemoryMember ** | invalidRW |
hold invalid RW memory cells created by device More... | |
const unsigned int | ioSpaceSize |
const unsigned int | iRamSize |
const unsigned int | eRamSize |
unsigned int | devSignature |
hold the device signature for this core More... | |
std::string | devName |
hold the device name, which this core simulate More... | |
Static Private Attributes | |
static const unsigned int | totalIoSpace = 0x10000 |
static const unsigned int | registerSpaceSize = 32 |
Friends | |
class | DumpManager |
void | ELFLoad (const AvrDevice *core) |
Additional Inherited Members | |
![]() | |
virtual size_t | _tvr_getValuesCount (void) |
Get the count of all TraceValues, that are registered here and descending. More... | |
virtual void | _tvr_insertTraceValuesToSet (TraceSet &t) |
Insert all TraceValues into TraceSet, that registered here and descending. More... | |
Basic AVR device, contains the core functionality.
Definition at line 66 of file avrdevice.h.
AvrDevice::AvrDevice | ( | unsigned int | ioSpaceSize, |
unsigned int | IRamSize, | ||
unsigned int | ERamSize, | ||
unsigned int | flashSize, | ||
unsigned int | pcSize = 2 |
||
) |
Definition at line 129 of file avrdevice.cpp.
References avr_error, coreTraceGroup, data, dataAddressMask, DebugRecentJumpsIndex, dumpManager, Flash, fuses, DumpManager::Instance(), invalidRW, ioSpaceSize, lockbits, DumpManager::registerAvrDevice(), registerSpaceSize, rw, spmRegister, status, statusRegister, totalIoSpace, and trace_on.
|
virtual |
Definition at line 83 of file avrdevice.cpp.
void AvrDevice::AddToCycleList | ( | Hardware * | hw | ) |
Adds to the list of parts to cycle per clock tick. If already in that list, does nothing.
Definition at line 51 of file avrdevice.cpp.
Referenced by CLKPRRegister::CLKPRRegister(), FlashProgramming::FlashProgramming(), HWAd::HWAd(), HWPrescaler::HWPrescaler(), HWTimerTinyX5::HWTimerTinyX5(), HWUart::HWUart(), HWWado::HWWado(), BasicTimerUnit::SetClockMode(), and HWEeprom::SetEecr().
void AvrDevice::AddToResetList | ( | Hardware * | hw | ) |
Adds to the list of parts to reset. If already in that list, does nothing.
Definition at line 46 of file avrdevice.cpp.
Referenced by Hardware::Hardware().
bool AvrDevice::ClearIORegBit | ( | unsigned | addr, |
unsigned | bitaddr | ||
) |
Clear a bit value to lower IO register (without offset of 0x20!)
Definition at line 487 of file avrdevice.cpp.
References registerSpaceSize, and rw.
Referenced by avr_op_CBI::operator()().
void AvrDevice::DebugOnJump | ( | ) |
When a call/jump/cond-jump instruction was executed. For debugging.
Definition at line 437 of file avrdevice.cpp.
References DebugRecentJumps, DebugRecentJumpsIndex, and PC.
Referenced by avr_op_BRBC::operator()(), avr_op_BRBS::operator()(), avr_op_CALL::operator()(), avr_op_CPSE::operator()(), avr_op_EICALL::operator()(), avr_op_EIJMP::operator()(), avr_op_ICALL::operator()(), avr_op_IJMP::operator()(), avr_op_JMP::operator()(), avr_op_RCALL::operator()(), avr_op_RJMP::operator()(), avr_op_SBIC::operator()(), avr_op_SBIS::operator()(), avr_op_SBRC::operator()(), and avr_op_SBRS::operator()().
void AvrDevice::DeleteAllBreakpoints | ( | void | ) |
|
inlineprivate |
Definition at line 79 of file avrdevice.h.
Referenced by DumpManager::detachAvrDevices().
SystemClockOffset AvrDevice::GetClockFreq | ( | ) |
Definition at line 72 of file avrdevice.cpp.
unsigned char AvrDevice::GetCoreReg | ( | unsigned | addr | ) |
Get a value from core register.
Definition at line 459 of file avrdevice.cpp.
References registerSpaceSize, and rw.
Referenced by ThreadList::OnCall(), avr_op_ADC::operator()(), avr_op_ADD::operator()(), avr_op_ADIW::operator()(), avr_op_AND::operator()(), avr_op_ANDI::operator()(), avr_op_ASR::operator()(), avr_op_BLD::operator()(), avr_op_BST::operator()(), avr_op_COM::operator()(), avr_op_CP::operator()(), avr_op_CPC::operator()(), avr_op_CPI::operator()(), avr_op_CPSE::operator()(), avr_op_DEC::operator()(), avr_op_EOR::operator()(), avr_op_ESPM::operator()(), avr_op_FMUL::operator()(), avr_op_FMULS::operator()(), avr_op_FMULSU::operator()(), avr_op_INC::operator()(), avr_op_LSR::operator()(), avr_op_MOV::operator()(), avr_op_MOVW::operator()(), avr_op_MUL::operator()(), avr_op_MULS::operator()(), avr_op_MULSU::operator()(), avr_op_NEG::operator()(), avr_op_OR::operator()(), avr_op_ORI::operator()(), avr_op_OUT::operator()(), avr_op_PUSH::operator()(), avr_op_ROR::operator()(), avr_op_SBC::operator()(), avr_op_SBCI::operator()(), avr_op_SBIW::operator()(), avr_op_SBRC::operator()(), avr_op_SBRS::operator()(), avr_op_SPM::operator()(), avr_op_STD_Y::operator()(), avr_op_STD_Z::operator()(), avr_op_STS::operator()(), avr_op_ST_X::operator()(), avr_op_ST_X_decr::operator()(), avr_op_ST_X_incr::operator()(), avr_op_ST_Y_decr::operator()(), avr_op_ST_Y_incr::operator()(), avr_op_ST_Z_decr::operator()(), avr_op_ST_Z_incr::operator()(), avr_op_SUB::operator()(), avr_op_SUBI::operator()(), and avr_op_SWAP::operator()().
|
inline |
Return device name.
Definition at line 181 of file avrdevice.h.
|
inline |
Return device signature.
Definition at line 183 of file avrdevice.h.
|
inline |
Return filename from loaded program.
Definition at line 179 of file avrdevice.h.
Referenced by HWIrqSystem::ClearIrqFlag(), HWIrqSystem::IrqHandlerFinished(), HWIrqSystem::IrqHandlerStarted(), operator<<(), and HWIrqSystem::SetIrqFlag().
unsigned char AvrDevice::GetIOReg | ( | unsigned | addr | ) |
Get a value from IO register (without offset of 0x20!)
Definition at line 470 of file avrdevice.cpp.
References ioSpaceSize, registerSpaceSize, and rw.
Referenced by avr_op_IN::operator()(), avr_op_SBIC::operator()(), and avr_op_SBIS::operator()().
|
inline |
Get configured external RAM size.
Definition at line 196 of file avrdevice.h.
References ELFLoad().
Referenced by InvalidMem::get(), and InvalidMem::set().
|
inline |
Get configured IO memory space size.
Definition at line 190 of file avrdevice.h.
Referenced by InvalidMem::get(), HWStackSram::Reset(), and InvalidMem::set().
|
inline |
Get configured internal RAM size.
Definition at line 194 of file avrdevice.h.
Referenced by InvalidMem::get(), HWStackSram::Reset(), and InvalidMem::set().
RWMemoryMember * AvrDevice::GetMemRegisterInstance | ( | unsigned int | offset | ) |
Definition at line 426 of file avrdevice.cpp.
References rw, and totalIoSpace.
|
inline |
Get configured register space size.
Definition at line 192 of file avrdevice.h.
Referenced by InvalidMem::get(), HWStackSram::Reset(), and InvalidMem::set().
|
inline |
Get configured total memory space size.
Definition at line 188 of file avrdevice.h.
Referenced by GetRWMem(), and SetRWMem().
Pin * AvrDevice::GetPin | ( | const char * | name | ) |
Definition at line 76 of file avrdevice.cpp.
References avr_error.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), and AvrDevice_attinyX5::AvrDevice_attinyX5().
unsigned AvrDevice::GetRegX | ( | void | ) |
Get value of X register (16bit)
Definition at line 493 of file avrdevice.cpp.
References rw.
Referenced by avr_op_LD_X::operator()(), avr_op_LD_X_decr::operator()(), avr_op_LD_X_incr::operator()(), avr_op_ST_X::operator()(), avr_op_ST_X_decr::operator()(), and avr_op_ST_X_incr::operator()().
unsigned AvrDevice::GetRegY | ( | void | ) |
Get value of Y register (16bit)
Definition at line 498 of file avrdevice.cpp.
References rw.
Referenced by avr_op_LDD_Y::operator()(), avr_op_LD_Y_decr::operator()(), avr_op_LD_Y_incr::operator()(), avr_op_STD_Y::operator()(), avr_op_ST_Y_decr::operator()(), and avr_op_ST_Y_incr::operator()().
unsigned AvrDevice::GetRegZ | ( | void | ) |
Get value of Z register (16bit)
Definition at line 503 of file avrdevice.cpp.
References rw.
Referenced by avr_op_EICALL::operator()(), avr_op_EIJMP::operator()(), avr_op_ELPM_Z::operator()(), avr_op_ELPM_Z_incr::operator()(), avr_op_ELPM::operator()(), avr_op_ESPM::operator()(), avr_op_ICALL::operator()(), avr_op_IJMP::operator()(), avr_op_LDD_Z::operator()(), avr_op_LD_Z_incr::operator()(), avr_op_LD_Z_decr::operator()(), avr_op_LPM_Z::operator()(), avr_op_LPM::operator()(), avr_op_LPM_Z_incr::operator()(), avr_op_SPM::operator()(), avr_op_STD_Z::operator()(), avr_op_ST_Z_decr::operator()(), and avr_op_ST_Z_incr::operator()().
unsigned char AvrDevice::GetRWMem | ( | unsigned | addr | ) |
Get a value of RW memory cell.
Definition at line 446 of file avrdevice.cpp.
References GetMemTotalSize(), and rw.
Referenced by avr_op_LDD_Y::operator()(), avr_op_LDD_Z::operator()(), avr_op_LDS::operator()(), avr_op_LD_X::operator()(), avr_op_LD_X_decr::operator()(), avr_op_LD_X_incr::operator()(), avr_op_LD_Y_decr::operator()(), avr_op_LD_Y_incr::operator()(), avr_op_LD_Z_incr::operator()(), avr_op_LD_Z_decr::operator()(), and HWStackSram::Pop().
void AvrDevice::Load | ( | const char * | n | ) |
Load flash, eeprom, signature, fuses from elf file, wrapper for LoadBFD or LoadSimpleELF.
Definition at line 63 of file avrdevice.cpp.
References ELFLoad().
Referenced by avr_create_tf().
|
inline |
Definition at line 171 of file avrdevice.h.
Referenced by AvrDevice_atmega668base::AvrDevice_atmega668base(), HWARefPin::HWARefPin(), and HWPort::HWPort().
void AvrDevice::RegisterTerminationSymbol | ( | const char * | symbol | ) |
Definition at line 432 of file avrdevice.cpp.
References EP, Flash, and Memory::GetAddressAtSymbol().
void AvrDevice::RemoveFromCycleList | ( | Hardware * | hw | ) |
Removes from the cycle list, if possible.
Does nothing if the part is not in the cycle list.
Definition at line 56 of file avrdevice.cpp.
Referenced by HWEeprom::CpuCycle(), and BasicTimerUnit::SetClockMode().
void AvrDevice::ReplaceIoRegister | ( | unsigned int | offset, |
RWMemoryMember * | newMember | ||
) |
Definition at line 412 of file avrdevice.cpp.
References avr_error, ioSpaceSize, registerSpaceSize, and rw.
bool AvrDevice::ReplaceMemRegister | ( | unsigned int | offset, |
RWMemoryMember * | newMember | ||
) |
Definition at line 418 of file avrdevice.cpp.
References rw, and totalIoSpace.
void AvrDevice::Reset | ( | ) |
Definition at line 390 of file avrdevice.cpp.
References cPC, cpuCycles, fuses, AvrFuses::GetResetAddr(), hwResetList, PC, and status.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), and HWWado::CpuCycle().
void AvrDevice::SetClockFreq | ( | SystemClockOffset | f | ) |
Definition at line 68 of file avrdevice.cpp.
bool AvrDevice::SetCoreReg | ( | unsigned | addr, |
unsigned char | val | ||
) |
Set a value to core register.
Definition at line 464 of file avrdevice.cpp.
References registerSpaceSize, and rw.
Referenced by avr_op_ADC::operator()(), avr_op_ADD::operator()(), avr_op_ADIW::operator()(), avr_op_AND::operator()(), avr_op_ANDI::operator()(), avr_op_ASR::operator()(), avr_op_BLD::operator()(), avr_op_COM::operator()(), avr_op_DEC::operator()(), avr_op_ELPM_Z::operator()(), avr_op_ELPM_Z_incr::operator()(), avr_op_ELPM::operator()(), avr_op_EOR::operator()(), avr_op_ESPM::operator()(), avr_op_FMUL::operator()(), avr_op_FMULS::operator()(), avr_op_FMULSU::operator()(), avr_op_IN::operator()(), avr_op_INC::operator()(), avr_op_LDD_Y::operator()(), avr_op_LDD_Z::operator()(), avr_op_LDI::operator()(), avr_op_LDS::operator()(), avr_op_LD_X::operator()(), avr_op_LD_X_decr::operator()(), avr_op_LD_X_incr::operator()(), avr_op_LD_Y_decr::operator()(), avr_op_LD_Y_incr::operator()(), avr_op_LD_Z_incr::operator()(), avr_op_LD_Z_decr::operator()(), avr_op_LPM_Z::operator()(), avr_op_LPM::operator()(), avr_op_LPM_Z_incr::operator()(), avr_op_LSR::operator()(), avr_op_MOV::operator()(), avr_op_MOVW::operator()(), avr_op_MUL::operator()(), avr_op_MULS::operator()(), avr_op_MULSU::operator()(), avr_op_NEG::operator()(), avr_op_OR::operator()(), avr_op_ORI::operator()(), avr_op_POP::operator()(), avr_op_ROR::operator()(), avr_op_SBC::operator()(), avr_op_SBCI::operator()(), avr_op_SBIW::operator()(), avr_op_ST_X_decr::operator()(), avr_op_ST_X_incr::operator()(), avr_op_ST_Y_decr::operator()(), avr_op_ST_Y_incr::operator()(), avr_op_ST_Z_decr::operator()(), avr_op_ST_Z_incr::operator()(), avr_op_SUB::operator()(), avr_op_SUBI::operator()(), and avr_op_SWAP::operator()().
void AvrDevice::SetDeviceNameAndSignature | ( | const std::string & | name, |
unsigned int | signature | ||
) |
Set device signature and name.
Definition at line 407 of file avrdevice.cpp.
References devName, and devSignature.
bool AvrDevice::SetIOReg | ( | unsigned | addr, |
unsigned char | val | ||
) |
Set a value to IO register (without offset of 0x20!)
Definition at line 475 of file avrdevice.cpp.
References ioSpaceSize, registerSpaceSize, and rw.
Referenced by avr_op_OUT::operator()().
bool AvrDevice::SetIORegBit | ( | unsigned | addr, |
unsigned | bitaddr | ||
) |
Set a bit value to lower IO register (without offset of 0x20!)
Definition at line 481 of file avrdevice.cpp.
References registerSpaceSize, and rw.
Referenced by avr_op_SBI::operator()().
bool AvrDevice::SetRWMem | ( | unsigned | addr, |
unsigned char | val | ||
) |
Set a value to RW memory cell.
Definition at line 452 of file avrdevice.cpp.
References GetMemTotalSize(), and rw.
Referenced by avr_op_STD_Y::operator()(), avr_op_STD_Z::operator()(), avr_op_STS::operator()(), avr_op_ST_X::operator()(), avr_op_ST_X_decr::operator()(), avr_op_ST_X_incr::operator()(), avr_op_ST_Y_decr::operator()(), avr_op_ST_Y_incr::operator()(), avr_op_ST_Z_decr::operator()(), avr_op_ST_Z_incr::operator()(), and HWStackSram::Push().
|
virtual |
Steps the AVR core.
untilCoreStepFinished | iff true, steps a core step and not a single clock cycle. |
Implements SimulationMember.
Definition at line 258 of file avrdevice.cpp.
References actualFilename, actualIrqVector, avr_error, avr_message, BP, BREAK_POINT, clockFreq, cPC, Hardware::CpuCycle(), cpuCycles, DumpManager::cycle(), deferIrq, dumpManager, EP, Flash, AvrFlash::GetInstruction(), HWIrqSystem::GetNewPc(), Memory::GetSize(), HWStack::GetStackPointer(), Memory::GetSymbolAtAddress(), hwCycleList, HWSreg_bool::I, SystemClock::Instance(), HWIrqSystem::IrqHandlerFinished(), HWIrqSystem::IrqHandlerStarted(), irqSystem, HWIrqSystem::IsIrqPending(), newIrqPc, PC, HWStack::PushAddr(), HWStack::SetReturnPoint(), stack, status, statusRegister, SystemClock::Stop(), sysConHandler, trace_on, SystemConsoleHandler::TraceNextLine(), traceOut, and RWSreg::trigger_change().
|
friend |
Definition at line 78 of file avrdevice.h.
|
friend |
Definition at line 38 of file avrreadelf.cpp.
bool AvrDevice::abortOnInvalidAccess |
Flag, that simulation abort if an invalid access occured, default is false.
Definition at line 107 of file avrdevice.h.
Referenced by InvalidMem::get(), and InvalidMem::set().
|
protected |
Definition at line 84 of file avrdevice.h.
unsigned int AvrDevice::actualIrqVector |
Definition at line 111 of file avrdevice.h.
Referenced by Step().
|
protected |
Definition at line 83 of file avrdevice.h.
Breakpoints AvrDevice::BP |
Definition at line 91 of file avrdevice.h.
Referenced by DeleteAllBreakpoints(), and Step().
|
protected |
Period of a tick (1/F_OSC) in [ns].
Definition at line 82 of file avrdevice.h.
Referenced by Step().
TraceValueCoreRegister AvrDevice::coreTraceGroup |
Definition at line 108 of file avrdevice.h.
Referenced by AvrDevice(), AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), and HWPrescaler::HWPrescaler().
unsigned int AvrDevice::cPC |
When mupti-cycle instruction is "processed" this holds its address, PC holds the next instruction.
Definition at line 95 of file avrdevice.h.
|
protected |
Count of cycles before next instruction is executed (i.e. countdown)
Definition at line 87 of file avrdevice.h.
Data* AvrDevice::data |
a hack for symbol look-up
Definition at line 103 of file avrdevice.h.
Referenced by AvrDevice(), and ELFLoad().
unsigned int AvrDevice::dataAddressMask |
which bits in address are significant
Definition at line 97 of file avrdevice.h.
Referenced by AvrDevice(), InvalidMem::get(), and InvalidMem::set().
int AvrDevice::DebugRecentJumps[20] |
Addresses of last few 'call' and 'jump' executed. For debugging.
Definition at line 126 of file avrdevice.h.
Referenced by DebugOnJump().
int AvrDevice::DebugRecentJumpsIndex |
Index to address of the most recent jump.
Definition at line 127 of file avrdevice.h.
Referenced by AvrDevice(), and DebugOnJump().
bool AvrDevice::deferIrq |
|
private |
hold the device name, which this core simulate
Definition at line 76 of file avrdevice.h.
Referenced by SetDeviceNameAndSignature().
|
private |
hold the device signature for this core
Definition at line 75 of file avrdevice.h.
Referenced by ELFLoad(), and SetDeviceNameAndSignature().
DumpManager* AvrDevice::dumpManager |
Definition at line 139 of file avrdevice.h.
Referenced by AvrDevice(), and Step().
HWEeprom* AvrDevice::eeprom |
Definition at line 102 of file avrdevice.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), ELFLoad(), AvrDevice_at90s4433::~AvrDevice_at90s4433(), AvrDevice_at90s8515::~AvrDevice_at90s8515(), and AvrDevice_atmega8::~AvrDevice_atmega8().
AddressExtensionRegister* AvrDevice::eind |
EIND address extension register.
Definition at line 106 of file avrdevice.h.
Referenced by AvrDevice_atmega2560base::AvrDevice_atmega2560base(), avr_op_EICALL::operator()(), and avr_op_EIJMP::operator()().
Exitpoints AvrDevice::EP |
Definition at line 92 of file avrdevice.h.
Referenced by RegisterTerminationSymbol(), and Step().
|
private |
Definition at line 74 of file avrdevice.h.
bool AvrDevice::flagEIJMPInstructions |
EICALL and EIJMP instructions are available (only on some devices with bigger flash)
Definition at line 118 of file avrdevice.h.
Referenced by AvrDevice_atmega2560base::AvrDevice_atmega2560base(), and lookup_opcode().
bool AvrDevice::flagELPMInstructions |
ELPM instructions are available (only on devices with bigger flash)
Definition at line 120 of file avrdevice.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), and lookup_opcode().
bool AvrDevice::flagIJMPInstructions |
ICALL and IJMP instructions are available (not on attiny1x devices)
Definition at line 117 of file avrdevice.h.
Referenced by lookup_opcode().
bool AvrDevice::flagIWInstructions |
ADIW and SBIW instructions are available (not on most tiny's!)
Definition at line 115 of file avrdevice.h.
Referenced by lookup_opcode().
bool AvrDevice::flagJMPInstructions |
CALL and JMP instructions are available (only on devices with bigger flash)
Definition at line 116 of file avrdevice.h.
Referenced by AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), and lookup_opcode().
bool AvrDevice::flagLPMInstructions |
LPM and SPM instructions are available (not on some tiny devices)
Definition at line 119 of file avrdevice.h.
Referenced by lookup_opcode().
bool AvrDevice::flagMOVWInstruction |
MOVW instruction is available.
Definition at line 122 of file avrdevice.h.
Referenced by lookup_opcode().
bool AvrDevice::flagMULInstructions |
(F)MULxx instructions are available
Definition at line 121 of file avrdevice.h.
Referenced by AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), and lookup_opcode().
bool AvrDevice::flagTiny10 |
core is a tiny4/5/9/10, change used clocks on some instructions and disables instructions
Definition at line 123 of file avrdevice.h.
Referenced by lookup_opcode(), avr_op_CBI::operator()(), avr_op_LDD_Y::operator()(), avr_op_LDD_Z::operator()(), avr_op_LD_X::operator()(), avr_op_LD_X_decr::operator()(), avr_op_LD_Y_decr::operator()(), avr_op_LD_Z_decr::operator()(), avr_op_RCALL::operator()(), avr_op_SBI::operator()(), avr_op_STD_Y::operator()(), avr_op_STD_Z::operator()(), avr_op_ST_X::operator()(), avr_op_ST_X_incr::operator()(), avr_op_ST_Y_incr::operator()(), and avr_op_ST_Z_incr::operator()().
bool AvrDevice::flagTiny1x |
core is a tiny1x (but not tiny10!), change used clocks on some instructions and disables instructions
Definition at line 124 of file avrdevice.h.
Referenced by lookup_opcode().
bool AvrDevice::flagXMega |
core is a XMEGA device, change used clocks on some instructions
Definition at line 125 of file avrdevice.h.
Referenced by avr_op_CALL::operator()(), avr_op_CBI::operator()(), avr_op_EICALL::operator()(), avr_op_ICALL::operator()(), avr_op_LDD_Y::operator()(), avr_op_LDD_Z::operator()(), avr_op_LD_X::operator()(), avr_op_LD_X_incr::operator()(), avr_op_LD_Y_incr::operator()(), avr_op_LD_Z_incr::operator()(), avr_op_PUSH::operator()(), avr_op_RCALL::operator()(), avr_op_SBI::operator()(), avr_op_SBIC::operator()(), avr_op_SBIS::operator()(), avr_op_STD_Y::operator()(), avr_op_STD_Z::operator()(), avr_op_ST_X::operator()(), avr_op_ST_X_incr::operator()(), avr_op_ST_Y_incr::operator()(), and avr_op_ST_Z_incr::operator()().
AvrFlash* AvrDevice::Flash |
Definition at line 98 of file avrdevice.h.
Referenced by AvrDevice(), ELFLoad(), ThreadList::OnSPWrite(), avr_op_CALL::operator()(), avr_op_CPSE::operator()(), avr_op_ELPM_Z::operator()(), avr_op_ELPM_Z_incr::operator()(), avr_op_ELPM::operator()(), avr_op_JMP::operator()(), avr_op_LDS::operator()(), avr_op_LPM_Z::operator()(), avr_op_LPM::operator()(), avr_op_LPM_Z_incr::operator()(), avr_op_RCALL::operator()(), avr_op_RJMP::operator()(), avr_op_SBIC::operator()(), avr_op_SBIS::operator()(), avr_op_SBRC::operator()(), avr_op_SBRS::operator()(), avr_op_STS::operator()(), avr_op_ILLEGAL::operator()(), RegisterTerminationSymbol(), FlashProgramming::SetRWWLock(), FlashProgramming::SPM_action(), and Step().
AvrFuses* AvrDevice::fuses |
Definition at line 100 of file avrdevice.h.
Referenced by AvrDevice(), AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), CLKPRRegister::CLKPRRegister(), ELFLoad(), HWAdmux6::GetValue(), CLKPRRegister::Reset(), and Reset().
std::vector<Hardware *> AvrDevice::hwCycleList |
Definition at line 137 of file avrdevice.h.
Referenced by Step().
std::vector<Hardware *> AvrDevice::hwResetList |
Definition at line 136 of file avrdevice.h.
Referenced by Reset().
|
private |
hold invalid RW memory cells created by device
Definition at line 69 of file avrdevice.h.
Referenced by AvrDevice().
|
private |
Definition at line 70 of file avrdevice.h.
Referenced by AvrDevice(), GetIOReg(), ReplaceIoRegister(), and SetIOReg().
|
private |
Definition at line 73 of file avrdevice.h.
HWIrqSystem* AvrDevice::irqSystem |
Definition at line 104 of file avrdevice.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), Step(), AvrDevice_at90s4433::~AvrDevice_at90s4433(), AvrDevice_at90s8515::~AvrDevice_at90s8515(), and AvrDevice_atmega8::~AvrDevice_atmega8().
AvrLockBits* AvrDevice::lockbits |
Definition at line 101 of file avrdevice.h.
Referenced by AvrDevice(), and ELFLoad().
unsigned int AvrDevice::newIrqPc |
Definition at line 110 of file avrdevice.h.
Referenced by Step().
unsigned int AvrDevice::PC |
Next/current instruction index. Multiply by 2 to get an address.
Definition at line 93 of file avrdevice.h.
Referenced by DebugOnJump(), InvalidMem::get(), WarnUnknown::markReadUnknown(), ThreadList::OnCall(), ThreadList::OnPop(), ThreadList::OnSPWrite(), avr_op_BRBC::operator()(), avr_op_BRBS::operator()(), avr_op_CALL::operator()(), avr_op_CPSE::operator()(), avr_op_EICALL::operator()(), avr_op_EIJMP::operator()(), avr_op_ICALL::operator()(), avr_op_IJMP::operator()(), avr_op_JMP::operator()(), avr_op_LDS::operator()(), avr_op_RCALL::operator()(), avr_op_RET::operator()(), avr_op_RETI::operator()(), avr_op_RJMP::operator()(), avr_op_SBIC::operator()(), avr_op_SBIS::operator()(), avr_op_SBRC::operator()(), avr_op_SBRS::operator()(), avr_op_STS::operator()(), avr_op_ILLEGAL::operator()(), Reset(), InvalidMem::set(), FlashProgramming::SPM_action(), and Step().
const unsigned int AvrDevice::PC_size |
Definition at line 96 of file avrdevice.h.
Referenced by avr_op_CALL::operator()(), avr_op_ICALL::operator()(), avr_op_RCALL::operator()(), avr_op_RET::operator()(), avr_op_RETI::operator()(), HWStackSram::PopAddr(), and HWStackSram::PushAddr().
AddressExtensionRegister* AvrDevice::rampz |
RAMPZ address extension register.
Definition at line 105 of file avrdevice.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), avr_op_ELPM_Z::operator()(), avr_op_ELPM_Z_incr::operator()(), avr_op_ELPM::operator()(), avr_op_ESPM::operator()(), and avr_op_SPM::operator()().
|
staticprivate |
Definition at line 72 of file avrdevice.h.
Referenced by AvrDevice(), ClearIORegBit(), GetCoreReg(), GetIOReg(), ReplaceIoRegister(), SetCoreReg(), SetIOReg(), and SetIORegBit().
RWMemoryMember** AvrDevice::rw |
The whole memory: R0-R31, IO, Internal RAM.
Definition at line 129 of file avrdevice.h.
Referenced by AvrDevice(), AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), ClearIORegBit(), GetCoreReg(), GetIOReg(), GetMemRegisterInstance(), GetRegX(), GetRegY(), GetRegZ(), GetRWMem(), ReplaceIoRegister(), ReplaceMemRegister(), SetCoreReg(), SetIOReg(), SetIORegBit(), and SetRWMem().
FlashProgramming* AvrDevice::spmRegister |
Definition at line 99 of file avrdevice.h.
Referenced by AvrDevice(), AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), avr_op_ESPM::operator()(), avr_op_SPM::operator()(), and AvrDevice_atmega8::~AvrDevice_atmega8().
HWStack* AvrDevice::stack |
Definition at line 131 of file avrdevice.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), ThreadList::OnCall(), avr_op_CALL::operator()(), avr_op_EICALL::operator()(), avr_op_ICALL::operator()(), avr_op_POP::operator()(), avr_op_PUSH::operator()(), avr_op_RCALL::operator()(), avr_op_RET::operator()(), avr_op_RETI::operator()(), Step(), AvrDevice_at90s4433::~AvrDevice_at90s4433(), AvrDevice_at90s8515::~AvrDevice_at90s8515(), and AvrDevice_atmega8::~AvrDevice_atmega8().
HWSreg* AvrDevice::status |
the status register itself
Definition at line 132 of file avrdevice.h.
Referenced by AvrDevice(), Reset(), and Step().
RWSreg* AvrDevice::statusRegister |
the memory interface for status
Definition at line 133 of file avrdevice.h.
Referenced by AvrDevice(), AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), AvrDevice_attiny2313::AvrDevice_attiny2313(), AvrDevice_attinyX5::AvrDevice_attinyX5(), and Step().
|
staticprivate |
Definition at line 71 of file avrdevice.h.
Referenced by AvrDevice(), GetMemRegisterInstance(), and ReplaceMemRegister().
int AvrDevice::trace_on |
Definition at line 90 of file avrdevice.h.
Referenced by AvrDevice(), HWIrqSystem::ClearIrqFlag(), HWEeprom::CpuCycle(), HWSpi::CpuCycle(), HWAd::CpuCycle(), HWIrqSystem::IrqHandlerFinished(), HWIrqSystem::IrqHandlerStarted(), HWStackSram::Pop(), HWStackSram::Push(), HWEeprom::SetEearh(), HWEeprom::SetEearl(), HWEeprom::SetEecr(), HWEeprom::SetEedr(), HWIrqSystem::SetIrqFlag(), TraceControl::SetNewValueFromUi(), HWStackSram::SetSph(), HWStackSram::SetSpl(), SystemClock::SetTraceModeForAllMembers(), Step(), and HWSpi::trxend().
Pin AvrDevice::v_bandgap |
represents bandgap (ref) voltage level, needed for analog peripherals
Definition at line 113 of file avrdevice.h.
Referenced by HWARef4::GetRefValue(), HWARef8::GetRefValue(), HWAdmuxM8::GetValue(), HWAdmuxM16::GetValue(), HWAdmuxT25::GetValue(), HWAdmuxM2560::GetValue(), and HWAcomp::HWAcomp().
Pin AvrDevice::v_supply |
represents supply voltage level, needed for analog peripherals
Definition at line 112 of file avrdevice.h.
Referenced by HWAd::CpuCycle(), and HWAcomp::HWAcomp().
HWWado* AvrDevice::wado |
WDT timer.
Definition at line 134 of file avrdevice.h.
Referenced by AvrDevice_at90canbase::AvrDevice_at90canbase(), AvrDevice_atmega1284Abase::AvrDevice_atmega1284Abase(), AvrDevice_atmega128base::AvrDevice_atmega128base(), AvrDevice_atmega16_32::AvrDevice_atmega16_32(), AvrDevice_atmega2560base::AvrDevice_atmega2560base(), AvrDevice_atmega668base::AvrDevice_atmega668base(), avr_op_WDR::operator()(), AvrDevice_at90s4433::~AvrDevice_at90s4433(), AvrDevice_at90s8515::~AvrDevice_at90s8515(), and AvrDevice_atmega8::~AvrDevice_atmega8().