code wiki / _hdl_build / nx_gatelib.nx

nx_gatelib.nx

buildroot/runtime/_hdl_build/nx_gatelib.nx

13387 B314 linesdepth 5pulls 6 transitivereach 10 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_gatelib.nx -- the shared substrate under the gate-coverage scanners. ===== WHY THIS EXISTS ============================================ nx_gatescan (does anything test this organ?) and nx_gatequality (how much of it does that test reach?) are two questions over the same tree, and they were written as two files that duplicated NINE functions between them: the directory walk, file read, path join, the .nx and gate-name predicates, the ends-with helper, the string length helper, and the gate-to-organ attribution rule. ★I WROTE BOTH COPIES, IN ONE SESSION, WHILE BUILDING TOOLS TO FIND EXACTLY THIS CLASS OF PROBLEM. The tree walk was already named as debt twice -- filed rather than fixed, on the reasoning that extracting it would touch other consumers -- and then the very next organ added a fourth copy. Naming a debt is not paying it, and a filed debt keeps accruing. ===== THE ATTRIBUTION RULE IS THE REAL REASON TO SHARE ========= The mechanical helpers are cheap to duplicate; the attribution rule is not. It decides whether a gate named <organ>_<aspect>_test.nx counts as covering <organ>, and getting it wrong is how the first gatescan run reported 1019 ungated organs when the true figure was 963. With two copies, one can be corrected and the other silently left behind -- and the two tools would then disagree about which organs are gated while both looked healthy. ★A RULE THAT TWO TOOLS MUST AGREE ON BELONGS IN ONE PLACE, and that is a stronger reason than the line count. ===== WHAT IS NOT SHARED ========================================= The gates of both consumers keep their own INDEPENDENT re-derivations of these rules. That is deliberate and is not duplication in the sense that matters: a gate calling the code under test can only confirm it is self-consistent, whereas a second implementation agreeing is evidence. The same reasoning kept nx_arrhenius and nx_stability as separate Arrhenius implementations -- and that decision is what caught the dead primitive, so it has already paid for itself once. license_tier: ORIGINAL

dependencies 3 imports · 10 importers

nx_syscalls.nx nx_eco_graph.nx nx_import_scan.nx nx_gatelib.nx nx_codewiki.nx nx_codewiki_ask.nx nx_codewiki_gate.nx nx_codewiki_lib.nx nx_dupfunc.nx nx_dupfunc_test.nx nx_gatelib_test.nx nx_gatelib_walkparity_gate.nx nx_gatequality.nx nx_gatescan.nx

imports: nx_syscalls.nxnx_eco_graph.nxnx_import_scan.nx

imported by: nx_codewiki.nxnx_codewiki_ask.nxnx_codewiki_gate.nxnx_codewiki_lib.nxnx_dupfunc.nxnx_dupfunc_test.nxnx_gatelib_test.nxnx_gatelib_walkparity_gate.nxnx_gatequality.nxnx_gatescan.nx

structs

none

consts

43const GL_MAGIC_3900: i64 = 3900
44const GL_MAGIC_131072: i64 = 131072
45const GL_MAGIC_1024: i64 = 1024
47const GL_FILECAP: i64 = 262144

functions

49func gl_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
51func gl_join(path: *u8, base_n: i64, nm: *u8) -> i64
called by 1: gl_walk
59func gl_read(path: *u8, buf: *u8, cap: i64) -> i64
72func gl_isdotdot(nm: *u8) -> i64
called by 1: gl_walk
77func gl_is_nx(nm: *u8, n: i64) -> i64
85func gl_ends(name: *u8, n: i64, suf: *u8) -> i64
94func gl_is_gate_name(name: *u8, n: i64) -> i64
called by 4: mainmainmainmain calls 1: gl_ends
102func gl_is_ident(c: i64) -> i64
121func gl_attribute(g: *EcoGraph, name: *u8, n: i64, buf: *u8) -> i64
called by 3: mainmainmain calls 2: gl_endseg_find
144func gl_has_token(hay: *u8, hn: i64, name: *u8, nl: i64) -> i64
called by 3: maingq_close_reachmain calls 1: gl_is_ident
177func gl_walk(g: *EcoGraph, path: *u8, path_n: i64, filebuf: *u8, aoff: *i64, alen: *i64,
248func gl_extract_funcs(src: *u8, n: i64, names: *u8, offs: *i64, lens: *i64, spans: *i64, cap: i64) -> i64
called by 2: mainmain calls 1: gl_is_ident
296func gl_strip_comments(src: *u8, n: i64, dst: *u8) -> i64
called by 3: mainx_normmain