code wiki / _hdl_build / nx_nhdl.nx
nx_nhdl.nx
buildroot/runtime/_hdl_build/nx_nhdl.nx
about
nx_nhdl.nx -- LIB: NHDL H1 -- the sovereign Nishi netlist format (a Verilog COMPETITOR, not a Verilog emit).
Operator 2026-06-26: "verilog should only be a benchmark build our own verilog competitor in nishi ecosystem
from the hardware rung up each rung." So instead of serializing our LUT4/DFF fabric to third-party Verilog
(now a benchmark yardstick only), this is OUR OWN textual netlist interchange format -- flat, instance-based
(cells=instances, nets=wires; the canonical netlist structure per the researched Wikipedia 'Netlist' entry:
a header + a per-instance table, one line per entry, space-separated fields). Designed to round-trip the
fabric byte-exact AND to be far more compact than Verilog's verbose `assign comb[k]=(INIT>>(...))&1; //@C...`.
GRAMMAR (v1):
.nhdl 1
.module <name> <npi> <npo> <ncells>
L <init> <s0> <s1> <s2> <s3> # a LUT4 cell (combinational): 16-bit init + 4 input nets
D <dsrc> # a DFF cell (sequential): the D-input net (init unused, Q is caller state)
... (ncells lines, in cell-index order; net s<npi => primary input s, else cell (s-npi)'s output)
.po <net0> <net1> ... <net_{npo-1}>
.end
NEVER-BRICK (#26): pure text emit/parse, bounded, deterministic, zero hardware-state writes. license_tier: ORIGINAL
dependencies 1 imports · 9 importers
imports: nx_syscalls.nx
imported by: nx_nbit.nxnx_nbit_gate.nxnx_nhdl_gate.nxnx_nhdl_hier.nxnx_nhdl_hier_gate.nxnx_nhdl_perf_gate.nxnx_nhdl_scorecard_gate.nxnx_nrtl.nxnx_nrtl_gate.nx
structs
| none |
consts
| none |
functions
| 21 | func nh_ws(buf: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ buf[o]=s[i]; o=o+1; i=i+1 } return o } |
| 22 | func nh_wi(buf: *u8, o: i64, v: i64) -> i64 |
| 33 | func nhdl_emit(buf: *u8, name: *u8, ncells: i64, npi: i64, npo: i64, kind: *i64, init: *i64, src: *i64, po: *i64) -> i64 |
| 57 | func nh_isdig(c: i64) -> i64 { if c<48 { return 0 } if c>57 { return 0 } return 1 } called by 1: nh_rd_int |
| 58 | func nh_isws(c: i64) -> i64 { if c==32 { return 1 } if c==10 { return 1 } if c==9 { return 1 } if c==13 { return 1 } return 0 } |
| 59 | func nh_skip_ws(buf: *u8, p: i64, len: i64) -> i64 { var q: i64=p; var go: i64=1; while go==1 { if q<len { if nh_isws(buf[q] as i64)==1 { q=q+1 } else { go=0 } } else { go=0 } } return q } called by 7: nh_skip_wordnh_rd_intnhdl_parsenh_parse_cellsnhdl_hier_elaboratenr_rdc+1 calls 1: nh_isws |
| 61 | func nh_skip_word(buf: *u8, pp: *i64, len: i64) -> i64 |
| 67 | func nh_rd_int(buf: *u8, pp: *i64, len: i64) -> i64 |
| 78 | func nhdl_parse(buf: *u8, len: i64, kind: *i64, init: *i64, src: *i64, po: *i64, pnpi: *i64, pnpo: *i64) -> i64 |