simulavr  1.1.0
AvrDevice_atmega668base Class Reference

#include <atmega668base.h>

Inheritance diagram for AvrDevice_atmega668base:

Public Member Functions

 AvrDevice_atmega668base (unsigned ram_bytes, unsigned flash_bytes, unsigned ee_bytes)
 
 ~AvrDevice_atmega668base ()
 
- Public Member Functions inherited from AvrDevice
 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 *)
 
RWMemoryMemberGetMemRegisterInstance (unsigned int offset)
 
void RegisterTerminationSymbol (const char *symbol)
 
PinGetPin (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...
 
- Public Member Functions inherited from SimulationMember
virtual ~SimulationMember ()
 
- Public Member Functions inherited from TraceValueRegister
 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...
 
TraceValueRegisterGetScopeGroupByName (const std::string &name)
 Get a here registered TraceValueRegister by it's name. More...
 
virtual TraceValueGetTraceValueByName (const std::string &name)
 Get a here registered TraceValue by it's name. More...
 
TraceValueRegisterFindScopeGroupByName (const std::string &name)
 Seek for a TraceValueRegister by it's name. More...
 
TraceValueFindTraceValueByName (const std::string &name)
 Seek for a TraceValue by it's name. More...
 
TraceSetGetAllTraceValues (void)
 Get all here registered TraceValue's only (not with descending values) More...
 
TraceSetGetAllTraceValuesRecursive (void)
 Get all here registered TraceValue's with descending values. More...
 

Protected Attributes

Pin adc6
 adc channel 6 input pin More...
 
Pin adc7
 adc channel 7 input pin More...
 
HWPort portb
 port B More...
 
HWPort portc
 port C More...
 
HWPort portd
 port D More...
 
IOSpecialReg gtccr_reg
 GTCCR IO register. More...
 
IOSpecialReg assr_reg
 ASSR IO register. More...
 
HWPrescaler prescaler01
 prescaler unit for timer 0 and 1 More...
 
HWPrescalerAsync prescaler2
 prescaler unit for timer 2 More...
 
PrescalerMultiplexerExt premux0
 prescaler multiplexer for timer 0 More...
 
PrescalerMultiplexerExt premux1
 prescaler multiplexer for timer 1 More...
 
PrescalerMultiplexer premux2
 prescaler multiplexer for timer 2 More...
 
ExternalIRQHandlerextirq01
 external interrupt support for INT0, INT1 More...
 
IOSpecialRegeicra_reg
 EICRA IO register. More...
 
IOSpecialRegeimsk_reg
 EIMSK IO register. More...
 
IOSpecialRegeifr_reg
 EIFR IO register. More...
 
ExternalIRQHandlerextirqpc
 external interrupt support for PCINT[0-2] More...
 
IOSpecialRegpcicr_reg
 PCICR IO register. More...
 
IOSpecialRegpcifr_reg
 PCIFR IO register. More...
 
IOSpecialRegpcmsk0_reg
 PCIMSK0 IO register. More...
 
IOSpecialRegpcmsk1_reg
 PCIMSK1 IO register. More...
 
IOSpecialRegpcmsk2_reg
 PCIMSK2 IO register. More...
 
HWAdmuxadmux
 adc multiplexer unit More...
 
HWARefaref
 ADC reference unit. More...
 
HWAdad
 adc unit More...
 
HWAcompacomp
 analog compare unit More...
 
HWSpispi
 spi unit More...
 
HWUsartusart0
 usart 0 unit More...
 
TimerIRQRegistertimerIrq0
 timer interrupt unit for timer 0 More...
 
HWTimer8_2Ctimer0
 timer 0 unit More...
 
ICaptureSourceinputCapture1
 input capture source for timer1 More...
 
TimerIRQRegistertimerIrq1
 timer interrupt unit for timer 1 More...
 
HWTimer16_2C3timer1
 timer 1 unit More...
 
TimerIRQRegistertimerIrq2
 timer interrupt unit for timer 2 More...
 
HWTimer8_2Ctimer2
 timer 2 unit More...
 
GPIORegistergpior0_reg
 general purpose IO register More...
 
GPIORegistergpior1_reg
 general purpose IO register More...
 
GPIORegistergpior2_reg
 general purpose IO register More...
 
CLKPRRegisterclkpr_reg
 CLKPR IO register. More...
 
OSCCALRegisterosccal_reg
 OSCCAL IO register. More...
 
- Protected Attributes inherited from AvrDevice
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...
 

Additional Inherited Members

- Public Attributes inherited from AvrDevice
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...
 
AvrFlashFlash
 
FlashProgrammingspmRegister
 
AvrFusesfuses
 
AvrLockBitslockbits
 
HWEepromeeprom
 
Datadata
 a hack for symbol look-up More...
 
HWIrqSystemirqSystem
 
AddressExtensionRegisterrampz
 RAMPZ address extension register. More...
 
AddressExtensionRegistereind
 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...
 
HWStackstack
 
HWSregstatus
 the status register itself More...
 
RWSregstatusRegister
 the memory interface for status More...
 
HWWadowado
 WDT timer. More...
 
std::vector< Hardware * > hwResetList
 
std::vector< Hardware * > hwCycleList
 
DumpManagerdumpManager
 
- Protected Member Functions inherited from TraceValueRegister
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...
 

Detailed Description

AVRDevice class for ATMega48/88/168/328

Todo:
This device isn't completely implemented. There is no boot loader section support for >= ATMega88, only normal interrupt vector start address supported, incomplete usart registers (and maybe more ...)

Definition at line 42 of file atmega668base.h.

Constructor & Destructor Documentation

◆ AvrDevice_atmega668base()

AvrDevice_atmega668base::AvrDevice_atmega668base ( unsigned  ram_bytes,
unsigned  flash_bytes,
unsigned  ee_bytes 
)

Creates the device for ATMega48/88/168/328

Parameters
ram_byteshow much SRAM does the device own
flash_byteshow much flash memory does the device own
ee_byteshow much EEPROM space does the device own

Definition at line 74 of file atmega668base.cpp.

References acomp, HWAcomp::acsr_reg, ad, HWAd::AD_M48, adc6, adc7, NotSimulatedRegister::ADC_DIDR0, NotSimulatedRegister::ADC_DIDR1, HWAd::adch_reg, HWAd::adcl_reg, HWAd::adcsra_reg, HWAd::adcsrb_reg, admux, HWAd::admux_reg, aref, assr_reg, clkpr_reg, AvrDevice::coreTraceGroup, HWPort::ddr_reg, HWEeprom::DEVMODE_EXTENDED, HWEeprom::eearh_reg, HWEeprom::eearl_reg, HWEeprom::eecr_reg, HWEeprom::eedr_reg, AvrDevice::eeprom, eicra_reg, eifr_reg, eimsk_reg, extirq01, extirqpc, AvrDevice::flagJMPInstructions, AvrDevice::fuses, TimerIRQRegister::getLine(), HWPort::GetPin(), AvrDevice::GetPin(), NotSimulatedRegister::getRegister(), gpior0_reg, gpior1_reg, gpior2_reg, gtccr_reg, HWTimer16::icr_h_reg, HWTimer16::icr_l_reg, inputCapture1, AvrDevice::irqSystem, NotSimulatedRegister::MCU_MCUCR, NotSimulatedRegister::MCU_MCUSR, NotSimulatedRegister::MCU_PRR, NotSimulatedRegister::MCU_SMCR, NotSimulatedRegister::MCU_WDTCSR, HWTimer16::ocra_h_reg, HWTimer16::ocra_l_reg, HWTimer8::ocra_reg, HWTimer16::ocrb_h_reg, HWTimer16::ocrb_l_reg, HWTimer8::ocrb_reg, osccal_reg, OSCCALRegister::OSCCAL_V5, pcicr_reg, pcifr_reg, pcmsk0_reg, pcmsk1_reg, pcmsk2_reg, HWPort::pin_reg, HWPort::port_reg, portb, portc, portd, premux0, premux1, premux2, HWARef4::REFTYPE_BG4, ExternalIRQHandler::registerIrq(), TimerIRQRegister::registerLine(), AvrDevice::RegisterPin(), AvrDevice::Reset(), AvrDevice::rw, AvrFuses::SetBootloaderConfig(), AvrFuses::SetFuseConfiguration(), HWSpi::spcr_reg, HWSpi::spdr_reg, spi, FlashProgramming::SPM_MEGA_MODE, FlashProgramming::spmcr_reg, AvrDevice::spmRegister, HWSpi::spsr_reg, AvrDevice::stack, AvrDevice::statusRegister, HWTimer8_2C::tccra_reg, HWTimer16_2C3::tccra_reg, HWTimer8_2C::tccrb_reg, HWTimer16_2C3::tccrb_reg, HWTimer16_2C3::tccrc_reg, HWTimer16::tcnt_h_reg, HWTimer16::tcnt_l_reg, HWTimer8::tcnt_reg, TimerIRQRegister::tifr_reg, timer0, timer1, timer2, timerIrq0, timerIrq1, timerIrq2, TimerIRQRegister::timsk_reg, NotSimulatedRegister::TWI_TWAMR, NotSimulatedRegister::TWI_TWAR, NotSimulatedRegister::TWI_TWBR, NotSimulatedRegister::TWI_TWCR, NotSimulatedRegister::TWI_TWDR, NotSimulatedRegister::TWI_TWSR, HWUart::ubrr_reg, HWUart::ubrrhi_reg, HWUart::ucsra_reg, HWUart::ucsrb_reg, HWUsart::ucsrc_reg, HWUart::udr_reg, usart0, and AvrDevice::wado.

◆ ~AvrDevice_atmega668base()

AvrDevice_atmega668base::~AvrDevice_atmega668base ( )

Definition at line 38 of file atmega668base.cpp.

Member Data Documentation

◆ acomp

HWAcomp* AvrDevice_atmega668base::acomp
protected

analog compare unit

Definition at line 70 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ ad

HWAd* AvrDevice_atmega668base::ad
protected

adc unit

Definition at line 69 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ adc6

Pin AvrDevice_atmega668base::adc6
protected

adc channel 6 input pin

Definition at line 45 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ adc7

Pin AvrDevice_atmega668base::adc7
protected

adc channel 7 input pin

Definition at line 46 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ admux

HWAdmux* AvrDevice_atmega668base::admux
protected

adc multiplexer unit

Definition at line 67 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ aref

HWARef* AvrDevice_atmega668base::aref
protected

ADC reference unit.

Definition at line 68 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ assr_reg

IOSpecialReg AvrDevice_atmega668base::assr_reg
protected

ASSR IO register.

Definition at line 51 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ clkpr_reg

CLKPRRegister* AvrDevice_atmega668base::clkpr_reg
protected

CLKPR IO register.

Definition at line 83 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ eicra_reg

IOSpecialReg* AvrDevice_atmega668base::eicra_reg
protected

EICRA IO register.

Definition at line 58 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ eifr_reg

IOSpecialReg* AvrDevice_atmega668base::eifr_reg
protected

EIFR IO register.

Definition at line 60 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ eimsk_reg

IOSpecialReg* AvrDevice_atmega668base::eimsk_reg
protected

EIMSK IO register.

Definition at line 59 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ extirq01

ExternalIRQHandler* AvrDevice_atmega668base::extirq01
protected

external interrupt support for INT0, INT1

Definition at line 57 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ extirqpc

ExternalIRQHandler* AvrDevice_atmega668base::extirqpc
protected

external interrupt support for PCINT[0-2]

Definition at line 61 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ gpior0_reg

GPIORegister* AvrDevice_atmega668base::gpior0_reg
protected

general purpose IO register

Definition at line 80 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ gpior1_reg

GPIORegister* AvrDevice_atmega668base::gpior1_reg
protected

general purpose IO register

Definition at line 81 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ gpior2_reg

GPIORegister* AvrDevice_atmega668base::gpior2_reg
protected

general purpose IO register

Definition at line 82 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ gtccr_reg

IOSpecialReg AvrDevice_atmega668base::gtccr_reg
protected

GTCCR IO register.

Definition at line 50 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ inputCapture1

ICaptureSource* AvrDevice_atmega668base::inputCapture1
protected

input capture source for timer1

Definition at line 75 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ osccal_reg

OSCCALRegister* AvrDevice_atmega668base::osccal_reg
protected

OSCCAL IO register.

Definition at line 84 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ pcicr_reg

IOSpecialReg* AvrDevice_atmega668base::pcicr_reg
protected

PCICR IO register.

Definition at line 62 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ pcifr_reg

IOSpecialReg* AvrDevice_atmega668base::pcifr_reg
protected

PCIFR IO register.

Definition at line 63 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ pcmsk0_reg

IOSpecialReg* AvrDevice_atmega668base::pcmsk0_reg
protected

PCIMSK0 IO register.

Definition at line 64 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ pcmsk1_reg

IOSpecialReg* AvrDevice_atmega668base::pcmsk1_reg
protected

PCIMSK1 IO register.

Definition at line 65 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ pcmsk2_reg

IOSpecialReg* AvrDevice_atmega668base::pcmsk2_reg
protected

PCIMSK2 IO register.

Definition at line 66 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ portb

HWPort AvrDevice_atmega668base::portb
protected

port B

Definition at line 47 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ portc

HWPort AvrDevice_atmega668base::portc
protected

port C

Definition at line 48 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ portd

HWPort AvrDevice_atmega668base::portd
protected

port D

Definition at line 49 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ premux0

PrescalerMultiplexerExt AvrDevice_atmega668base::premux0
protected

prescaler multiplexer for timer 0

Definition at line 54 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ premux1

PrescalerMultiplexerExt AvrDevice_atmega668base::premux1
protected

prescaler multiplexer for timer 1

Definition at line 55 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ premux2

PrescalerMultiplexer AvrDevice_atmega668base::premux2
protected

prescaler multiplexer for timer 2

Definition at line 56 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ prescaler01

HWPrescaler AvrDevice_atmega668base::prescaler01
protected

prescaler unit for timer 0 and 1

Definition at line 52 of file atmega668base.h.

◆ prescaler2

HWPrescalerAsync AvrDevice_atmega668base::prescaler2
protected

prescaler unit for timer 2

Definition at line 53 of file atmega668base.h.

◆ spi

HWSpi* AvrDevice_atmega668base::spi
protected

spi unit

Definition at line 71 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ timer0

HWTimer8_2C* AvrDevice_atmega668base::timer0
protected

timer 0 unit

Definition at line 74 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ timer1

HWTimer16_2C3* AvrDevice_atmega668base::timer1
protected

timer 1 unit

Definition at line 77 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ timer2

HWTimer8_2C* AvrDevice_atmega668base::timer2
protected

timer 2 unit

Definition at line 79 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ timerIrq0

TimerIRQRegister* AvrDevice_atmega668base::timerIrq0
protected

timer interrupt unit for timer 0

Definition at line 73 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ timerIrq1

TimerIRQRegister* AvrDevice_atmega668base::timerIrq1
protected

timer interrupt unit for timer 1

Definition at line 76 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ timerIrq2

TimerIRQRegister* AvrDevice_atmega668base::timerIrq2
protected

timer interrupt unit for timer 2

Definition at line 78 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().

◆ usart0

HWUsart* AvrDevice_atmega668base::usart0
protected

usart 0 unit

Definition at line 72 of file atmega668base.h.

Referenced by AvrDevice_atmega668base().


The documentation for this class was generated from the following files: