SimAVR
AVR Simulator
|
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "logging.h"
#include "avr_flash.h"
#include "avr_watchdog.h"
#include "sim_avr.h"
#include "sim_core.h"
#include "sim_gdb.h"
Macros | |
#define | T(w) |
#define | REG_TOUCH(a, r) |
#define | STATE(_f, args...) |
#define | SREG() |
#define | get_d5(o) const uint8_t d = (o >> 4) & 0x1f; |
#define | get_vd5(o) |
#define | get_r5(o) const uint8_t r = ((o >> 5) & 0x10) | (o & 0xf); |
#define | get_d5_a6(o) |
#define | get_vd5_s3(o) |
#define | get_vd5_s3_mask(o) |
#define | get_vd5_vr5(o) |
#define | get_d5_vr5(o) |
#define | get_h4_k8(o) |
#define | get_vh4_k8(o) |
#define | get_d5_q6(o) |
#define | get_io5(o) const uint8_t io = ((o >> 3) & 0x1f) + 32; |
#define | get_io5_b3(o) |
#define | get_io5_b3mask(o) |
#define | get_o12(op) const int16_t o = ((int16_t)((op << 4) & 0xffff)) >> 3; |
#define | get_vp2_k6(o) |
#define | get_sreg_bit(o) const uint8_t b = (o >> 4) & 7; |
#define | TRACE_JUMP() |
#define | STACK_FRAME_PUSH() |
#define | STACK_FRAME_POP() |
Functions | |
static uint16_t | _avr_read_instruction (avr_t *avr, avr_flashaddr_t pc) |
Read the instruction in flash memory at given pc. More... | |
void | crash (avr_t *avr) |
void | avr_core_watch_write (avr_t *avr, uint16_t addr, uint8_t v) |
These are accessors for avr->data but allows watchpoints to be set for gdb IO modules use that to set values to registers, and the AVR core decoder uses that to register "public" read by instructions. More... | |
uint8_t | avr_core_watch_read (avr_t *avr, uint16_t addr) |
static void | _avr_set_r (avr_t *avr, uint16_t r, uint8_t v) |
uint16_t | _avr_sp_get (avr_t *avr) |
Stack pointer access. More... | |
void | _avr_sp_set (avr_t *avr, uint16_t sp) |
static void | _avr_set_ram (avr_t *avr, uint16_t addr, uint8_t v) |
Set any address to a value; split between registers and SRAM. More... | |
static uint8_t | _avr_get_ram (avr_t *avr, uint16_t addr) |
Get a value from SRAM. More... | |
static void | _avr_push8 (avr_t *avr, uint16_t v) |
Stack push accessors. More... | |
static uint8_t | _avr_pop8 (avr_t *avr) |
int | _avr_push_addr (avr_t *avr, avr_flashaddr_t addr) |
avr_flashaddr_t | _avr_pop_addr (avr_t *avr) |
const char * | avr_regname (uint8_t reg) |
static void | _avr_invalid_opcode (avr_t *avr) |
Called when an invalid opcode is decoded. More... | |
static void | _avr_flags_zns (struct avr_t *avr, uint8_t res) |
static void | _avr_flags_zns16 (struct avr_t *avr, uint16_t res) |
static void | _avr_flags_add_zns (struct avr_t *avr, uint8_t res, uint8_t rd, uint8_t rr) |
static void | _avr_flags_sub_zns (struct avr_t *avr, uint8_t res, uint8_t rd, uint8_t rr) |
static void | _avr_flags_Rzns (struct avr_t *avr, uint8_t res) |
static void | _avr_flags_sub_Rzns (struct avr_t *avr, uint8_t res, uint8_t rd, uint8_t rr) |
static void | _avr_flags_zcvs (struct avr_t *avr, uint8_t res, uint8_t vr) |
static void | _avr_flags_zcnvs (struct avr_t *avr, uint8_t res, uint8_t vr) |
static void | _avr_flags_znv0s (struct avr_t *avr, uint8_t res) |
static int | _avr_is_instruction_32_bits (avr_t *avr, avr_flashaddr_t pc) |
avr_flashaddr_t | avr_run_one (avr_t *avr) |
Instruction decoder, run ONE instruction. More... | |
Variables | |
const char * | _sreg_bit_name = "cznvshti" |
const char * | reg_names [255] |
"Pretty" register names More... | |
#define get_d5 | ( | o | ) | const uint8_t d = (o >> 4) & 0x1f; |
#define get_d5_a6 | ( | o | ) |
#define get_d5_q6 | ( | o | ) |
#define get_d5_vr5 | ( | o | ) |
#define get_h4_k8 | ( | o | ) |
#define get_io5 | ( | o | ) | const uint8_t io = ((o >> 3) & 0x1f) + 32; |
#define get_io5_b3 | ( | o | ) |
#define get_io5_b3mask | ( | o | ) |
#define get_o12 | ( | op | ) | const int16_t o = ((int16_t)((op << 4) & 0xffff)) >> 3; |
#define get_r5 | ( | o | ) | const uint8_t r = ((o >> 5) & 0x10) | (o & 0xf); |
#define get_sreg_bit | ( | o | ) | const uint8_t b = (o >> 4) & 7; |
#define get_vd5 | ( | o | ) |
#define get_vd5_s3 | ( | o | ) |
#define get_vd5_s3_mask | ( | o | ) |
#define get_vd5_vr5 | ( | o | ) |
#define get_vh4_k8 | ( | o | ) |
#define get_vp2_k6 | ( | o | ) |
#define REG_TOUCH | ( | a, | |
r | |||
) |
#define SREG | ( | ) |
#define STACK_FRAME_POP | ( | ) |
#define STACK_FRAME_PUSH | ( | ) |
#define STATE | ( | _f, | |
args... | |||
) |
#define T | ( | w | ) |
#define TRACE_JUMP | ( | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
Get a value from SRAM.
|
static |
Called when an invalid opcode is decoded.
|
inlinestatic |
|
inlinestatic |
avr_flashaddr_t _avr_pop_addr | ( | avr_t * | avr | ) |
|
inlinestatic |
Stack push accessors.
|
inlinestatic |
Read the instruction in flash memory at given pc.
|
inlinestatic |
|
inlinestatic |
Set any address to a value; split between registers and SRAM.
const char* avr_regname | ( | uint8_t | reg | ) |
void crash | ( | avr_t * | avr | ) |
const char* _sreg_bit_name = "cznvshti" |
const char* reg_names[255] |
"Pretty" register names