code wiki / _hdl_build / nx_sweepcheck.nx
nx_sweepcheck.nx
buildroot/runtime/_hdl_build/nx_sweepcheck.nx
about
nx_sweepcheck.nx -- MECHANISES THE MOST EXPENSIVE RECURRING ERROR OF THIS PROGRAM: reporting a result
from a parameter that never reached the code.
WHY THIS EXISTS (measured, not theorised). Across one session the same defect class was hit repeatedly:
* a reference-weight sweep returned 523/517/518/523 -- flat, because the handler never parsed the
argument. I nearly concluded the model change had failed.
* an index-offset A/B read 504 vs 508 and was declared "noise". The knob was hardcoded downstream;
the 4-point difference was PROMPT TEXT, not the knob.
* a dilation sweep at reach 0 / 4 / 12 returned BYTE-IDENTICAL results and was written up as a
regression WITH AN INVENTED ROOT CAUSE. The verb had fallen through to a different code path.
In every case the tell was the same and free: A SWEPT PARAMETER THAT PRODUCES NO VARIATION IS NOT AN
INEFFECTIVE PARAMETER -- IT IS AN UNWIRED ONE. Analysing such results is worse than useless, because a
plausible story gets attached to numbers that mean nothing.
Per the banked law "A SESSION MUST REMEMBER < A TOOL THAT CANNOT DO THE WRONG THING", the check is
mechanised here instead of trusted to discipline. Feed it the measurements from any sweep BEFORE
interpreting them; it refuses the ones that carry no information.
nx_sweepcheck values <v1> <v2> ... -> GREEN if the sweep varies, RED if it is flat (unwired)
nx_sweepcheck selftest
expect_exit: 0 license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.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
| 25 | const SW_MIN_SAMPLES: i64 = 2 |
functions
| 27 | func sw_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 32 | func sw_n(v: i64) -> i64 { nxi_out(v); return 0 } |
| 33 | func sw_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 39 | func sw_atoi(s: *u8) -> i64 called by 1: main |
| 50 | func sw_distinct(vals: *i64, n: i64) -> i64 called by 1: sw_verdict |
| 63 | func sw_spread(vals: *i64, n: i64) -> i64 called by 1: sw_verdict |
| 77 | func sw_verdict(vals: *i64, n: i64, emit: i64) -> i64 |
| 98 | func sw_selftest() -> i64 |
| 142 | func main(argc: i64, argv: *i64) -> i64 |