Logic Golf: Beat the Synthesizer
Logic golf. Each puzzle is a small circuit, and your job is to build it in the fewest gates. The synthesizer would optimize your logic for free, so here you do the optimizing, and we count every gate with real Yosys. No case statements, no arithmetic to hide behind, just boolean algebra. Beat par and climb the leaderboard.
01 · Full adder par 5
Sum and carry-out of three bits.
02 · 2:1 multiplexer par 3
Pick a or b with sel, no ternary allowed.
03 · Majority of three par 4
1 when at least two inputs are high.
04 · Two-bit equality par 4
1 when the two 2-bit values match.
05 · Priority encoder par 6
Index of the highest set bit, plus a valid flag.
06 · Two-bit adder par 7
Add two 2-bit numbers into a 3-bit sum.
07 · One-bit ALU par 15
Four operations selected by a 2-bit opcode.
How scoring works
Write a single module golf using only the boolean operators
& | ^ ~. We simulate it against a hidden, exhaustive testbench to
check it is correct, then read it into Yosys and count the logic cells
before any optimization pass. Write it cleverly (factor out shared
terms, reuse a half-adder) and the count drops. That is the whole game, and
because the count comes straight from the toolchain, there is nothing to fake.
New to this? Warm up with the hands-on course or the practice challenges first.