24#ifndef __YASIMAVR_CORE_H__
25#define __YASIMAVR_CORE_H__
47#define AVR_BREAK_OPCODE 0x9598
113 NVM_ArchDefined = NVM_CommonCount,
114 NVM_GetCount = 0xFFFF,
122 bool init(
Device& device);
134 void start_interrupt_inhibit(
unsigned int count);
138 void set_direct_LPM_enabled(
bool enabled);
170 void cpu_write_ioreg(
reg_addr_t addr, uint8_t value);
173 uint8_t cpu_read_gpreg(uint8_t reg);
174 void cpu_write_gpreg(uint8_t reg, uint8_t value);
256 std::string m_console_buffer;
263 void write_sreg(uint8_t value);
267 void write_sp(uint16_t sp);
286 m_reg_console = addr;
292 m_direct_LPM = enabled;
AVR core generic model.
Definition sim_core.h:96
uint8_t * m_sram
Pointer to the array representing the device RAM memory.
Definition sim_core.h:155
Core & operator=(const Core &)=delete
virtual uint8_t cpu_read_data(mem_addr_t data_addr)=0
virtual void cpu_write_data(mem_addr_t data_addr, uint8_t value)=0
void set_console_register(reg_addr_t addr)
Definition sim_core.h:284
NonVolatileMemory m_fuses
Non-volatile memory model for the fuse bits.
Definition sim_core.h:159
const CoreConfiguration & m_config
Reference to the configuration structure, set at construction.
Definition sim_core.h:147
NVM
Definition sim_core.h:109
@ NVM_Fuses
Definition sim_core.h:111
@ NVM_CommonCount
Definition sim_core.h:112
@ NVM_Flash
Definition sim_core.h:110
virtual void dbg_read_data(mem_addr_t start, uint8_t *buf, mem_addr_t len)=0
bool use_extended_addressing() const
Definition sim_core.h:207
Device * m_device
Pointer to the device, set by init()
Definition sim_core.h:149
std::vector< IORegister * > m_ioregs
Array of the I/O registers.
Definition sim_core.h:153
const CoreConfiguration & config() const
Definition sim_core.h:279
DeviceDebugProbe * m_debug_probe
Pointer to the generic debug probe.
Definition sim_core.h:165
virtual void dbg_write_data(mem_addr_t start, const uint8_t *buf, mem_addr_t len)=0
unsigned int m_int_inhib_counter
Counter to inhibit interrupts for a given number of instructions.
Definition sim_core.h:163
Core(const Core &)=delete
void set_direct_LPM_enabled(bool enabled)
Definition sim_core.h:290
MemorySectionManager * m_section_manager
Definition sim_core.h:166
flash_addr_t m_pc
Program Counter register, expressed in bytes (unlike the actual device PC)
Definition sim_core.h:161
NonVolatileMemory m_flash
Non-volatile memory model for the flash.
Definition sim_core.h:157
Definition sim_debug.h:42
Basic AVR device model.
Definition sim_device.h:61
Definition sim_firmware.h:53
Definition sim_ioreg.h:116
Generic interrupt controller.
Definition sim_interrupt.h:75
Memory section management.
Definition sim_memory.h:124
Non-volatile memory model.
Definition sim_memory.h:42
Representation of a I/O register address, with validity state.
Definition sim_types.h:60
@ SREG_Z
Definition sim_core.h:52
@ SREG_V
Definition sim_core.h:54
@ SREG_H
Definition sim_core.h:56
@ SREG_C
Definition sim_core.h:51
@ SREG_T
Definition sim_core.h:57
@ SREG_N
Definition sim_core.h:53
@ SREG_S
Definition sim_core.h:55
@ SREG_I
Definition sim_core.h:58
@ R_ZL
Definition sim_core.h:63
@ R_YL
Definition sim_core.h:63
@ R_YH
Definition sim_core.h:63
@ R_XL
Definition sim_core.h:63
@ R_Z
Definition sim_core.h:66
@ R_Y
Definition sim_core.h:65
@ R_SPH
Definition sim_core.h:68
@ R_SREG
Definition sim_core.h:70
@ R_SPL
Definition sim_core.h:68
@ R_X
Definition sim_core.h:64
@ R_XH
Definition sim_core.h:63
@ R_ZH
Definition sim_core.h:63
#define YASIMAVR_BEGIN_NAMESPACE
Definition sim_globals.h:58
#define AVR_CORE_PUBLIC_API
Definition sim_globals.h:46
#define YASIMAVR_END_NAMESPACE
Definition sim_globals.h:59
unsigned long flash_addr_t
Definition sim_types.h:42
unsigned long mem_addr_t
Definition sim_types.h:41
YASIMAVR_BEGIN_NAMESPACE typedef long long cycle_count_t
Definition sim_types.h:40
Definition sim_config.h:37
uint32_t attributes
Definition sim_config.h:46
@ ExtendedAddressing
Definition sim_config.h:41
Bit mask structure for bitwise operations on 8-bits registers.
Definition sim_types.h:86
Breakpoint structure.
Definition sim_core.h:78
flash_addr_t addr
Address in code space of the breakpoint (where the BREAK instruction is inserted)
Definition sim_core.h:80
uint8_t instr_len
Length in bytes of the instruction replaced.
Definition sim_core.h:84
uint8_t instr[4]
Instruction replaced by the BREAK (up to 32-bits long)
Definition sim_core.h:82