code wiki / _hdl_build / nx_recip_synth_test.nx

nx_recip_synth_test.nx

buildroot/runtime/_hdl_build/nx_recip_synth_test.nx

5924 B146 linesdepth 10pulls 10 transitivereach 0 importersview sourcekind gate/prooftopic recip
docsdependenciesstructsconstsfunctions

about

nx_recip_synth_test.nx -- TRIANGULATED validation of the Newton-Raphson reciprocal divider instantiated as an NxGsim GATE-NETWORK (nx_recip_synth.nx). Three INDEPENDENT legs must agree on every vector (a bug would have to fool all three), exactly mirroring how nx_alu_divider_test proves the restoring divider gate-network and how nx_alu_divider_newton proves the scalar math: LEG A the GATE-NETWORK Newton divider, run through nx_nxgate_sim (q and r) LEG B an independent restoring (shift-subtract) divider, SCALAR (a DIFFERENT algorithm -- the radix-2 reference) LEG C the i64 oracle / and % Battery = the SAME 2,297,160-vector triangulation the scalar proof passed: dense D in [1,256] x N in [0,8191] (2,097,152 vectors) + 200,000 random full-range W=16 (N,D in [1,65535]) + 8 explicit edges Known answer (FAIL LOUD): "<ok> <total> <q_chk> <r_chk>", ok must == total. On success prints e.g. "2297160 2297160 3 1" and sys_exit(0); any mismatch prints the bad counts and exits non-zero.

dependencies 1 imports · 0 importers

nx_recip_synth.nx nx_recip_synth_test.nx

imports: nx_recip_synth.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_div_synth div_const msb_synth div_const ↻ div_op2 div_op2 ↻ recip_const_div17 div_const ↻ div_op2 ↻ div_mux div_mux ↻ rt_run nx_gsim_run nx_gsim_kind_supported nx_gsim_eval_cell rt_restoring _emit_num _nl

structs

none

consts

21const RT_W: i64 = 16
22const RT_LCG_A: i64 = 6364136223846793005
23const RT_LCG_C: i64 = 1442695040888963407

functions

25func _emit_num(v: i64) -> i64
called by 1: main
33func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: main
36func rt_restoring(N: i64, D: i64) -> i64
called by 1: main
50func 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
58func main() -> i64