code wiki / _hdl_build / nx_boolsynth4.nx

nx_boolsynth4.nx

buildroot/runtime/_hdl_build/nx_boolsynth4.nx

3374 B79 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_boolsynth4.nx -- L8 gate-level synthesis, 4-input (extends the team's proven 3-input superopt up the hardware rung). The team AUTHORS a minimal straight-line circuit for any 4-input boolean function by SEARCH, and the result is verified EXACTLY and FREE by the truth-table-as-bitmask trick: drive the four inputs with the columns 0xAAAA / 0xCCCC / 0xF0F0 / 0xFF00, and the 16-bit output word IS the function's truth table -- so circuit==target is one integer compare, all 16 rows at once, no execution. Gate count is a DETERMINISTIC counted invariant (nx_cost_oracle), so the win vs a naive sum-of-products baseline is judged objectively, not by wall-clock or self-assessment. Honest scope: the search is the chain class (each gate combines the running value with a PRIMARY input) -- a real straight-line subclass that captures reduce/parity/threshold forms; the full DAG search + real gcc/clang race (the existing 71-win 3-input standing) is the triangulation rung above this. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_cost_oracle.nx nx_syscalls.nx nx_boolsynth4.nx nx_team_synth_ability.nx

imports: nx_cost_oracle.nxnx_syscalls.nx

imported by: nx_team_synth_ability.nx

structs

none

consts

none

functions

17func bs4_in(k: i64) -> i64
called by 2: bs4_searchbs4_synth
25func bs4_op(op: i64, a: i64, b: i64) -> i64
called by 1: bs4_search
54func bs4_synth(target: i64, maxg: i64) -> i64
called by 1: main calls 2: bs4_searchbs4_in
65func bs4_popcount(x: i64) -> i64
called by 1: bs4_naive_sop_gates
73func bs4_naive_sop_gates(target: i64) -> i64
called by 1: main calls 1: bs4_popcount