code wiki / _hdl_build / nx_pattern_classify.nx

nx_pattern_classify.nx

buildroot/runtime/_hdl_build/nx_pattern_classify.nx

8736 B140 linesdepth 3pulls 3 transitivereach 9 importersview sourcekind librarytopic pattern
docsdependenciesstructsconstsfunctions

about

nx_pattern_classify.nx -- the BUILDER's pattern CLASSIFIER (the rung nx_pattern_library itself flags: "a real classifier would infer shape from the spec's in/out types"). Until now the pipeline trusted a hand-assigned shape_id -- which means a human (or Claude) still classified every spec. This module closes that: a spec is described by a small FEATURE VECTOR (what its inputs/outputs ARE), and a data-driven DECISION TABLE maps features -> pattern id. Adding a shape = adding a row, not code (rule 11). First-match-in-order resolves overlaps (PID before GOVERNOR: both stateful, plant wins; STATE_FLOW before THRESHOLD_TABLE: both table-driven, verdict-out vs value-out splits them). 0 = NOVEL -> NEEDS_TUTOR, honest and measured, exactly as bp_claude_touch counts it. RACI: BUILDER owns this (AUTHOR's front door: spec -> which emitter authors it). LAWS: struct-free, integer-only, flat ifs. license_tier: ORIGINAL

dependencies 2 imports · 6 importers

nx_pattern_library.nx nx_syscalls.nx nx_pattern_classify.nx nx_auto_builder.nx nx_auto_builder_s20.nx nx_classifier_sync.nx nx_ncf_route_gate.nx nx_pattern_classify_test.nx nx_warden_build.nx

imports: nx_pattern_library.nxnx_syscalls.nx

imported by: nx_auto_builder.nxnx_auto_builder_s20.nxnx_classifier_sync.nxnx_ncf_route_gate.nxnx_pattern_classify_test.nxnx_warden_build.nx

structs

none

consts

15const PLC_IN_BYTES: i64 = 0 // consumes a byte buffer (parse)
16const PLC_IN_ARRAY: i64 = 1 // consumes an i64 array (fold)
17const PLC_IN_PAIR: i64 = 2 // compares two scalars (a vs b)
18const PLC_IN_STATE: i64 = 3 // mutates carried state (integ, per-host last-hit)
19const PLC_IN_TABLE: i64 = 4 // core logic IS a data table (curve, transitions)
20const PLC_IN_COORDS: i64 = 5 // nm coordinates / dimensions
21const PLC_HAS_TIME: i64 = 6 // timestamps / rates / pacing
22const PLC_HAS_PLANT: i64 = 7 // closed feedback loop against a plant
23const PLC_OUT_VERDICT:i64 = 8 // output is a small enum (UNDER/OK/OVER, winner, next-state)
24const PLC_OUT_VALUE: i64 = 9 // output is a computed quantity
25const PLC_IS_META: i64 = 10 // emits modules/boilerplate rather than computing
26const PLC_IN_COEFFS: i64 = 11 // spec is a coefficient/constant table (oracle-generated f64 kernels)
27const PLC_IN_FRAMED: i64 = 12 // framed binary layout (TLV / length-prefixed field sequences)
28const PLC_IN_MARKED: i64 = 13 // prefix+marker stream (JPEG-style: standalone table, terminator)
29const PLC_HAS_INVERSE:i64 = 14 // lossless round-trip law: an exact inverse must reconstruct the
31const PLC_IN_INGEST: i64 = 15 // the COMPOSE-shape: a spec that wires a fixed pipeline of named
38const PLC_READS_LOG: i64 = 16 // consumes a log/universe + target stream to count coverage
39const PLC_DERIVES_PERMIL:i64 = 17 // derives permil=count*1000/total + a verdict-band ladder
42const PLC_IN_RANKINGS: i64 = 18 // consumes K rankings to fuse (RRF)
43const PLC_IN_CORPUS: i64 = 19 // consumes a doc corpus + query -> ranked TF retrieval (RANK_RETRIEVE)
44const PLC_IN_OPDAG: i64 = 20 // consumes a 3-address op-DAG -> lowered dataflow core (RTL_SYNTH)
45const PLC_IN_SUBFABRICS: i64 = 21 // consumes K sub-fabrics to fold via fab_append (NETLIST_COMPOSE)
46const PLC_IN_FABRIC: i64 = 22 // emits a gate-level LUT4 fabric (cells+nets) -> runs on fab_eval (FABRIC_NETLIST)
47const PLC_N_FEATURES: i64 = 23

functions

51func plc_table_rows() -> i64 { return 25 }
52func plc_table() -> *i64
99func plc_classify(f: *i64) -> i64
117func plc_match_spec(f: *i64) -> i64
called by 3: mainmainmain calls 2: plc_classifypl_covered
125func plc_new_features() -> *i64
131func plc_max_covered() -> i64
called by 2: cs_gatemain calls 2: plc_tableplc_table_rows