code wiki / _hdl_build / nx_recip_div24_test.nx

nx_recip_div24_test.nx

buildroot/runtime/_hdl_build/nx_recip_div24_test.nx

4829 B134 linesdepth 11pulls 11 transitivereach 0 importersview sourcekind gate/prooftopic recip
docsdependenciesstructsconstsfunctions

about

nx_recip_div24_test.nx -- TRIANGULATED 1:1 proof of the W=24 Newton/Goldschmidt reciprocal divider gate-network (nx_recip_div24_synth), the first rung that composes the proven 64x64->128 wide multiplier (x*t overflows i64 at W=24). Three independent legs must agree on every vector (a bug would have to fool all three): LEG A the GATE-NETWORK Newton divider via nx_nxgate_sim (q and r); LEG B an independent restoring (shift-subtract) divider, W=24, SCALAR; LEG C the i64 oracle / and %. Battery (2,297,160 vectors): dense D in [1,256] x N in [0,8191] + 200,000 random FULL 24-bit (N,D in [1,2^24-1]) + 8 edges. Known answer (FAIL LOUD): "2297160 2297160 1763 4" rc=0 (ok total q_chk r_chk; 12345/7 = 1763 rem 4). Built on the known-good compiler.

dependencies 1 imports · 0 importers

nx_recip_div24.nx nx_recip_div24_test.nx

imports: nx_recip_div24.nx

imported by: nobody (leaf or entry point)

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

main nx_recip_div24_synth nx_recip_div_w_synth div_const rdw_msb_synth div_const ↻ div_op2 div_op2 ↻ rdw_div17 div_const ↻ div_op2 ↻ div_mux nx_mul_wide_synth nx_sink_init_mem nx_mul_wide_sink nx_sink_const nx_hdl_wire nx_sink_cell nx_hdl_wire ↻ sys_mmap div_mux ↻ rt_run nx_gsim_run nx_gsim_kind_supported nx_gsim_eval_cell rt_restoring _emit_num _nl

structs

none

consts

16const RT_W24: i64 = 16777215 // 2^24 - 1
17const RT_LCG_A: i64 = 6364136223846793005
18const RT_LCG_C: i64 = 1442695040888963407

functions

20func _emit_num(v: i64) -> i64
called by 1: main
28func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: main
31func rt_restoring(N: i64, D: i64) -> i64
called by 1: main
44func rt_run(g: *NxGsim, qnet: i64, rnet: i64, N: i64, D: i64, r_out: *i64) -> i64
called by 1: main calls 1: nx_gsim_run
52func main() -> i64