code wiki / _hdl_build / nx_fpga_regfile.nx
nx_fpga_regfile.nx
buildroot/runtime/_hdl_build/nx_fpga_regfile.nx
about
nx_fpga_regfile.nx -- LIB: RUNG 10 -- a REGISTER FILE on the SEQUENTIAL fabric (the core CPU storage). R
registers x W bits of DFF state; an addressed WRITE port (waddr,wdata,we -- clocked: reg[waddr]<-wdata on TICK
iff we) and an addressed combinational READ port (raddr -> reg[raddr]). Register 0 (x0) is HARDWIRED to 0
(its DFF D = const0; always reads 0). Address decode = ONE LUT4 per register (init 1<<r over the addr bits,
unused LUT pins tied to const0) -- works for R<=16 (AB<=4); R=32 needs a 2-level decode (a follow-on). Read =
decode-then-gated-OR (exactly one register selected). Built on nx_fpga_seq (DFF + seq_tick) + nx_fpga_lut.
PIs (npi = 2*AB + W + 1): raddr[0..AB-1] | waddr[AB..2AB-1] | wdata[2AB..2AB+W-1] | we[2AB+W].
NEVER-BRICK (#26): bounded state (caller-owned q[]), bounded tick, deterministic, x0 invariant, no hw write.
license_tier: ORIGINAL
dependencies 4 imports · 13 importers
diagram shows first 10 each side; +0 more imports, +3 more importers in the complete lists below.
imports: nx_fpga_seq.nxnx_fpga_lut.nxnx_fpga_fabric.nxnx_syscalls.nx
imported by: nx_fpga_boot_gate.nxnx_fpga_cpu2_gate.nxnx_fpga_cpu3_gate.nxnx_fpga_cpu4_gate.nxnx_fpga_cpu5_gate.nxnx_fpga_cpu6_gate.nxnx_fpga_cpu7_gate.nxnx_fpga_cpu8_gate.nxnx_fpga_cpu9_gate.nxnx_fpga_cpu_dc_gate.nxnx_fpga_cpu_gate.nxnx_fpga_ecall_gate.nxnx_fpga_regfile_gate.nx
structs
| none |
consts
| none |
functions
| 17 | func rf_addr_inputs(src: *i64, cell: i64, addr0_pi: i64, ab: i64, const0_src: i64) -> i64 called by 1: seq_build_regfile |
| 26 | func seq_build_regfile(R: i64, W: i64, AB: i64, kind: *i64, init: *i64, src: *i64, po_src: *i64) -> i64 |
| 115 | func rf_ncells(R: i64, W: i64) -> i64 { return (R*W) + 1 + R + R + (R-1)*W + R + R*W + W*(R-1) } |
| 118 | func rf_write(R: i64, W: i64, AB: i64, kind: *i64, init: *i64, src: *i64, pi: *i64, cellout: *i64, q: *i64, addr: i64, val: i64) -> i64 |
| 129 | func rf_read(R: i64, W: i64, AB: i64, kind: *i64, init: *i64, src: *i64, pi: *i64, cellout: *i64, q: *i64, po_src: *i64, addr: i64) -> i64 |