nx_isa_manager.nx
buildroot/runtime/nx_isa_manager.nx
about
nx_isa_manager.nx -- THE MASTER ISA MANAGER.
WHAT IT IS: not another conformance gate. The gates measure ONE
architecture each and answer "does this emulator obey its manual".
This organ measures THE POPULATION and answers a different question:
of every ISA the estate has declared in scope, which ones does
anything at all measure, which have an emulator nobody rules on,
which are declared and untouched, and what is the next actionable
name in each of those classes.
THE DENOMINATOR IS PUBLISHED. knowledge/isa_targets.conf is the
population and it is READ, never inferred. A coverage ratio whose
denominator is "the ISAs I happened to think of" flatters itself by
omission; 14 of 122 is an honest number and 14 of 14 is not.
impl AND ext ROWS ARE NOT TARGETS AND ARE EXCLUDED FROM EVERY
EMITTER/EMULATOR RATIO. An impl row is a HOST that implements another
row's ISA (Phytium implements aarch64) and an ext row is an EXTENSION
of a base ISA (SVE extends aarch64). Counting either in a codegen
ratio double-counts the base ISA and inflates the number in the one
direction nobody audits. They get their own named state,
NOT-A-TARGET, so they are visible and excluded at the same time.
HOW A NEW ISA JOINS -- NO EDIT TO THIS ORGAN, EVER:
1. add a row to knowledge/isa_targets.conf. It reads DECLARED-ONLY.
2. write buildroot/runtime/nx_emu_<id>.nx. It reads EMULATOR-ONLY.
3. write buildroot/runtime/nx_isa_<id>_gate.nx, or import
nx_emu_<id>.nx from nx_isa_conform_gate.nx. It reads
GATE-PRESENT-UNRUN.
4. let that gate bank "<id> <passed>" into
knowledge/status/isa_<id>.ratchet, or into the core gate's
shared knowledge/status/isa_conform.ratchet. It reads
MEASURED-GREEN.
If the organs are already named something other than the conf id, add
ONE row to knowledge/isa_emu_alias.conf. That file is DATA and the
manager reports how many rows it used and names any alias whose id is
not in the population, because an alias for an undeclared id is a
typo that silently hides a target.
DISCOVERY IS A PROBE, NOT A LIST. There is no array of architecture
dependencies 2 imports · 0 importers
imports: nx_gate_verdict.nxnx_syscalls.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
| 75 | const IM_CONF_NAME: *u8 = "isa_targets.conf" |
| 76 | const IM_ALIAS_NAME: *u8 = "isa_emu_alias.conf" |
| 77 | const IM_CORE_GATE: *u8 = "nx_isa_conform_gate.nx" |
| 78 | const IM_CORE_RATCH: *u8 = "status/isa_conform.ratchet" |
| 79 | const IM_RATCH_PRE: *u8 = "status/isa_" |
| 80 | const IM_RATCH_SUF: *u8 = ".ratchet" |
| 81 | const IM_EMU_PRE: *u8 = "nx_emu_" |
| 82 | const IM_GATE_PRE: *u8 = "nx_isa_" |
| 83 | const IM_GATE_SUF: *u8 = "_gate.nx" |
| 84 | const IM_NX_SUF: *u8 = ".nx" |
| 90 | const IM_ROOTS: i64 = 4 |
| 97 | const IM_KROOTS: i64 = 2 |
| 106 | const IM_MAX_TARGETS: i64 = 512 |
| 107 | const IM_MAX_ALIAS: i64 = 256 |
| 108 | const IM_PATH_BYTES: i64 = 1024 |
| 109 | const IM_SLICE_BYTES: i64 = 256 |
| 110 | const IM_BOX_BYTES: i64 = 16 |
| 111 | const IM_ALIAS_COLS: i64 = 4 |
| 112 | const IM_WORD: i64 = 8 |
| 113 | const IM_ALIAS_TAG: i64 = 6 |
| 114 | const IM_ISA_TAG: i64 = 4 |
| 121 | const IM_FIELDS_AFTER_TAG: i64 = 6 |
| 128 | const IM_GATE_FLOOR: i64 = 6 |
| 129 | const IM_EMU_FLOOR: i64 = 6 |
| 132 | const IM_NL: i64 = 10 |
| 133 | const IM_CR: i64 = 13 |
| 134 | const IM_SPACE: i64 = 32 |
| 135 | const IM_PIPE: i64 = 124 |
| 136 | const IM_DIG_LO: i64 = 48 |
| 137 | const IM_DIG_HI: i64 = 57 |
| 138 | const IM_BYTE_M: i64 = 255 |
| 139 | const IM_PERMIL: i64 = 1000 |
| 140 | const IM_B10: i64 = 10 |
| 141 | const IM_SEEK_END: i64 = 2 |
| 142 | const IM_NUL: i64 = 0 |
| 147 | const IM_C_CPU: i64 = 0 |
| 148 | const IM_C_MCU: i64 = 1 |
| 149 | const IM_C_GPU: i64 = 2 |
| 150 | const IM_C_ACCEL: i64 = 3 |
| 151 | const IM_C_DSP: i64 = 4 |
| 152 | const IM_C_VM: i64 = 5 |
| 153 | const IM_C_FPGA: i64 = 6 |
| 154 | const IM_C_LEGACY: i64 = 7 |
| 155 | const IM_C_IMPL: i64 = 8 |
| 156 | const IM_C_EXT: i64 = 9 |
| 157 | const IM_C_NISHI: i64 = 10 |
| 158 | const IM_C_UNKNOWN: i64 = 11 |
| 159 | const IM_C_COUNT: i64 = 12 |
| 180 | const IM_S_UNSET: i64 = -1 |
| 181 | const IM_S_GREEN: i64 = 0 |
| 182 | const IM_S_RED: i64 = 1 |
| 183 | const IM_S_UNRUN: i64 = 2 |
| 184 | const IM_S_EMUONLY: i64 = 3 |
| 185 | const IM_S_DECLARED: i64 = 4 |
| 186 | const IM_S_NOTARGET: i64 = 5 |
| 187 | const IM_S_COUNT: i64 = 6 |
| 405 | const IM_A_IDOFF: i64 = 0 |
| 406 | const IM_A_IDLEN: i64 = 1 |
| 407 | const IM_A_CLS: i64 = 2 |
| 408 | const IM_A_SRC: i64 = 3 |
| 409 | const IM_A_SOFF: i64 = 4 |
| 410 | const IM_A_SLEN: i64 = 5 |
| 411 | const IM_A_STATE: i64 = 6 |
| 412 | const IM_A_SCORE: i64 = 7 |
| 413 | const IM_A_GATE: i64 = 8 |
| 414 | const IM_A_EMU: i64 = 9 |
| 415 | const IM_A_RATSRC: i64 = 10 |
| 416 | const IM_A_COUNT: i64 = 11 |
| 418 | const IM_SRC_CONF: i64 = 0 |
| 419 | const IM_SRC_ALIAS: i64 = 1 |
| 423 | const IM_RS_NONE: i64 = 0 |
| 424 | const IM_RS_PER: i64 = 1 |
| 425 | const IM_RS_CORE: i64 = 2 |
functions
| 91 | func im_root(i: i64) -> *u8 |
| 98 | func im_kroot(i: i64) -> *u8 called by 1: im_kread |
| 161 | func im_class_name(c: i64) -> *u8 called by 1: main |
| 189 | func im_state_name(s: i64) -> *u8 called by 1: main |
| 199 | func im_state_meaning(s: i64) -> *u8 called by 1: main |
| 211 | func im_nl() -> i64 |
| 219 | func im_slice_eq(buf: *u8, off: i64, len: i64, s: *u8) -> i64 |
| 233 | func im_slice_eq_slice(a: *u8, ao: i64, al: i64, b: *u8, bo: i64, bl: i64) -> i64 |
| 244 | func im_cat_slice(d: *u8, o: i64, buf: *u8, off: i64, len: i64) -> i64 |
| 257 | func im_puts_slice(scratch: *u8, buf: *u8, off: i64, len: i64) -> i64 |
| 268 | func im_exists(path: *u8) -> i64 |
| 279 | func im_probe_roots(scratch: *u8, pre: *u8, buf: *u8, off: i64, len: i64, suf: *u8) -> i64 |
| 297 | func im_kread(scratch: *u8, name: *u8, lenbox: *i64) -> *u8 |
| 313 | func im_contains(buf: *u8, n: i64, s: *u8) -> i64 called by 1: im_contains_slug |
| 339 | func im_contains_slug(scratch: *u8, buf: *u8, n: i64, pre: *u8, sb: *u8, so: i64, sl: i64, suf: *u8) -> i64 |
| 352 | func im_digits_at(buf: *u8, n: i64, p0: i64) -> i64 called by 1: im_ratchet_score |
| 376 | func im_ratchet_score(buf: *u8, n: i64, sb: *u8, so: i64, sl: i64) -> i64 |
| 426 | func im_ratsrc_name(r: i64) -> *u8 called by 1: main |
| 432 | func im_cell(tab: *i64, i: i64, f: i64) -> i64 { return tab[i * IM_A_COUNT + f] } called by 1: main |
| 433 | func im_setcell(tab: *i64, i: i64, f: i64, v: i64) -> i64 called by 1: main |
| 438 | func im_permil(a: i64, b: i64) -> i64 called by 1: main |
| 443 | func im_class_of(buf: *u8, off: i64, len: i64) -> i64 |
| 461 | func im_is_target(c: i64) -> i64 called by 1: main |
| 471 | func im_classify(is_target: i64, score: i64, gate: i64, emu: i64) -> i64 called by 1: main |
| 482 | func main(argc: i64, argv: *i64) -> i64 |