code wiki / _hdl_build / nx_codata_gate.nx
nx_codata_gate.nx
buildroot/runtime/_hdl_build/nx_codata_gate.nx
about
nx_codata_gate.nx -- R2+R3 of the NIST CODATA external-reference loop: the VERIFY + LIAR-KILL gate that
closes it. Reads our registry (sci_constants.tsv) and, for the NIST reference, the SOVEREIGN content-
addressed store (nx_seg_store, populated by nx_codata_ingest) -- NOT a TSV. Asserts EVERY constant agrees
with NIST. The grade is COMPUTED here, never self-asserted.
Reference read: ss_get("knowledge/store/codata-", "codata:<sym>") -> canonical record bytes -> canon_decode
-> {value, trunc}. Comparison (robust): split each value into significand + exponent at 'e'. Exponents must
match exactly. Significands: if NIST truncated (trunc=1, e.g. reduced Planck / molar gas), our value must
START WITH NIST's shown digits; else it must EQUAL them. Honest scope -- parity on the numbers: matching
NIST IS the achievement; we never claim to beat the reference. EXCEED is only on the sovereign meta-axes.
LIAR-KILL: a baked neg-control proves the comparator can tell a wrong value from a right one BEFORE any
verdict. Writes knowledge/status/codata_gate.log. license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_seg_store.nxnx_uxf_decode.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
| 18 | const G_OURS: *u8 = "knowledge/registry/sci_constants.tsv" |
| 19 | const G_STORE: *u8 = "knowledge/store/codata-" |
| 20 | const G_LOG: *u8 = "knowledge/status/codata_gate.log" |
functions
| 22 | func gt_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 31 | func gt_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 } |
| 32 | func gt_startswith(a: *u8, b: *u8) -> i64 { var i: i64=0; while b[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } return 1 } called by 1: gt_cmp |
| 34 | func gt_field(buf: *u8, ls: i64, le: i64, col: i64, dst: *u8) -> i64 called by 1: main |
| 45 | func gt_split(v: *u8, sig: *u8, exp: *u8) -> i64 called by 1: gt_cmp |
| 52 | func gt_cmp(our: *u8, nist: *u8, trunc: i64) -> i64 |
| 61 | func gt_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 } |
| 62 | func gt_wn(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(16); var m: i64=v; let t: *u8=sys_mmap(16); 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{b[i]=t[k-1-i];i=i+1}; sys_write(fd,b,k); return 0 } |
| 65 | func gt_ref(sym: *u8, nistv: *u8, trunc_ptr: *i64) -> i64 |
| 85 | func main() -> i64 |