38typedef enum : uint32_t {
45typedef enum : uint64_t {
55typedef enum : uint32_t {
61typedef enum : uint32_t {
70typedef enum : uint32_t {
77typedef enum : uint32_t {
83typedef enum : uint32_t {
112 crc ^= (uint32_t)
byte;
113 for (uint32_t i = 0U; i < 8U; i++) {
114 crc = ((crc & 1U) != 0U) ? ((crc >> 1) ^ poly) : (crc >> 1);
136 const uint32_t top = 1U << (width - 1U);
137 const uint32_t msk = (width >= 32U) ? (uint32_t)
k_u32_all : ((1U << width) - 1U);
138 crc ^= (uint32_t)
byte << (width - 8U);
139 for (uint32_t i = 0U; i < 8U; i++) {
140 const bool set = (crc & top) != 0U;
141 crc = (crc << 1) & msk;
215 const uint64_t off = addr - (uint64_t)
k_crc_base;
224 const uint32_t shift = (uint32_t)(off - (uint64_t)
k_crc_off_dor) * 8U;
225 return (uint64_t)(
s_crc.dor >> shift);
246 const uint64_t off = addr - (uint64_t)
k_crc_base;
248 s_crc.cr0 = (uint8_t)value;
255 s_crc.cr1 = (uint8_t)value;
265 }
else if (size == 0U) {
268 for (
unsigned i = 0U; i < n; i++) {
276 s_crc.dor = (uint32_t)value;
278 const uint32_t shift = (uint32_t)(off - (uint64_t)
k_crc_off_dor) * 8U;
280 s_crc.dor = (
s_crc.dor & ~mask) | (((uint32_t)value << shift) & mask);
295 if (
s_crc.bytes == 0U) {
@ k_u16_mask
16-bit field.
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.
crc_gps_t
GPS polynomial encodings (CRCCR0.GPS).
@ k_crc_gps_ccitt
CRC-CCITT (X^16+X^12+X^5+1).
@ k_crc_gps_16
CRC-16 (X^16+X^15+X^2+1).
@ k_crc_gps_8
CRC-8 (X^8+X^2+X+1).
@ k_crc_gps_32c
CRC-32C (Castagnoli).
@ k_crc_gps_32
CRC-32 (IEEE 802.3).
static RA8_INTERNAL void internal_crc_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the CRC window.
static RA8_INTERNAL void internal_crc_block_register(void)
Register the CRC block before main (host constructor).
static RA8_INTERNAL uint32_t internal_crc_step_reflected(uint32_t crc, uint8_t byte, uint32_t poly)
Fold one byte into a reflected (LSB-first) CRC of any width.
crc_map_t
CRC block geometry (ra8_crc_regs.h).
@ k_crc_off_dor
CRCDOR result (32b).
@ k_crc_off_cr0
CRCCR0 (GPS/LMS/DORCLR), 8b.
@ k_crc_base
CRC base (HUM Ch 48).
@ k_crc_span
Register window.
@ k_crc_off_dir
CRCDIR / CRCDIR_BY data in.
@ k_crc_off_cr1
CRCCR1 (snoop), 8b.
static RA8_INTERNAL void internal_crc_fold_byte(uint8_t byte)
Fold one input byte into CRCDOR using the CRCCR0.GPS polynomial.
static RA8_INTERNAL void internal_crc_report(void)
End-of-run CRC section: last result + bytes folded.
static RA8_INTERNAL void internal_crc_reset(void)
Reset the CRC unit to power-on state.
static RA8_INTERNAL uint64_t internal_crc_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the CRC window.
crc_poly_refl_t
Reflected (LSB-first) polynomials for the reflected GPS modes.
@ k_crc_poly_16_refl
Reflected 0x8005.
@ k_crc_poly_32c_refl
Reflected 0x1EDC6F41.
@ k_crc_poly_32_refl
Reflected 0x04C11DB7.
crc_order_t
Per-tick order slot for the CRC block (relative order only).
@ k_crc_block_order
After the existing blocks; report order.
crc_lit_t
Bit-width masks for the CRC unit model.
@ k_u32_all
32-bit all-ones.
static const board_periph_block_t s_k_crc_block
CRC block descriptor (self-registered with the core).
crc_poly_fwd_t
MSB-first polynomials for the non-reflected GPS modes.
@ k_crc_poly_ccitt_fwd
CRC-CCITT.
@ k_crc_poly_8_fwd
CRC-8 X^8+X^2+X+1.
crc_cr0_field_t
CRCCR0 fields (ra8_crc_regs.h).
@ k_crc_gps_mask
GPS[2:0] polynomial select.
@ k_crc_dorclr
DORCLR: clear CRCDOR (bit 7).
static RA8_INTERNAL uint32_t internal_crc_step_forward(uint32_t crc, uint8_t byte, uint32_t poly, uint32_t width)
Fold one byte into an MSB-first CRC of width bits.
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.
#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.
uint32_t dor
CRCDOR running remainder.
uint8_t cr0
CRCCR0 shadow (GPS/LMS/DORCLR).
uint8_t cr1
CRCCR1 shadow.
uint32_t bytes
Bytes folded since reset.