RTL Design #50 · 2026-11-12 · Population count · Easy · about 8 min

A bit counter that wraps on a full word

pop_count counts the 1 bits in the 8-bit input d and drives the total on the 4-bit output count, combinationally. For example 8'b10100101 gives 4, and 8'hFF gives 8.

Run tries six words, and one of the answers is wrong. Fix pop_count.sv.

Write and run your answer in the browser. The hidden tests check it, and it’s free.