code wiki / _hdl_build / nx_recip_div_w.nx

nx_recip_div_w.nx

buildroot/runtime/_hdl_build/nx_recip_div_w.nx

4902 B120 linesdepth 9pulls 9 transitivereach 3 importersview sourcekind librarytopic recip
docsdependenciesstructsconstsfunctions

about

nx_recip_div_w.nx -- the Newton/Goldschmidt reciprocal divider as a WIDTH- PARAMETERIZED gate-network generator (W in [17,30]) -- the Seed-style "emit the optimal form for the target", generalised from the W=24 instance. Composes the proven 64x64->128 wide multiplier for the only product that overflows i64 (x*t). Envelope: W in [17,30]. The upper bound is where 2F^2 = 2^(2W+1) still fits i64 (W=30 -> 2^61 < 2^63; W=31 -> 2^63 = INT_MIN, breaks). Below it every product but x*t fits a single MUL; x*t (<= 2^(3W+2)) is built 128-bit and shifted >>2W via x = (hi << (64-2W)) | ((lo >> 2W) & ((1<<(64-2W)) - 1)). Seed = the minimax (48F-32Dn)/17 (~4 bits, scale-invariant), 3 Newton iters (-> ~32 bits >= W), KCORR=3 (maxcorr<=1 over the envelope). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_mul_wide.nx nx_recip_div_w.nx nx_recip_div24.nx nx_recip_div_w_test.nx

imports: nx_mul_wide.nx

imported by: nx_recip_div24.nxnx_recip_div_w_test.nx

structs

none

consts

15const RDW_ITERS: i64 = 3
16const RDW_KCORR: i64 = 3

functions

19func rdw_msb_synth(g: *NxGsim, nd: i64, W: i64) -> i64
34func rdw_div17(g: *NxGsim, num: i64, stages: i64) -> i64
61func nx_recip_div_w_synth(g: *NxGsim, na: i64, nb: i64, W: i64, rem_out: *i64) -> i64