code wiki / _hdl_build / rv64im_min_cpu_crosscheck.nx

rv64im_min_cpu_crosscheck.nx

buildroot/runtime/_hdl_build/rv64im_min_cpu_crosscheck.nx

4164 B115 linesdepth 6pulls 17 transitivereach 0 importersview sourcekind tooltopic rv64im
docsdependenciesstructsconstsfunctions

about

nx_rv64im_cpu_crosscheck.nx -- 1:1 proof: our sovereign RV64IM CPU sim vs qemu-system-riscv64 (canonical reference) on the SAME ELF. Loads cpu_crosscheck_prog.elf (sum of squares 1..20 = 2870, printed via UART, exercising MUL/DIVU/REMU/branches/loads) into the sim, runs it, and emits the captured UART byte stream to stdout + a proof file. The off-box harness then diffs our UART against qemu's UART and the known answer 2870. Asserts our output contains "SUM=2870". expect_exit: 0 license_tier: ORIGINAL

dependencies 10 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_elf_loader.nx rv64im_min_cpu_crosscheck.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.nxrv64im_min_elf_loader.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 sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_rv64im_rf_init nx_rv64im_csr_init nx_clint_init nx_uart_init nx_rv64im_sim_init 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

structs

none

consts

24const CC_MEM_BASE: i64 = 0x80000000
25const CC_MEM_SIZE: i64 = 0x400000 // 4 MiB (covers prog + 0x80100000 buf + 0x80200000 stack)
26const CC_TX_CAP: i64 = 4096
27const CC_MAX_STEPS: i64 = 1000000

functions

29func _contains(hay: *u8, hlen: i64, needle: *u8, nlen: i64) -> i64
called by 1: main
47func _slen(s: *u8) -> i64
called by 1: main
53func main() -> i64