code wiki / _hdl_build / nx_alu_divider_race_test.nx

nx_alu_divider_race_test.nx

buildroot/runtime/_hdl_build/nx_alu_divider_race_test.nx

4379 B82 linesdepth 9pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic alu
docsdependenciesstructsconstsfunctions

about

nx_alu_divider_race_test.nx -- the RACE step (theory -> proof -> RACED). Not a correctness test: it MEASURES our divider's latency/area from the netlist and races it against the RESEARCH algorithm ladder. "How fast vs what exists." Digit-recurrence dividers are dominated by LATENCY = #sequential stages (the remainder dependency chain). Research ladder (stages for a W-bit divide): restoring / non-restoring (radix-2): W [the floor] radix-4 SRT: ceil(W/2) [~2x] Goldschmidt / Newton (multiplicative): ceil(log2 W) [the FRONTIER, quadratic] We MACHINE-COUNT our radix-2 and radix-4 stages (= SUB cells) + total cells (area proxy) and print them next to the ladder, with the HONEST verdict. HONEST scope: a gate-level structural race (stages/gates = what DETERMINES eventual latency/area); a true ns/cycle race vs a synthesized incumbent needs place-&-route/silicon (the L8 gap). Output (FAIL LOUD on a measurement error): "<r2_stages> <r2_cells> <r4_stages> <r4_cells> <goldschmidt_frontier>".

dependencies 1 imports · 0 importers

nx_alu_divider_r4.nx nx_alu_divider_race_test.nx

imports: nx_alu_divider_r4.nx

imported by: nobody (leaf or entry point)

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

main nx_div_synth nx_sink_init_mem nx_div_synth_sink nx_sink_const nx_hdl_wire nx_hdl_signal_alloc nx_hdl_kind_is_valid nx_hdl_width_is_valid nx_sink_cell nx_hdl_wire ↻ sys_mmap count_kind nx_div_synth_r4 div_const div_op2 div_mux _puts _emit_num _nl

structs

none

consts

none

functions

20func _emit_num(v: i64) -> i64
called by 1: main
28func _puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main
29func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: main
31func count_kind(g: *NxGsim, kind: i64) -> i64
called by 1: main
37func build_r2(width: i64) -> i64 { // returns SUB-stage count; cells in a global-ish via the g it builds
41func main() -> i64