Forum Discussion
Altera_Forum
Honored Contributor
15 years agoCounting the position of ones in a binary vector
I want to design a combinatorial circuit for an fpga which will count the position of ones in a 16 bit vector. eg1 if vector is 16'b0000_0000_0011_0101 then output should be 64'h0000_0000_0000_5...
Altera_Forum
Honored Contributor
15 years agoIt is sad that in many fora across the web simple solutions get drowned in garbage.
The for loop unfolds to comb logic as follows: if input(0) = '1' then .... end if; if input(1) = '1' then .... end if; if input(2) = '1' then .... end if; etc. until input(15) The compiler unrolls it at compile time. It is just for convenience of writing multiple statements.