code wiki / _hdl_build / nx_evo_isa.nx

nx_evo_isa.nx

buildroot/runtime/_hdl_build/nx_evo_isa.nx

8646 B178 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic evo
docsdependenciesstructsconstsfunctions

about

nx_evo_isa.nx -- DEEPEST / hardware rung up: autonomous compose+derive grounded in the REAL genesis ISA. The search's primitives are the actual RV64IM ALU ops that rv64im_min_sim (god) executes -- ADD/SUB/MUL/AND/OR/SLT/REM/DIV on a register machine (r0=0, r1=a, r2=b, r3=acc) -- NOT Claude-arbitrary arithmetic. Per seed: COMPOSE a random non-trivial target RV64 program T, DERIVE a program G matching T's examples (search sees only (a,b)->T(a,b)), VERIFY G==T on HELD-OUT. So the substrate's GRAMMAR is the hardware's own instruction set, tracing to god. The derived organ is real RV64 machine code: encodable by the enc_r we derived (compounding) and runnable on the sim (the closing rung, named follow-on). op semantics are RV64-faithful (i64 = 64-bit signed; rem/div-by-0 per the RISC-V spec). license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_evo_isa.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main isa_run sys_mmap isa_compose isa_setinstr ia_rand isa_eval ia_reg isa_op ia_p sys_write ia_pn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap isa_derive sys_mmap ↻ isa_setinstr ↻ isa_fit ia_pa ia_pb isa_eval ↻ ia_abs isa_tourney ia_rand ↻ ia_rand ↻ isa_mut ia_rand ↻ isa_eval ↻ ia_pa ↻ ia_pb ↻ ia_p ↻ ia_pn ↻ sys_exit

structs

none

consts

13const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757
14const EVO_MAGIC_3037000493: i64 = 3037000493
15const EVO_MAGIC_8000000: i64 = 8000000
16const EVO_MAGIC_4000000: i64 = 4000000
17const EVO_MAGIC_1000000000: i64 = 1000000000
18const EVO_MAGIC_2654435761: i64 = 2654435761
19const EVO_MAGIC_12345: i64 = 12345
21const NINSTR: i64 = 4
22const GLEN: i64 = 12 // NINSTR * 3 (op, rs1, rs2) per instruction; rd = r3 fixed
23const EVO_P: i64 = 320
24const EVO_G: i64 = 2000
25const EVO_T: i64 = 5
26const NTRAIN: i64 = 6
27const NPTS: i64 = 10

functions

29func ia_rand(s: *i64) -> i64 { s[0] = s[0] * EVO_MAGIC_2862933555777941757 + EVO_MAGIC_3037000493; return (s[0] >> 17) & 0x3fffffff }
30func ia_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
called by 1: isa_fit
31func ia_pa(i: i64) -> i64 { if i==0 {return 6} if i==1 {return 4} if i==2 {return 9} if i==3 {return 5} if i==4 {return 7} if i==5 {return 2} if i==6 {return 8} if i==7 {return 3} if i==8 {return 10} return 1 }
called by 2: isa_fitisa_run
32func ia_pb(i: i64) -> i64 { if i==0 {return 4} if i==1 {return 7} if i==2 {return 2} if i==3 {return 9} if i==4 {return 3} if i==5 {return 5} if i==6 {return 1} if i==7 {return 6} if i==8 {return 4} return 8 }
called by 2: isa_fitisa_run
35func isa_op(op: i64, x: i64, y: i64) -> i64
called by 1: isa_eval
46func ia_reg(idx: i64, r1: i64, r2: i64, r3: i64) -> i64
called by 1: isa_eval
53func isa_eval(gen: *i64, base: i64, a: i64, b: i64) -> i64
68func isa_setinstr(gen: *i64, j: i64, state: *i64) -> i64
called by 2: isa_composeisa_derive calls 1: ia_rand
76func isa_compose(state: *i64, T: *i64) -> i64
called by 1: isa_run calls 2: isa_setinstrisa_eval
90func isa_fit(pop: *i64, base: i64, T: *i64) -> i64
called by 1: isa_derive calls 4: ia_paia_pbisa_evalia_abs
102func isa_tourney(fit: *i64, state: *i64) -> i64
called by 1: isa_derive calls 1: ia_rand
107func isa_mut(gen: *i64, base: i64, state: *i64) -> i64
called by 1: isa_derive calls 1: ia_rand
115func isa_derive(T: *i64, state: *i64, G: *i64) -> i64
147func ia_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: isa_runmain calls 1: sys_write
152func ia_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: isa_runmain calls 1: nxi_out
154func isa_run(seed: i64) -> i64
167func main() -> i64