code wiki / _hdl_build / nx_eff_board_lib.nx
nx_eff_board_lib.nx
buildroot/runtime/_hdl_build/nx_eff_board_lib.nx
about
nx_eff_board_lib.nx -- shared core for the efficiency / ROI-investment board (eff lane F732).
Split lib+CLI+gate like nx_pm_roi_lib (D001 gate-able). Reads the eff- plane (measured spend rows
seeded laptop-side by nx_eff_scan) + the roi- plane (value, same plane the pm-cockpit reads),
converts via nx_eff_lib's DECLARED coefficients, emits JSON/HTML. Fail-closed: unseeded -> UNSEEDED,
no fabricated spend. This is the COST/INVESTMENT half of ROI (value half = nx_pm_cockpit).
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 2 importers
imports: nx_eff_conv.nxnx_store_seed_lib.nx
imported by: nx_eff_board.nxnx_eff_board_gate.nx
structs
| none |
consts
| 9 | const EB_MAGIC_3600: i64 = 3600 |
| 10 | const EB_MAGIC_1000000: i64 = 1000000 |
| 12 | const EB_PLANE_CAP: i64 = 524288 |
| 13 | const EB_OUT_CAP: i64 = 262144 |
| 14 | const EB_MAXCOL: i64 = 16 |
| 15 | const EB_MONTH_DAYS: i64 = 30 |
| 16 | const EB_TAB: i64 = 9 |
| 17 | const EB_NL: i64 = 10 |
| 18 | const EB_HASH: i64 = 35 |
| 19 | const EB_ZERO: i64 = 48 |
| 20 | const EB_NINE: i64 = 57 |
| 21 | const EB_HTMLH: i64 = 104 |
| 22 | const EB_MAXDAYS: i64 = 28 |
| 23 | const M_ACT: i64 = 0 |
| 24 | const M_SEC: i64 = 1 |
| 25 | const M_TIN: i64 = 2 |
| 26 | const M_TOUT: i64 = 3 |
| 27 | const M_TCR: i64 = 4 |
| 28 | const M_TCW: i64 = 5 |
| 29 | const M_DAYS: i64 = 6 |
| 30 | const M_WIN: i64 = 7 |
| 31 | const M_TRUNC: i64 = 8 |
| 32 | const M_TRF: i64 = 9 |
| 33 | const M_GEN: i64 = 10 |
| 34 | const M_MCP: i64 = 11 |
| 35 | const M_SH: i64 = 12 |
| 36 | const M_FILE: i64 = 13 |
| 37 | const M_AVAIL: i64 = 14 |
| 38 | const M_ROIAV: i64 = 15 |
| 39 | const M_ROICENTS: i64 = 16 |
| 40 | const M_MODBASE: i64 = 20 // 20 slots: m[M_MODBASE + tier*4 + class] (class 0=in 1=out 2=cr 3=cw) |
| 41 | const M_MODSEEN: i64 = 40 // 1 if per-model rows present -> real cost available |
functions
| 43 | func eb_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 44 | func eb_cols(buf: *u8, ls: i64, le: i64, sp: *i64) -> i64 |
| 59 | func eb_slice_int(buf: *u8, a: i64, b: i64) -> i64 |
| 65 | func eb_slice_eq(buf: *u8, a: i64, b: i64, lit: *u8) -> i64 |
| 72 | func eb_is_dayrow(buf: *u8, a: i64, b: i64) -> i64 called by 1: eb_eff_scan |
| 80 | func eb_modrow_tier(buf: *u8, a: i64, b: i64) -> i64 called by 1: eb_eff_scan |
| 91 | func eb_realcost(m: *i64) -> i64 |
| 103 | func eb_cost_per_action(cost: i64, actions: i64) -> i64 { if actions <= 0 { return 0 } return cost / actions } |
| 106 | func eb_cache_ratio_pct(m: *i64) -> i64 |
| 111 | func eb_eff_scan(buf: *u8, n: i64, m: *i64) -> i64 |
| 156 | func eb_roi_value(buf: *u8, n: i64, m: *i64) -> i64 |
| 179 | func eb_money(d: *u8, o: i64, cents: i64) -> i64 called by 1: eb_emit_html |
| 191 | func eb_monthly(v: i64, win: i64) -> i64 { if win <= 0 { return v } return v * EB_MONTH_DAYS / win } |
| 193 | func eb_emit_json(out: *u8, m: *i64) -> i64 called by 2: mainmain calls 8: efl_cost_centseb_realcostefl_energy_wheb_monthlyefl_cost_tiersys_now_realtime_sec+2 |
| 280 | func eb_emit_html(out: *u8, m: *i64) -> i64 called by 2: mainmain calls 9: efl_cost_centseb_realcosteb_monthlyefl_energy_whefl_cost_tiereb_cost_per_action+3 |