71typedef enum : uint64_t {
87typedef enum : uint32_t {
101typedef enum : uint32_t {
120typedef enum : uint32_t {
135typedef enum : uint32_t {
148typedef enum : uint32_t {
160typedef enum : uint32_t {
171typedef enum : uint8_t {
225 return (uint32_t)(off >> 2U);
259 const uint64_t lo_off =
280 if (
emu_mem_read(uc, addr, b,
sizeof(b)) != UC_ERR_OK) {
287 for (uint32_t i = 0U; i <
sizeof(b); ++i) {
288 *out |= (uint32_t)b[i] << (i * 8U);
342 const bool bad_region =
345 if (bad_region || bad_count) {
376 if (done >= c->
count) {
379 uint32_t n = c->
count - done;
383 if (
emu_mem_read(uc, src + done, buf, n) != UC_ERR_OK) {
387 for (uint32_t i = 0U; i < n; i++) {
394 for (uint32_t i = 0U; i < n; i++) {
430 "NPU %s r%u->r%u %uB check=0x%08X",
462 if ((src == 0U) || (dst == 0U)) {
518 const uint64_t off = addr - (uint64_t)
k_npu_base;
527 return (uint64_t)
s_npu.status;
548 const uint64_t off = addr - (uint64_t)
k_npu_base;
586 if ((
s_npu.jobs == 0U) && (
s_npu.faults == 0U)) {
587 if ((
s_npu.reads != 0U) || (
s_npu.writes != 0U)) {
588 (void)
priv_emu_io_errf(
" NPU(Ethos-U55): window touched r=%u w=%u -- no job kicked\n",
594 (void)
priv_emu_io_errf(
" NPU(Ethos-U55): jobs=%u faults=%u last=%s bytes=%u check=0x%08X"
595 " (ra8_emulator stand-in, not Vela)\n",
Multi-channel console log store backing the board view's tabbed console.
void board_console_push(board_console_ch_t ch, const char *line)
Append one completed line to a channel ring and the ALL ring.
@ k_board_console_ch_dma
DMAC + DTC transfer-complete summaries.
Decentralized peripheral-block registry for the board emulator core.
void board_periph_icu_raise_event(uc_engine *uc, uint16_t event)
Raise a peripheral ELC event through the core's ICU -> NVIC path.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
@ k_board_block_dev_ra8p1
RA8P1-only (Ethos-U55 NPU).
static RA8_INTERNAL uint64_t internal_npu_reg64(uint64_t lo_off)
Assemble the 64-bit value of a lo/hi shadow-register pair.
npu_misc_t
NPU interrupt event number and this block's report/tick order slot.
@ k_npu_event_irq
NPU_IRQ ELC/ICU event (RA8P1 elc_event_t).
@ k_npu_block_order
Report/tick order slot (relative only).
static RA8_INTERNAL bool internal_npu_apply(uc_engine *uc, const npu_cmd_t *c, uint64_t src, uint64_t dst, uint32_t *out_check)
Apply the op to the arenas; fold the output into a checkword (bool ok).
npu_bit_t
NPU_CMD / NPU_STATUS bit positions (mirror ra8_npu_regs.h).
@ k_npu_status_buserr_bit
STATUS.bus_error (AXI fault).
@ k_npu_cmd_run_bit
CMD.transition_to_running_state (start).
@ k_npu_status_reset_bit
STATUS.reset (reset in progress).
@ k_npu_status_irq_bit
STATUS.irq_raised.
@ k_npu_cmd_clear_irq_bit
CMD.clear_irq (write 1 to acknowledge).
@ k_npu_status_state_bit
STATUS.state (1 = running).
@ k_npu_status_cmdend_bit
STATUS.cmd_end (stream fully consumed).
@ k_npu_status_parse_bit
STATUS.cmd_parse (parse error).
static RA8_INTERNAL void internal_npu_reset(void)
Clear the NPU model to power-on state.
static RA8_INTERNAL bool internal_npu_guest_word(uc_engine *uc, uint64_t addr, uint32_t *out)
Read one little-endian 32-bit word from guest memory (bool ok).
static RA8_INTERNAL void internal_npu_fault(uint32_t status_bit)
Latch a STATUS fault bit and stop the engine (honest: no fake done).
static const uint32_t s_npu_id
Composited Ethos-U55 NPU_ID (arch 1.0.6, product 0 = U55).
static RA8_INTERNAL const char * internal_npu_op_name(uint32_t op)
Human label for a fake opcode (report / console).
npu_dec_t
Result of decoding one submitted command stream.
@ k_npu_dec_parse
Bad magic / field: real-Vela or malformed.
@ k_npu_dec_ok
Recognised fake program; fields valid.
@ k_npu_dec_bus
Guest-memory read of the stream failed.
npu_map_t
Ethos-U55 NPU register-window geometry (mirrors ra8_npu_regs.h).
@ k_npu_off_basep0
BASEP0[31:0] (region 0 AXI base).
@ k_npu_base
R_NPU register-window base (Ethos-U55).
@ k_npu_words
Backing-store word count.
@ k_npu_off_qbase
QBASE[31:0] (cmd-stream address).
@ k_npu_off_status
NPU_STATUS (state + fault flags).
@ k_npu_off_reset
NPU_RESET (software reset).
@ k_npu_off_qsize
QSIZE (cmd-stream length bytes).
@ k_npu_off_cmd
NPU_CMD (run / clear-irq).
@ k_npu_span
4 KiB register window.
@ k_npu_off_id
NPU_ID (Arm arch id/revision).
npu_geom_t
Ethos-U55 64-bit-register geometry + region count (mirrors ra8_npu_regs.h).
@ k_npu_basep_stride
Bytes between BASEPn pairs (lo + hi).
@ k_npu_region_count
BASEP0..7 region base-pointer pairs.
@ k_npu_addr_hi_pos
uint64 address -> high 32 bits.
@ k_npu_reg_hi_off
Low->high word gap in a 64-bit register.
npu_id_pos_t
NPU_ID field positions in the Ethos-U55 id register.
@ k_npu_id_arch_major_pos
id[31:28] arch_major_rev.
@ k_npu_id_product_pos
id[15:12] product_major (0 = U55).
@ k_npu_id_arch_patch_pos
id[19:16] arch_patch_rev.
@ k_npu_id_arch_minor_pos
id[27:20] arch_minor_rev.
static RA8_INTERNAL void internal_npu_execute(uc_engine *uc)
Run one submitted job: decode -> execute -> latch STATUS + IRQ.
npu_id_val_t
NPU_ID field values for the Ethos-U55.
@ k_npu_id_arch_minor
arch minor revision.
@ k_npu_id_product_u55
product_major: 0 = Ethos-U55.
@ k_npu_id_arch_patch
arch patch revision.
@ k_npu_id_arch_major
arch major revision.
static RA8_INTERNAL uint64_t internal_npu_region_base(uint32_t idx)
AXI base programmed into BASEPidx (0 if unprogrammed).
npu_exec_const_t
Stand-in "execution" bounds + checkword constants (deterministic).
@ k_npu_max_chunks
k_ra8_npu_fake_max_bytes / chunk (bound).
@ k_npu_fnv_prime
FNV-1a 32-bit prime.
@ k_npu_line_cap
Console line buffer cap.
@ k_npu_fnv_offset
FNV-1a 32-bit offset basis.
@ k_npu_chunk_bytes
Bytes moved per transfer-loop chunk.
static RA8_INTERNAL void internal_npu_report(void)
End-of-run NPU section: jobs run + last-result checkword, or touch notice.
static RA8_INTERNAL void internal_npu_block_register(void)
Register the NPU block before main (host constructor).
static RA8_INTERNAL uint32_t internal_npu_word(uint64_t off)
Word index of a byte offset inside the shadow store.
static RA8_INTERNAL uint64_t internal_npu_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the NPU window: ID + STATUS are computed, rest shadow.
static RA8_INTERNAL void internal_npu_console_job(const npu_cmd_t *c, uint32_t check)
Push one completed-job summary line to the DMA/compute console lane.
static RA8_INTERNAL void internal_npu_on_cmd(uc_engine *uc, uint32_t value)
Act on an NPU_CMD write: run kicks a job, clear_irq de-asserts the IRQ.
static const board_periph_block_t s_k_npu_block
NPU block descriptor (RA8P1-only; self-registered with the core).
static RA8_INTERNAL npu_dec_t internal_npu_decode(uc_engine *uc, npu_cmd_t *out)
Decode the submitted command stream at QBASE per ra8_npu_fake_cmd.h.
static RA8_INTERNAL void internal_npu_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the NPU window: latch, then act on CMD / RESET.
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.
uc_err emu_mem_read(uc_engine *uc, uint64_t address, void *bytes, size_t count)
Read guest memory through the central access seam.
uc_err emu_mem_write(uc_engine *uc, uint64_t address, const void *bytes, size_t count)
Write guest memory through the central access seam.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_emulator / host-test command-stream convention for the Ethos-U55 model
@ k_ra8_npu_fake_op_copy
dst[i] = src[i].
@ k_ra8_npu_fake_op_addk
dst[i] = (src[i] + constant) & 0xFF.
@ k_ra8_npu_fake_word_dst
Destination region index (0 .
@ k_ra8_npu_fake_word_count
Byte count to process.
@ k_ra8_npu_fake_word_num
Header word count (populated words).
@ k_ra8_npu_fake_word_src
Source region index (0 .
@ k_ra8_npu_fake_word_op
magic | opcode.
@ k_ra8_npu_fake_word_const
Constant addend (add-constant op).
@ k_ra8_npu_fake_byte_mask
8-bit element wrap (add-constant op).
@ k_ra8_npu_fake_max_bytes
Max processed bytes (bounds the loop).
@ k_ra8_npu_fake_header_bytes
Fixed header length in bytes (5 words).
@ k_ra8_npu_fake_magic_mask
Bits [31:16] select the magic marker.
@ k_ra8_npu_fake_magic
Emu-Ethos-U55 marker in bits [31:16].
@ k_ra8_npu_fake_op_mask
Bits [15:0] select the opcode.
A modelled peripheral block's self-description for the core registry.
One decoded fake command (see ra8_npu_fake_cmd.h).
uint32_t dst
Destination region index.
uint32_t count
Byte count to process.
uint32_t op
Opcode (COPY / add-constant).
uint32_t src
Source region index.
uint32_t konst
Constant addend (add-constant op).
NPU model state: register shadow + job tally for the end-of-run report.
uint32_t faults
Faulted kicks (report).
uint32_t last_check
Output checkword of the last completed job.
uint32_t reads
Reads observed inside the window.
uint32_t jobs
Jobs completed (report).
uint32_t status
Computed NPU_STATUS value.
uint32_t last_op
Opcode of the last completed job (report).
uint32_t writes
Writes observed inside the window.
uint32_t reg[k_npu_words]
Reflect-on-read shadow of raw register writes.
uint32_t last_bytes
Bytes moved by the last completed job.