code wiki / _hdl_build / nx_div_pick.nx

nx_div_pick.nx

buildroot/runtime/_hdl_build/nx_div_pick.nx

2780 B67 linesdepth 10pulls 12 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_div_pick.nx -- the HARDWARE-ADAPTIVE divider picker: the Nishi Seed's "grow to meet the hardware's capabilities optimally" mechanism, concretely. For a target described by (width W, multiplier model use_wide_mul), it BUILDS each candidate divider gate-net (radix-2, radix-4, Newton/Goldschmidt), MEASURES each one's HONEST critical-path latency with the real gate-delay cost model (nx_lat_honest: AND=1, ADD=log2 W, MUL=2*log2 W), and RETURNS the kind with the minimum -- the optimal divider FOR THAT HARDWARE. This is pure search + cost model (no LLM): the Fitness leg ranking Generator variants, the same loop a deployed Seed runs to auto-tune its stack to the silicon it lands on (a chip with a fast wide multiplier picks Goldschmidt; a minimal one picks a radix divider). Reuses the proven dividers + the proven honest latency metric. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_newton_struct.nx nx_alu_divider_r4.nx nx_latency_metric.nx nx_div_pick.nx nx_div_pick_test.nx

imports: nx_newton_struct.nxnx_alu_divider_r4.nxnx_latency_metric.nx

imported by: nx_div_pick_test.nx

structs

none

consts

18const NXDP_MAGIC_4096: i64 = 4096
20const NXDP_R2: i64 = 0
21const NXDP_R4: i64 = 1
22const NXDP_NEWTON: i64 = 2

functions

25func nxdp_gsim(ninputs: i64) -> *NxGsim
called by 1: nx_div_pick
38func nxdp_newton_iters(W: i64) -> i64
called by 1: nx_div_pick calls 1: nx_lat_log2_ceil
43func nx_div_pick(W: i64, use_wide_mul: i64, depth: *i64) -> i64