code wiki / _hdl_build / nx_pattern_emit_rtlsynth.nx

nx_pattern_emit_rtlsynth.nx

buildroot/runtime/_hdl_build/nx_pattern_emit_rtlsynth.nx

4859 B100 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic pattern
docsdependenciesstructsconstsfunctions

about

nx_pattern_emit_rtlsynth.nx -- PATTERN EMITTER: RTL_SYNTH (shape 23). Authors a SYNTHESIS core that LOWERS a 3-address op-DAG spec (the NRTL statement shape: dst = s1 OP s2) to a baked dataflow computation -- bit-parallel AND/OR/XOR/ADD over i64 lanes, statements composed by data dependency (a src refs an input or a prior result). 3rd of the session's 5-emitter autonomy backlog; a MEATIER core than the rank emitters (it bakes a whole DAG), proving the template handles non-trivial shapes. TEAM-AUTHORABLE hands-off (author=emitter, no Claude logic). spec[0]=ninputs (>=1) spec[1]=nstmts (1..16) spec[2+3*i]=op (0 AND,1 OR,2 XOR,3 ADD) spec[3+3*i]=src1 spec[4+3*i]=src2 src r: r<ninputs -> inp[r]; else -> t(r-ninputs) (a prior statement, r<ninputs+i) Authored fn: <name>_compute(inp: *i64) -> i64 (returns the last statement's result) EMIT-TIME RAILS: ninputs<1, nstmts outside 1..16, op outside 0..3, or a forward/oob src -> REFUSED. ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_pattern_emit_rtlsynth.nx nx_pattern_emit_rtlsynth_demo.nx

imports: nx_syscalls.nx

imported by: nx_pattern_emit_rtlsynth_demo.nx

structs

none

consts

none

functions

13func prs_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd, s, n); return 0 }
14func prs_wn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(fd,bb,k); return 0 }
16func prs_spec_ok(spec: *i64) -> i64
called by 1: pe_rs_author
36func prs_eval(spec: *i64, inp: *i64) -> i64
calls 1: sys_mmap
54func prs_emit_ref(fd: i64, r: i64, ni: i64) -> i64
calls 2: prs_wprs_wn
58func prs_emit_op(fd: i64, op: i64) -> i64
calls 1: prs_w
66func pe_rs_emit_core(fd: i64, name: *u8, spec: *i64) -> i64
called by 1: pe_rs_author calls 2: prs_wprs_wn
81func pe_rs_emit_test(fd: i64, name: *u8, spec: *i64) -> i64
93func pe_rs_author(name: *u8, modpath: *u8, testpath: *u8, spec: *i64) -> i64