44typedef enum : uint64_t {
58typedef enum : uint32_t {
102 return (uint16_t)((uint16_t)1U << (uint16_t)pos);
118 for (
unsigned i = 0U; i < size; ++i) {
119 const uint64_t at = off + (uint64_t)i;
141 for (
unsigned i = 0U; i < size; ++i) {
142 const uint64_t at = off + (uint64_t)i;
190 s_sram.last_cr[bank] = cr;
234 return (uint64_t)
s_sram.esr;
261 s_sram.esr = (uint16_t)value;
266 if ((rel %
sizeof(uint32_t)) == 0U) {
297 if (
s_sram.latch_count == 0U) {
300 (void)
priv_emu_io_errf(
" SRAM-ECC : decoder self-test latches=%u (SRAMESR modeled)\n",
305typedef enum : uint32_t {
Decentralized peripheral-block registry for the board emulator core.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
static RA8_INTERNAL void internal_sram_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the SRAM-control window (width-aware).
static RA8_INTERNAL void internal_sram_shadow_store(uint64_t off, unsigned size, uint64_t value)
Write value (size bytes) into the read-back shadow at off.
static RA8_INTERNAL void internal_sram_reset(void)
Clear all SRAM-controller model state on reset / process start.
static RA8_INTERNAL uint64_t internal_sram_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the SRAM-control window (width-aware).
static RA8_INTERNAL void internal_sram_latch_bank(uint32_t bank)
Latch both ESR slots + EAR for bank (self-test verify reached).
static RA8_INTERNAL void internal_sram_cr_write(uint32_t bank, uint8_t cr)
Detect the self-test bypass->verify CR transition for bank.
static const uint32_t s_k_sram_bank_data_off[k_sram_bank_count]
Per-bank data-window offsets, for a plausible EAR fault address.
sram_order_t
Per-tick order slot for the SRAM-ECC block (relative order).
@ k_sram_block_order
After the VBATT-backup block; report order.
static RA8_INTERNAL void internal_sram_block_register(void)
Register the SRAM-controller block before main (host constructor).
static RA8_INTERNAL uint16_t internal_sram_esr_bit(uint32_t bank, uint32_t slot)
ESR bit for (bank, slot): slot 0 = 1-bit error, slot 1 = 2-bit.
sram_model_t
Self-test phase CR values + ESR/bank layout (no magic numbers).
@ k_sram_cr_mask
SRAMCRn is one byte wide.
@ k_sram_ear_slot_str
EAR stride per slot (32-bit register).
@ k_sram_cr_verify
Self-test verify phase (ECC+check).
@ k_sram_bank_count
SRAM0..SRAM3.
@ k_sram_slots_bank
ESR slots per bank: 0=1-bit, 1=2-bit.
@ k_sram_byte_bits
Bits per byte for width-aware assembly.
@ k_sram_cr_bypass
Self-test bypass phase (TSTBYP=1).
@ k_sram_ear_bank_str
EAR stride per bank (2 slots * 4 bytes).
static RA8_INTERNAL void internal_sram_clear(uint16_t mask)
Clear the ESR / EAR slots named by an SRAMESCLR write mask.
sram_geom_t
SRAM-controller window geometry + register offsets (ra8_sram_regs.h).
@ k_sram_off_esclr
SRAMESCLR error-status clear, 16-bit.
@ k_sram_off_cr3
SRAMCR3 – last per-bank control byte.
@ k_sram_off_ear0
SRAMEAR[0][0]; [bank][slot] at +8b/+4s.
@ k_sram_off_cr0
SRAMCR0 (CRn at 0x10 + 4*bank), 8-bit.
@ k_sram_off_esr
SRAMESR error status, 16-bit.
@ k_sram_span
Covers SRAMPRCR..SRAMEARnm.
static const board_periph_block_t s_k_sram_block
SRAM-controller block descriptor (self-registered with the core).
static RA8_INTERNAL void internal_sram_report(void)
End-of-run SRAM-ECC section: self-test latches observed this run.
static RA8_INTERNAL uint64_t internal_sram_shadow_load(uint64_t off, unsigned size)
Read size bytes from the read-back shadow at off.
static sram_state_t s_sram
Bounded raw-descriptor I/O seam for the RA8 emulator.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
@ k_sram_base
On-chip SRAM start.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
A modelled peripheral block's self-description for the core registry.
SRAM-controller model state (cleared each run / reboot).
uint32_t latch_count
Self-test latches this run (report).
uint16_t esr
Modeled SRAMESR (latch + clear).
uint8_t last_cr[k_sram_bank_count]
Last SRAMCRn write per bank.
uint8_t shadow[k_sram_span]
Read-back store for all plain registers.