code wiki / _hdl_build / nx_fpga_fabric.nx

nx_fpga_fabric.nx

buildroot/runtime/_hdl_build/nx_fpga_fabric.nx

2777 B49 linesdepth 3pulls 3 transitivereach 76 importersview sourcekind librarytopic fpga
docsdependenciesstructsconstsfunctions

about

nx_fpga_fabric.nx -- LIB: RUNG 5 of the sovereign FPGA-boot sim. A FABRIC is an array of LUT4 cells wired together by ROUTING; a BITSTREAM is (per-cell LUT init + per-input wire source). fabric_eval executes the fabric driven ONLY by the bitstream -- exactly what a real FPGA does after configuration: it no longer knows the source netlist, only the loaded SRAM bits. This is the leap from "one LUT" (rung 4) to "a configured fabric computes a real multi-gate circuit." Builds on nx_fpga_lut (lut4_eval). WIRE SOURCE ENCODING (the routing): an input source `s` is a primary-input index if s < npi, else it is the output of cell (s - npi). Cells are evaluated in index order, so a topologically-sorted fabric (cell k only wires from PIs or cells < k) is a single forward pass -- no comb loop (and the gate proves outputs are total). BITSTREAM layout (flat i64 arrays, caller-owned -- never-brick #26: pure memory, no real hardware write): ncells, npi init[k] 16-bit LUT SRAM for cell k src[k*4 + 0..3] the 4 input wire sources for cell k npo, po_src[p] each primary output's wire source license_tier: ORIGINAL

dependencies 2 imports · 37 importers

nx_fpga_lut.nx nx_syscalls.nx nx_fpga_fabric.nx fn_authored2_test.nx fn_authored_test.nx nx_fpga_adder.nx nx_fpga_adder_gate.nx nx_fpga_addsub.nx nx_fpga_alu.nx nx_fpga_bitstream.nx nx_fpga_bitstream_gate.nx nx_fpga_board_anim_gate.nx nx_fpga_board_gate.nx

diagram shows first 10 each side; +0 more imports, +27 more importers in the complete lists below.

imports: nx_fpga_lut.nxnx_syscalls.nx

imported by: fn_authored2_test.nxfn_authored_test.nxnx_fpga_adder.nxnx_fpga_adder_gate.nxnx_fpga_addsub.nxnx_fpga_alu.nxnx_fpga_bitstream.nxnx_fpga_bitstream_gate.nxnx_fpga_board_anim_gate.nxnx_fpga_board_gate.nxnx_fpga_cmp.nxnx_fpga_compose.nxnx_fpga_compose_gate.nxnx_fpga_dc.nxnx_fpga_decode.nxnx_fpga_fabric_gate.nxnx_fpga_pc.nxnx_fpga_pnr.nxnx_fpga_pnr_gate.nxnx_fpga_ram.nxnx_fpga_regfile.nxnx_fpga_rexec.nxnx_fpga_rexec_gate.nxnx_fpga_seq.nxnx_fpga_shift.nxnx_fpga_verilog_gate.nxnx_fpga_verilog_seq_gate.nxnx_jtag_load_gate.nxnx_nhdl_gate.nxnx_nhdl_hier.nxnx_nhdl_hier_gate.nxnx_nhdl_perf_gate.nxnx_nhdl_scorecard_gate.nxnx_nrtl.nxnx_nrtl_gate.nxnx_nrtl_opt.nxnx_nrtl_opt_gate.nx

structs

none

consts

none

functions

21func fab_resolve(s: i64, npi: i64, pi: *i64, cellout: *i64) -> i64
28func fab_eval(ncells: i64, npi: i64, inits: *i64, src: *i64, pi: *i64, cellout: *i64) -> i64
42func fab_po(po_src: i64, npi: i64, pi: *i64, cellout: *i64) -> i64
49func fab_tt_to_init(tt: i64) -> i64 { return tt & 0xffff }