Convert ring counter to binary

privateRob:
Stupid me! :blush:
I forgot to say that I'm looking for a hardware solution. Best without any clock cycles.

... and thanks for the help so far! :slight_smile:

My sense is for a lot of the computers that have a count leading zeros instruction, internally the processor does a combination of if and loop type operations. You can throw more logic at the problem, depending on the usual cost/benefit analysis. On the server powerpc's that I deal with for work, the CNTLZ instruction is a 2 cycle instruction, while the normal integer operations are 1 cycle.