Priority encoder par 6

Given d[3:0], output y = the index (0 to 3) of the highest set bit, and v = 1 when any bit is set. When d is 0, output y = 0, v = 0. The three outputs share more logic than they look like they do.

Rules: a single module golf, boolean operators & | ^ ~ only (no case, no ?:, no arithmetic). Your score is the number of gates Yosys reads from your code, before it would optimize.

Leaderboard

No scores yet. Post a passing solution to claim the top spot.