nx_nxgate_sim.nx
buildroot/runtime/nx_nxgate_sim.nx
about
nx_nxgate_sim.nx -- gate-level FUNCTIONAL simulator: the VERIFIER organ's
hardware oracle (closes SIL-3, "no gate-level functional verification").
The .nxgate netlist (nishi_synth_gates.nx) is word-level cells: each cell is
a kind (ADD/SUB/MUX/EQ/AND/...) with a fanout net + fanin nets. This module
evaluates such a netlist over input vectors so we can assert it computes 1:1
what the behavioral RTL (rv64im_min_alu.nx) computes. WHY this matters: the
ALU gate emitter currently emits an ADD cell for DIV/REM (the SIL-1 stub), so
a faithful functional sim will DIVERGE from behavioral DIV -- i.e. it CATCHES
the silent gate-emit miscompile that today's structural-only smokes miss.
V1: combinational, word-level, 64-bit (i64) values; cells assumed in
topological order (the synth emitter builds sub-results before consumers).
LOUD on any unsupported/sequential kind -- never silently miscomputes
(Cardinal: build intelligence, fail loud). Reuses the real NX_GATE_KIND_*
enum from nishi_synth_gates.nx (single source of truth -- DRY).
5W1H feedback hook: nx_gsim_diff returns the mismatch count; a future variant
records WHICH vector + WHICH net diverged + the expected-vs-got, the actionable
diagnostic the invention loop's Generator consumes.
dependencies 1 imports · 9 importers
imports: nishi_synth_gates.nx
imported by: nx_alu_divider.nxnx_alu_netlist_build.nxnx_alu_netlist_test.nxnx_cell_sink.nxnx_eqsat.nxnx_gate_energy_test.nxnx_gsim_seq_test.nxnx_latency_metric.nxnx_nxgate_sim_test.nx
structs
| 24 | struct NxGsimCell |
| 33 | struct NxGsim |
consts
| 40 | const NX_GSIM_OK: i64 = 0 |
| 41 | const NX_GSIM_BAD_KIND: i64 = 1 |
functions
| 46 | func nx_gsim_kind_supported(k: i64) -> i64 |
| 74 | func nx_gsim_eval_cell(kind: i64, a: i64, b: i64, c: i64) -> i64 |
| 110 | func nx_gsim_run(g: *NxGsim) -> i64 |
| 140 | func nx_gsim_tick(g: *NxGsim, dtmp: *i64) -> i64 |