code wiki / _hdl_build / nx_evo_isa.nx
nx_evo_isa.nx
buildroot/runtime/_hdl_build/nx_evo_isa.nx
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
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
structs
| none |
consts
| 13 | const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757 |
| 14 | const EVO_MAGIC_3037000493: i64 = 3037000493 |
| 15 | const EVO_MAGIC_8000000: i64 = 8000000 |
| 16 | const EVO_MAGIC_4000000: i64 = 4000000 |
| 17 | const EVO_MAGIC_1000000000: i64 = 1000000000 |
| 18 | const EVO_MAGIC_2654435761: i64 = 2654435761 |
| 19 | const EVO_MAGIC_12345: i64 = 12345 |
| 21 | const NINSTR: i64 = 4 |
| 22 | const GLEN: i64 = 12 // NINSTR * 3 (op, rs1, rs2) per instruction; rd = r3 fixed |
| 23 | const EVO_P: i64 = 320 |
| 24 | const EVO_G: i64 = 2000 |
| 25 | const EVO_T: i64 = 5 |
| 26 | const NTRAIN: i64 = 6 |
| 27 | const NPTS: i64 = 10 |
functions
| 29 | func ia_rand(s: *i64) -> i64 { s[0] = s[0] * EVO_MAGIC_2862933555777941757 + EVO_MAGIC_3037000493; return (s[0] >> 17) & 0x3fffffff } |
| 30 | func ia_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: isa_fit |
| 31 | func 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 } |
| 32 | func 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 } |
| 35 | func isa_op(op: i64, x: i64, y: i64) -> i64 called by 1: isa_eval |
| 46 | func ia_reg(idx: i64, r1: i64, r2: i64, r3: i64) -> i64 called by 1: isa_eval |
| 53 | func isa_eval(gen: *i64, base: i64, a: i64, b: i64) -> i64 |
| 68 | func isa_setinstr(gen: *i64, j: i64, state: *i64) -> i64 |
| 76 | func isa_compose(state: *i64, T: *i64) -> i64 |
| 90 | func isa_fit(pop: *i64, base: i64, T: *i64) -> i64 |
| 102 | func isa_tourney(fit: *i64, state: *i64) -> i64 |
| 107 | func isa_mut(gen: *i64, base: i64, state: *i64) -> i64 |
| 115 | func isa_derive(T: *i64, state: *i64, G: *i64) -> i64 |
| 147 | func 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 } |
| 152 | func ia_pn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 154 | func isa_run(seed: i64) -> i64 |
| 167 | func main() -> i64 |