code wiki / _hdl_build / nx_eoe_while.nx
nx_eoe_while.nx
buildroot/runtime/_hdl_build/nx_eoe_while.nx
about
nx_eoe_while.nx -- EMITTER-OF-EMITTERS, GENERALITY RUNG 4: DATA-DRIVEN ITERATION.
The ladder: nx_eoe (006e) = control-flow DEPTH (N nested loops, FIXED bound);
nx_eoe_oplist (006g) = linear COMPUTATION; nx_eoe_branch (006h) = a 2-way BRANCH
(predicate from spec). nx_eoe's loops run a FIXED number of times (bound is a
spec constant). This rung synthesizes a CONDITIONAL while-loop: it runs UNTIL a
data PREDICATE flips, so the ITERATION COUNT is COMPUTED from the running data,
not specified -- the same spec on different effective dynamics loops a different
number of times. That data-dependent iteration is exactly what a fixed-bound
loop nest and a linear op-list provably cannot express.
nx_eoe_while <basename> <start> <whilepred> <body-op>
whilepred = g<t> | l<t> | e<t> (loop runs WHILE acc > t | acc < t | acc == t)
body-op = a<n> | m<n> | s<n> (applied once per iteration)
-> writes runtime/_hdl_build/<basename>.nx whose main() runs the loop and prints
"RESULT=<acc>\n". nx_cc compiles the loop (the team owns the loop codegen).
A safety GUARD (break after 100000 iters) prevents a runaway emitted organ from
hanging -- it never fires for a well-formed terminating spec.
no-false-green plan (X-AUT-006d): DIFFERENT body ops -> DIFFERENT iteration counts
-> DIFFERENT correct results (e.g. <100 by *2 = 7 iters -> 128; <100 by +1 = 99
iters -> 100), proving the COUNT is data-driven not templated; tamper threshold ->
different result. Sovereign, no gcc/.sh. HONEST SCOPE: one predicate-driven
while over a single body op -- NOT yet op-list bodies or nested loops. ONE rung.
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 27 | const K_MAGIC_65536: i64 = 65536 |
functions
| 29 | func eow_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i } called by 1: main |
| 30 | func eow_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 42 | func eow_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 43 | func eow_atoi_from(s: *u8, from: i64) -> i64 called by 1: main |
| 49 | func main(argc: i64, argv: *i64) -> i64 |