code wiki / _hdl_build / nx_eff_conv.nx
nx_eff_conv.nx
buildroot/runtime/_hdl_build/nx_eff_conv.nx
about
nx_eff_conv.nx -- pure spend->money/energy conversion core (eff lane). SYSCALL-FREE integer math,
so it compiles anywhere (NAS buildroot incl older toolchains) -- decoupled from the getdents/fstatat
SCAN code in nx_eff_lib so the board (a plane READER) never drags scan syscalls into its compile.
Shared by nx_eff_lib (scan CLI) AND nx_eff_board_lib (ROI board) = DRY (rule 15).
Coefficients DECLARED + emitted transparently by every consumer (rule 11, operator "non-fake numbers").
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 0 imports · 2 importers
imports: none
imported by: nx_eff_board_lib.nxnx_eff_probe.nx
structs
| none |
consts
| 9 | const EFL_W_IN: i64 = 100 |
| 10 | const EFL_W_OUT: i64 = 500 |
| 11 | const EFL_W_CR: i64 = 10 |
| 12 | const EFL_W_CW: i64 = 125 |
| 13 | const EFL_CENTS_PER_MTOK_IN: i64 = 1500 // uncached input $15.00/Mtok (Opus-class UPPER-BOUND default; editable) |
| 14 | const EFL_MONEY_DIV: i64 = 100000000 // bp(x100) x per-Mtok(1e6) normalizer |
| 22 | const EFL_WH_ENERGY_DIV: i64 = 1000000 |
| 40 | const EFL_T_FABLE: i64 = 0 |
| 41 | const EFL_T_OPUS: i64 = 1 |
| 42 | const EFL_T_SONNET: i64 = 2 |
| 43 | const EFL_T_HAIKU: i64 = 3 |
| 44 | const EFL_T_OTHER: i64 = 4 |
| 45 | const EFL_NTIER: i64 = 5 |
| 46 | const EFL_RATE_FABLE: i64 = 1000 // Fable 5 / Mythos 5 base input $10.00/Mtok |
| 47 | const EFL_RATE_OPUS: i64 = 500 // Opus 4.5-4.8 base input $5.00/Mtok |
| 48 | const EFL_RATE_SONNET: i64 = 300 // Sonnet 4.5/4.6 $3 (Sonnet 5 intro $2 is lower -> conservative-high) |
| 49 | const EFL_RATE_HAIKU: i64 = 100 // Haiku 4.5 base input $1.00/Mtok |
| 50 | const EFL_RATE_OTHER: i64 = 500 // unknown model -> Opus-ish conservative |
functions
| 24 | func efl_weighted_bp(ti: i64, to_: i64, cr: i64, cw: i64) -> i64 { return ti*EFL_W_IN + to_*EFL_W_OUT + cr*EFL_W_CR + cw*EFL_W_CW } |
| 26 | func efl_cost_cents(ti: i64, to_: i64, cr: i64, cw: i64) -> i64 |
| 31 | func efl_energy_wh(ti: i64, to_: i64, cr: i64, cw: i64) -> i64 |
| 51 | func efl_tier_rate(tier: i64) -> i64 called by 1: efl_cost_tier |
| 59 | func efl_cost_tier(tier: i64, ti: i64, to_: i64, cr: i64, cw: i64) -> i64 called by 5: eb_realcosteb_emit_jsoneb_emit_htmles_emites_selftest calls 2: efl_weighted_bpefl_tier_rate |