code wiki / _hdl_build / nx_nrtl.nx
nx_nrtl.nx
buildroot/runtime/_hdl_build/nx_nrtl.nx
about
nx_nrtl.nx -- LIB: NHDL H3+H4 -- sovereign RTL + SYNTHESIS (the Yosys competitor). H1/H2 gave a netlist format +
hierarchy that you EMIT from a fabric; this is the layer you AUTHOR in: a tiny RTL where you write bus-level
equations, and a SYNTHESIZER that LOWERS them to the LUT4 fabric -- reusing the proven fabric builders (ripple
adder, per-bit logic LUTs) + fab_append (R32a) to compose. Author 3 lines of RTL -> a 32-gate netlist, sovereignly.
NRTL GRAMMAR (v1): single-char bus names (a,b,t,u,y...), 3-address combinational statements.
.nrtl 1
.module <name> <W> # bus width W
.in a b # input buses (each W bits; assigned PI nets in order)
.out y # the output bus
t = a & b # one binary op per statement: & (AND) | (OR) ^ (XOR) + (ADD), bit-parallel @ W
u = a ^ b
y = t + u
.end
SYNTHESIS: each statement -> build the op's fabric sub-network (logic LUTs or the ripple adder), fab_append it
wiring its inputs to the operand buses' nets; the result bus = the appended outputs. The output bus -> the POs.
NEVER-BRICK (#26): pure memory, bounded, deterministic, zero hardware-state writes. license_tier: ORIGINAL
dependencies 6 imports · 5 importers
imports: nx_nhdl.nxnx_fpga_compose.nxnx_fpga_adder.nxnx_fpga_lut.nxnx_fpga_fabric.nxnx_syscalls.nx
imported by: nx_nbit_gate.nxnx_nhdl_perf_gate.nxnx_nhdl_scorecard_gate.nxnx_nrtl_gate.nxnx_nrtl_opt_gate.nx
structs
| none |
consts
| none |
functions
| 26 | func nr_rdc(buf: *u8, pp: *i64, len: i64) -> i64 { let p: i64=nh_skip_ws(buf,pp[0],len); let c: i64=buf[p] as i64; pp[0]=p+1; return c } |
| 29 | func build_bitop(W: i64, flk: i64, init: *i64, src: *i64, po: *i64) -> i64 |
| 38 | func nrtl_synth(buf: *u8, len: i64, cinit: *i64, csrc: *i64, ckind: *i64, cpo: *i64, outnpi: *i64, outnpo: *i64, outW: *i64) -> i64 called by 6: mainrun_flowmainmainmainmain calls 9: sys_mmapnh_skip_wordnh_rd_intnh_skip_wsnr_rdcfab_build_ripple_adder+3 |