code wiki / _hdl_build / nx_sext_wasm_kat_gate.nx
nx_sext_wasm_kat_gate.nx
buildroot/runtime/_hdl_build/nx_sext_wasm_kat_gate.nx
about
nx_sext_wasm_kat_gate.nx -- END-TO-END KAT for the WASM lane's subword sign-extend fix (2026-07-10):
forks the sovereign pipeline (nx_compile_wat: .nx -> wat; nx_wat_compiler: wat -> wasm) on
nx_sext_wasm_kat.nx, loads the wasm in nx_wasm_vm, and asserts the SEMANTICS in-VM:
T1 both tools rc=0 (pre-fix: nx_wat_compiler REFUSED -- i64.store32/load32_* were unknown atoms)
T2 exports resolve
T3 sext_kat() == 0 (*i32 negative+positive round-trip AND *u8 0xA0->160 witness, all in-VM)
T4 sext_load_neg() == -100 (the visible sign-extension number; a zero-extend lane returns 4294967196)
This is the WASM twin of nx_i32store_probe_gate (x86) -- one language semantic, every backend.
Stage first: nx_sov_build_run nx_compile_wat --build-only + nx_sov_build_run nx_wat_compiler --build-only.
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_wasm_vm.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 14 | const SW_CWAT: *u8 = "/tmp/nx_compile_wat.sov.elf" |
| 15 | const SW_WATC: *u8 = "/tmp/nx_wat_compiler.sov.elf" |
| 16 | const SW_SRC: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/runtime/nx_sext_wasm_kat.nx" |
| 17 | const SW_OWAT: *u8 = "/tmp/sextkat.wat" |
| 18 | const SW_OWASM: *u8 = "/tmp/sextkat.wasm" |
functions
| 20 | func sw_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 21 | func sw_pn(v: i64) -> i64 |
| 25 | func sw_check(name: *u8, cond: i64) -> i64 |
| 28 | func sw_run_elf(elf: *u8, a1: *u8, a2: *u8) -> i64 |
| 40 | func main() -> i64 |