code wiki / _hdl_build / synth_emit_alu_gates_smoke.nx
synth_emit_alu_gates_smoke.nx
buildroot/runtime/_hdl_build/synth_emit_alu_gates_smoke.nx
about
synth_emit_alu_gates_smoke.nx -- structural smoke for the ALU .nxgate emitter.
ROOT-CAUSE FIX (2026-06-20): synth_emit_alu_gates.nx is a LIBRARY (no main); building it
standalone fails "UNDEFINED label: main" -- that was a build-as-executable mistake, NOT an nxasm
regression. A library organ is verified by its SMOKE GATE (with main), exactly like
synth_emit_regfile_gates_smoke.nx. This is that missing tool: it builds the rv64im_min ALU HDL
module, runs nx_emit_alu_gates into a sink, prints the netlist, then asserts the structural
invariants the emitter MUST satisfy -- well-formed (.NXGATE/.MODULE/.END), complete (4 ports,
~4125 cells, divider-backed), and ON-ENUM (UNKNOWN x 0 = no cell emitted an out-of-enum kind).
.PORT x 4 (op_in, a_in, b_in, result)
.CELL ~4125 (divider-backed: full restoring divider for DIV/DIVU/REM/REMU + 29-op cascade)
.CONST ~498 (opcode + divider/widening constants)
.NET ~4623 (width-complete: every cell drives a declared net; cells <= nets)
UNKNOWN x 0 (the correctness invariant: no out-of-enum cell kind)
NOTE: output is ~270KB -> the sink buffer must be MB-scale (an earlier 262KB buf silently dropped
all cells because nx_synth_emit_bytes is all-or-nothing). Exact cell count tracks the emitter; the
gate floors at >100 + checks ports/end/unknown/width-completeness. Exit 0 = green. CORRECTNESS gate.
Mirrors the proven regfile smoke (same import set, dedup-safe). 100% sovereign.
license_tier: ORIGINAL expect_exit: 0
dependencies 6 imports · 0 importers
imports: nx_syscalls.nxnishi_hdl_primitives.nxnishi_synth.nxnishi_synth_gates.nxrv64im_min_alu.nxsynth_emit_alu_gates.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 27 | func nx_alusmoke_slen(p: *u8) -> i64 |
| 32 | func nx_alusmoke_puts(p: *u8) -> i64 |
| 35 | func nx_alusmoke_putn(v: i64) -> i64 |
| 47 | func nx_alusmoke_count(buf: *u8, used: i64, needle: *u8) -> i64 |
| 65 | func main() -> i64 |