code wiki / _hdl_build / nx_ncf_synth.nx

nx_ncf_synth.nx

buildroot/runtime/_hdl_build/nx_ncf_synth.nx

23083 B499 linesdepth 2pulls 2 transitivereach 13 importersview sourcekind librarytopic ncf
docsdependenciesstructsconstsfunctions

about

nx_ncf_synth.nx -- the SHARED control-flow SYNTHESIS CORE (no main; imported by the rungs + the WIRING). The clean DRY home for X-AUT-NCF-001 synthesis: rungs 1-2 (nx_ncf_synth_gate, nx_ncf_loop_gate) proved the CONSTRUCTS (conditional, bounded loop) self-contained; this is the importable core + the unified entry `ncf_synth` that the router uses to route a NOVEL spec (input->output examples) to synthesis. Grammar: affine ops, a single conditional, a bounded loop. ALL identifiers are ncf_-prefixed so importers that also pull nx_pattern_classify/library never collide. license_tier: ORIGINAL

dependencies 1 imports · 13 importers

nx_syscalls.nx nx_ncf_synth.nx nx_autonomy_create.nx nx_autonomy_grow.nx nx_autonomy_grow_hardened.nx nx_autonomy_grow_loop.nx nx_evo_synth_gate.nx nx_final_rung_gate.nx nx_ncf_cube_gate.nx nx_ncf_quad_gate.nx nx_ncf_recur_gate.nx nx_ncf_route_gate.nx

diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_autonomy_create.nxnx_autonomy_grow.nxnx_autonomy_grow_hardened.nxnx_autonomy_grow_loop.nxnx_evo_synth_gate.nxnx_final_rung_gate.nxnx_ncf_cube_gate.nxnx_ncf_quad_gate.nxnx_ncf_recur_gate.nxnx_ncf_route_gate.nxnx_ncf_state_gate.nxnx_nollm_synth_register.nxnx_synth_prior_gate.nx

structs

none

consts

8const NCF_MAGIC_8192: i64 = 8192
9const NCF_MAGIC_999999: i64 = 999999
10const NCF_MAGIC_888888: i64 = 888888
12const NCF_ORGAN: *u8 = "runtime/_hdl_build/ncf_organ.nx"
13const NCF_NAME: *u8 = "ncf_organ"
14const NCF_RESULT: *u8 = "knowledge/status/ncf_out.bin"
15const NCF_RUNNER: *u8 = "_offc/nx_sov_build_run.elf"

functions

17func ncf_w(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 8: mainmainmainmainmainmain+2 calls 1: sys_write
18func ncf_n(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } let o: *u8=sys_mmap(24); var w: i64=0; var q: i64=k-1; while q>=0 { o[w]=t[q]; w=w+1; q=q-1 } sys_write(1,o,w); return 0 }
19func ncf_cat(buf: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){ buf[o]=s[i]; o=o+1; i=i+1 } return o }
20func ncf_catn(buf: *u8, off: i64, v: i64) -> i64 { var o: i64=off; if v==0 { buf[o]=48 as u8; return o+1 } var m: i64=v; if m<0 { buf[o]=45 as u8; o=o+1; m=0-m } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } var i: i64=0; while i<k { buf[o]=t[k-1-i]; o=o+1; i=i+1 } return o }
23func ncf_op_eval(op: i64, arg: i64, x: i64) -> i64
31func ncf_pred_eval(pred: i64, k: i64, x: i64) -> i64
37func ncf_loop_eval(init: i64, bop: i64, c: i64, x: i64) -> i64
50func ncf_loop_eval2(init: i64, c1: i64, c0: i64, x: i64) -> i64
57func ncf_loop_eval3(init: i64, c2: i64, c1: i64, c0: i64, x: i64) -> i64
66func ncf_loop_eval4(a0: i64, b0: i64, paa: i64, pab: i64, pba: i64, pbb: i64, x: i64) -> i64
76func ncf_pow3(k: i64) -> i64 { var r: i64=1; var t: i64=0; while t<k { r=r*3; t=t+1 } return r }
called by 1: ncf_search_recur
77func ncf_recur_eval(form: *i64, x: i64) -> i64
called by 2: ncf_search_recurncf_eval calls 1: sys_mmap
93func ncf_search_linear(xs: *i64, ys: *i64, n: i64) -> i64
called by 3: mainmainmain calls 1: ncf_op_eval
126func ncf_search_branch(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
160func ncf_search_loop(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
called by 3: mainncf_synthtry_kind calls 1: ncf_loop_eval
180func ncf_search_loop2(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
200func ncf_search_loop3(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
225func ncf_search_loop4(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
259func ncf_search_recur(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
282func ncf_synth(xs: *i64, ys: *i64, n: i64, form: *i64) -> i64
294func ncf_eval(kind: i64, form: *i64, x: i64) -> i64
305func ncf_cat_ret(buf: *u8, off: i64, op: i64, arg: i64, ind: *u8) -> i64
called by 1: ncf_emit_branch calls 2: ncf_catncf_catn
316func ncf_cat_pred(buf: *u8, off: i64, pred: i64, k: i64) -> i64
called by 1: ncf_emit_branch calls 2: ncf_catncf_catn
323func ncf_cat_body(buf: *u8, off: i64, bop: i64, c: i64) -> i64
called by 1: ncf_emit_loop calls 2: ncf_catncf_catn
334func ncf_cat_body2(buf: *u8, off: i64, c1: i64, c0: i64) -> i64
called by 1: ncf_emit_loop2 calls 2: ncf_catncf_catn
342func ncf_cat_body3(buf: *u8, off: i64, c2: i64, c1: i64, c0: i64) -> i64
called by 1: ncf_emit_loop3 calls 2: ncf_catncf_catn
351func ncf_cat_arg(buf: *u8, off: i64, v: i64) -> i64
called by 1: ncf_emit_main calls 2: ncf_catncf_catn
356func ncf_emit_main(buf: *u8, off: i64, ha: i64, hb: i64, scale: i64) -> i64
365func ncf_emit_branch(form: *i64, ha: i64, hb: i64, scale: i64) -> i64
381func ncf_emit_loop(form: *i64, ha: i64, hb: i64, scale: i64) -> i64
395func ncf_emit_loop2(form: *i64, ha: i64, hb: i64, scale: i64) -> i64
409func ncf_emit_loop3(form: *i64, ha: i64, hb: i64, scale: i64) -> i64
424func ncf_emit_loop4(form: *i64, ha: i64, hb: i64, scale: i64) -> i64
441func ncf_emit_recur(form: *i64, ha: i64, hb: i64, scale: i64) -> i64
465func ncf_emit(kind: i64, form: *i64, ha: i64, hb: i64, scale: i64) -> i64
476func ncf_god_build(name: *u8) -> i64
492func ncf_read(path: *u8) -> i64