code wiki / _hdl_build / rv64im_min_sim_smoke.nx

rv64im_min_sim_smoke.nx

buildroot/runtime/_hdl_build/rv64im_min_sim_smoke.nx

6021 B151 linesdepth 5pulls 16 transitivereach 0 importersview sourcekind smoketopic rv64im
docsdependenciesstructsconstsfunctions

about

rv64im_min_sim_smoke.nx -- end-to-end smoke for the RV64IM-min sim. Hand-codes a tiny RV64IM program that writes "OK\n" via the UART MMIO + poweroffs via the SiFive finisher. Runs it on the simulator (which ties decoder + ALU + regfile + CSR + CLINT + UART together) and asserts the captured UART byte stream matches "OK\n". This is the first integration test that exercises every module shipped in nishi-silicon. If this passes, the path from "NishiHDL DSL declared" to "RV64IM program executes" is proven -- the remaining steps to FPGA bring-up are: ELF loader, kernel boot, then nishi-synth + Yosys. Hand-coded program (RV64IM, position-independent, starts at PC): lui a0, 0x10000 ; a0 = 0x10000000 (UART base) addi a1, zero, 'O' ; a1 = 0x4F sb a1, 0(a0) ; UART THR <- 'O' addi a1, zero, 'K' ; a1 = 0x4B sb a1, 0(a0) ; UART THR <- 'K' addi a1, zero, '\n' ; a1 = 0x0A sb a1, 0(a0) ; UART THR <- '\n' lui a0, 0x100 ; a0 = 0x100000 (finisher base) lui a1, 0x5 ; a1 = 0x5000 addi a1, a1, 0x555 ; a1 = 0x5555 sw a1, 0(a0) ; finisher <- 0x5555 -> sim halts Encoded as 32-bit little-endian instruction words below.

dependencies 9 imports · 0 importers

nx_syscalls.nx nishi_hdl_primitives.nx rv64im_min_decoder.nx rv64im_min_alu.nx rv64im_min_regfile.nx rv64im_min_csr.nx rv64im_min_clint.nx rv64im_min_uart.nx rv64im_min_sim.nx rv64im_min_sim_smoke.nx

imports: nx_syscalls.nxnishi_hdl_primitives.nxrv64im_min_decoder.nxrv64im_min_alu.nxrv64im_min_regfile.nxrv64im_min_csr.nxrv64im_min_clint.nxrv64im_min_uart.nxrv64im_min_sim.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap nx_rv64im_rf_init nx_rv64im_csr_init nx_clint_init nx_uart_init nx_rv64im_sim_init smoke_load_program smoke_write32 nx_rv64im_sim_run nx_rv64im_sim_step nx_clint_tick nx_clint_update_mtip nx_rv64im_csr_tick_mcycle nx_clint_mtip_get nx_rv64im_csr_read nx_csr_addr_to_slot nx_rv64im_sim_take_trap nx_rv64im_csr_read ↻ nx_rv64im_csr_write nx_csr_addr_to_slot ↻ nx_csr_is_read_only nx_rv64im_xlate nx_rv64im_csr_read ↻ nx_rv64im_is_device sys_mmap ↻ nx_sv39_walk nx_mmu_inrange nx_mmu_rd64 nx_mmu_inrange ↻ nx_mmu_rd64 ↻ nx_mmu_wr64 nx_rv64im_csr_write ↻ nx_rv64im_sim_load32 sys_mmap ↻ nx_virtio_read32 nx_virtio_addr_in_range nx_nvme_read32 nx_nvme_addr_in_range nx_nndev_read32

structs

none

consts

40const SMOKE_MEM_BASE: i64 = 0x80000000
41const SMOKE_MEM_SIZE: i64 = 4096
42const SMOKE_TX_CAP: i64 = 256

functions

45func smoke_write32(buf: *u8, off: i64, value: i64) -> i64
called by 1: smoke_load_program
55func smoke_load_program(mem: *u8) -> i64
called by 1: main calls 1: smoke_write32
114func main() -> i64