code wiki / _hdl_build / nx_riscv_codegen.nx
nx_riscv_codegen.nx
buildroot/runtime/_hdl_build/nx_riscv_codegen.nx
about
nx_riscv_codegen.nx -- SOVEREIGN RISC-V backend, RUNG 4: IR -> RISC-V CODEGEN. Now on the GENERAL nx_riscv_lib
(shared encoders, lower w/ regalloc+instr-sel, build_header, emulator) -- only the qmul IR + tests are local.
Lowers qmul(2.0,3.0)=(a*b)>>16 then >>16 (integer part), runs it; retargets when the IR input changes.
T1 lowers to 8 words ending in ecall. T2 run -> exit 6 (2.0*3.0 int part). T3 (teeth) input 2.0->4.0 -> exit 12.
expect_exit: 0 Sovereign: nx_riscv_lib (+ nx_syscalls).
dependencies 2 imports · 0 importers
imports: nx_riscv_lib.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
| 8 | const K_MAGIC_196608: i64 = 196608 |
| 9 | const K_MAGIC_131072: i64 = 131072 |
| 10 | const K_MAGIC_262144: i64 = 262144 |
functions
| 12 | func gen(irimm0: i64) -> i64 { // build the qmul IR with input-a const = irimm0, lower + run, return exit |
| 30 | func main() -> i64 |