code wiki / _hdl_build / nx_alu_netlist_test.nx

nx_alu_netlist_test.nx

buildroot/runtime/_hdl_build/nx_alu_netlist_test.nx

4205 B86 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic alu
docsdependenciesstructsconstsfunctions

about

nx_alu_netlist_test.nx -- VERIFIER on the REAL ALU op-select topology (SIL-3 closure, layer-7). Builds a 3-op (ADD/SUB/DIV) ALU netlist using the EXACT structure the .nxgate ALU emitter (synth_emit_alu_gates.nx) emits: per op a CONST(opcode) + a binop subnet + an EQ(op_in==opcode) match, then a cascade MUX(match, this, prev). DIV is emitted as an ADD cell -- the SIL-1 stub (emitter lines 151-158, "TODO_SILICON proper divider"). Simulating over op_in proves: the correct ops (ADD/SUB) match the behavioral ALU, and DIV (= a+b stub) DIVERGES from behavioral a/b -- the verifier CATCHES the silent gate-emit miscompile via op-selection (what structural-only smokes miss). a=20 b=4. Known answer (FAIL LOUD): "24 24 16 16 24 5 " = res_add beh_add res_sub beh_sub res_div beh_div. (res_div=24 != beh=5 -> caught)

dependencies 1 imports · 0 importers

nx_nxgate_sim.nx nx_alu_netlist_test.nx

imports: nx_nxgate_sim.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main _setcell nx_gsim_run nx_gsim_kind_supported nx_gsim_eval_cell _emit_num _nl

structs

none

consts

none

functions

18func _emit_num(v: i64) -> i64
called by 1: main
26func _nl() -> i64 { let z: *u8 = sys_mmap(2); z[0] = 10; sys_write(1, z, 1); return 0 }
called by 1: main
28func _setcell(cells: *NxGsimCell, id: i64, kind: i64, fanout: i64, f0: i64, f1: i64, f2: i64) -> i64
called by 1: main
37func main() -> i64