Accelerators · Medium · Verilog, SystemVerilog, VHDL

32-bit Population Count

Build a combinational population-count unit that returns the number of set bits in a 32-bit word.

Task

Count all one bits in x and return a value from 0 to 32.

Examples

Constraints

Accelerator verification checklist

Concepts to review

accelerator, popcount, reduction, bit-manipulation

Open 32-bit Population Count in the HDLForge interactive editor.

Related problems