Forum Discussion
Altera_Forum
Honored Contributor
14 years agoDetermining the index of the first 1 bit in a vector
Let's say I have a 64b wire, and I want to efficiently determine the index of the first 1 bit. For example: wire [63:0] sum; wire [5:0] index; assign sum = 64'b0000000111010110....1010...
Altera_Forum
Honored Contributor
14 years agoI think the most efficient solution involves dividing your 64bit vector in halves recursively.
So, ideally you get a minimum combinatorial path log2(64) long.