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
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
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
structs
| none |
consts
| none |
functions
| 20 | func _emit_num(v: i64) -> i64 called by 1: main |
| 28 | func _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 |
| 29 | func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 } called by 1: main |
| 31 | func count_kind(g: *NxGsim, kind: i64) -> i64 called by 1: main |
| 37 | func build_r2(width: i64) -> i64 { // returns SUB-stage count; cells in a global-ish via the g it builds |
| 41 | func main() -> i64 |