code wiki / _hdl_build / nx_superopt_general_test.nx

nx_superopt_general_test.nx

buildroot/runtime/_hdl_build/nx_superopt_general_test.nx

5497 B124 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic superopt
docsdependenciesstructsconstsfunctions

about

nx_superopt_general_test.nx -- (#1) the generator GENERALIZED beyond x*C-in-two- terms. It authors an N-term shift/add chain for ANY constant via the non-adjacent form (NAF), the canonical minimal signed-digit recoding (Reitwiesner, IRE Trans. 1960; Booth recoding). NAF gives the fewest +/- shifted terms, so the generator handles constants the 2-term strength-reducer could NOT (x*100, x*11, x*13, ...). Each authored chain is lowered through the SPEC ENCODER (nx_isa_spec) to RV64 AND AArch64 and PROVEN BY EXECUTION on the sovereign emulators. The team authors: I wrote the recoding + the lowering; the search/recoding writes the term sequence and the spec table writes the bytes. Known answer: every constant computes x*C on both arches -> exit 0.

dependencies 3 imports · 0 importers

nx_isa_spec.nx nx_emu_rv64.nx nx_emu_arm64.nx nx_superopt_general_test.nx

imports: nx_isa_spec.nxnx_emu_rv64.nxnx_emu_arm64.nx

imported by: nobody (leaf or entry point)

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

main g_puts g_naf g_run_rv g_put_w isa_emit isa_assemble emu_rv64_run emu_rv64_run_mem emu_g_ld emu_rv_sext12 emu_ltu emu_srl emu_sext32 emu_g_st emu_rv_bimm emu_rv_jimm sys_read g_run_a64 g_put_w ↻ isa_emit ↻ emu_arm64_run emu_arm64_run_mem a64e_g_ld a64e_wr a64e_rd a64e_subs a64e_ltu a64e_adds a64e_ltu ↻ a64e_shiftreg a64e_srl a64e_udiv a64e_srl ↻ a64e_ltu ↻ a64e_cond a64e_g_st sys_read ↻ g_num

structs

none

consts

none

functions

17func g_puts(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
18func g_num(v: i64) -> i64
called by 1: main
26func g_put_w(code: *u8, o: i64, w: i64) -> i64
called by 2: g_run_rvg_run_a64
33func g_naf(C: i64, pos: *i64, sign: *i64) -> i64
called by 1: main
50func g_run_rv(x: i64, pos: *i64, sign: *i64, nt: i64) -> i64
called by 1: main calls 3: g_put_wisa_emitemu_rv64_run
66func g_run_a64(x: i64, pos: *i64, sign: *i64, nt: i64) -> i64
called by 1: main calls 3: g_put_wisa_emitemu_arm64_run
81func main() -> i64