code wiki / _hdl_build / nx_recip_synth_test.nx
nx_recip_synth_test.nx
buildroot/runtime/_hdl_build/nx_recip_synth_test.nx
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
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
structs
| none |
consts
| 21 | const RT_W: i64 = 16 |
| 22 | const RT_LCG_A: i64 = 6364136223846793005 |
| 23 | const RT_LCG_C: i64 = 1442695040888963407 |
functions
| 25 | func _emit_num(v: i64) -> i64 called by 1: main |
| 33 | func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 } called by 1: main |
| 36 | func rt_restoring(N: i64, D: i64) -> i64 called by 1: main |
| 50 | func rt_run(g: *NxGsim, qnet: i64, rnet: i64, N: i64, D: i64, r_out: *i64) -> i64 |
| 58 | func main() -> i64 |