code wiki / _hdl_build / nx_root_trace.nx

nx_root_trace.nx

buildroot/runtime/_hdl_build/nx_root_trace.nx

13816 B329 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_root_trace.nx -- THE ROOT-TRACE INSTRUMENT (Genealogist SIL metric), operator 2026-06-13: "make sure that we can go from spore up emitting all of our shapes that have gotten us to where we are." The no-floating LADDER (nx_capability_ladder) already proves every QUEUE row rests on a DONE foundation. This is its GENEALOGY twin: it walks lineage.tsv's child<-parents edges and proves every ORGAN traces UP, by an unbroken parent chain, to the SPORE -- the genesis node rv64im_min_sim (BOOTSTRAP_MAP "god"). A node that CANNOT reach the spore is the genealogical equivalent of a floating capability: FLOATING-ROOT = parents "-" but the node is NOT the spore (claims no parent, yet isn't god) BROKEN-LINK = a named parent has NO row in the tree (a dangling ancestor) UNROOTED = all parents present but at least one does not itself reach the spore Drives traced -> nodes, broken_links -> 0, floating_roots -> 1 (only the spore). Mechanism mirrors the proven capability-ladder fixpoint, but over the lineage parents column instead of the queue deps column (DRY of idiom, not of code -- the formats differ). SELF-VALIDATING (no false-green): a baked pos control (child of the spore traces) and a neg control (a non-spore "-" root + a child of an absent spore stays untraced) run on a synthetic in-memory tree BEFORE the real lineage.tsv; controls wrong -> RED, exit 1. Sovereign: raw syscalls, no shell/sed/awk, no third-party. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_root_trace.nx nx_collision_watchdog.nx

imports: nx_syscalls.nx

imported by: nx_collision_watchdog.nx

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

main sys_mmap rt_set rt_trace rt_streq rt_id_at sys_mmap ↻ rt_par_at rt_has_dot rt_find rt_streq ↻ rt_id_at ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real rt_gate rt_w sys_write rt_wn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close sys_exit rt_load sys_mmap ↻ sys_openat_rd sys_read sys_close ↻ rt_id_at ↻ rt_par_at ↻ rt_w ↻ rt_find ↻ rt_par_at ↻ rt_has_missing rt_par_at ↻ sys_mmap ↻ rt_has_dot ↻ rt_find ↻ rt_gap_line

structs

none

consts

22const RT_MAGIC_1048576: i64 = 1048576
23const RT_MAGIC_1048575: i64 = 1048575
25const RT_MAX: i64 = 512
26const RT_IDCAP: i64 = 48
27const RT_PARCAP: i64 = 320
28const RT_LIN: *u8 = "knowledge/registry/lineage.tsv"
29const RT_LOG: *u8 = "knowledge/status/root_trace.log"
30const RT_SPORE: *u8 = "rv64im_min_sim"

functions

32func rt_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 3: rt_gap_linert_gatemain calls 1: sys_write
33func rt_wn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48 as u8;k=1}; while m>0 {t[k]=(48+(m%10)) as u8; m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(fd, bb, k); return 0 }
called by 1: rt_gate calls 2: sys_mmapsys_write
35func rt_streq(a: *u8, b: *u8) -> i64
47func rt_has_dot(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { if s[i] == (46 as u8) { return 1 } i = i + 1 } return 0 }
49func rt_id_at(base: i64, r: i64) -> *u8 { return (base + r * RT_IDCAP) as *u8 }
50func rt_par_at(base: i64, r: i64) -> *u8 { return (base + r * RT_PARCAP) as *u8 }
52func rt_set(base: i64, cap: i64, r: i64, s: *u8) -> i64
called by 2: g_nodemain
61func rt_find(idbase: i64, n: i64, name: *u8) -> i64
68func rt_load(path: *u8, idbase: i64, parbase: i64) -> i64
128func rt_trace(idbase: i64, parbase: i64, n: i64, spore: *u8, traced: *i64) -> i64
188func rt_has_missing(idbase: i64, parbase: i64, n: i64, r: i64) -> i64
211func rt_gap_line(fd: i64, idbase: i64, parbase: i64, n: i64, r: i64, traced: *i64) -> i64
249func rt_gate(fd: i64, cpos: i64, cneg: i64, present: i64, nodes: i64, traced: i64, broken: i64, froots: i64, epoch: i64, ok: i64) -> i64
called by 1: main calls 2: rt_wrt_wn
265func main() -> i64