code wiki / _hdl_build / nx_rv64_asm_verify.nx

nx_rv64_asm_verify.nx

buildroot/runtime/_hdl_build/nx_rv64_asm_verify.nx

6732 B79 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tooltopic rv64
docsdependenciesstructsconstsfunctions

about

nx_rv64_asm_verify.nx -- GATE: EXHAUSTIVE verification of the sovereign RV64 assembler (nx_rv64_asm) by RUNNING its output on the sovereign rv64 emulator (rv64im_min_sim via nx_boot_run_sov). Eats the debt that the assembler was only lightly KAT'd (lui + 2 branches): this assembles ONE program that threads a computation through EVERY supported instruction -- li/addi/add/sub/and/or/xor/andi/ori/sll/srl/slli/srli/lui + lw/sw/lbu/sb/lhu/sh/ld/sd (memory round-trips) + beq/bne/blt/bge/bltu/bgeu (taken AND not-taken) + jal/ret/j/mv -- to a known value (1005), self-checks it IN-GUEST, prints OK (match) or NO (mismatch) over the UART, and halts via the SiFive finisher. If ANY instruction is mis-encoded the computed value diverges -> NO -> RED. Runs on OUR emulator (no QEMU). expect_exit:0

dependencies 2 imports · 0 importers

nx_rv64_asm.nx nx_itoa_lib.nx nx_rv64_asm_verify.nx

imports: nx_rv64_asm.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main v_p rvasm_assemble_str rvasm_assemble sys_mmap ra_isws ra_encode sys_mmap ↻ ra_afterword ra_isws ↻ ra_word_is ra_isws ↻ ra_reg ra_skipsep ra_isws ↻ ra_num ra_isdig ra_imm ra_skipsep ↻ ra_ishex ra_isdig ↻ ra_hexval ra_isdig ↻ ra_u ra_imm12 ra_i ra_sh6 ra_r ra_past ra_s ra_label_target ra_skipsep ↻ ra_afterword ↻ ra_find_label ra_b ra_j ra_put v_pn nxi_out nxi_fd

structs

none

consts

10const K_MAGIC_65536: i64 = 65536

functions

12func v_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main
17func v_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
20func v_run_sov(binpath: *u8, outpath: *u8) -> i64
39func v_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 1: sys_read
45func v_has(buf: *u8, n: i64, pat: *u8, pl: i64) -> i64
called by 1: main
52func main() -> i64