Population Count and Count Leading/Trailing Zeros Accelerators
laforest opened this issue · comments
Charles Eric LaForest commented
Implement a popcount module. There is enough time (8 cycles) to pipeline properly the chains of small adders necessary. This instruction seems much too useful and powerful to not include.
With clever use of AND gates, this could also act as a CLZ instruction.
And they lay the basis for bit "flip", "sheeps and goats", compress, and expand operations, all powerful.
(see Hacker's Delight)
Note: use wrapper to tie second, configuration port, (if multiple functions per accelerator) to the H memory, rather than use up an I/O port.