logical problem !

Joined
Nov 21, 2006
Messages
31
Reaction score
0
I need to find out the first occurence of bit '1' in a 64 bit number, starting from LSB, in shortest possible clock cycles. The result should be a number indicating the position of first occurence of bit '1'.

For eg. 0xA00C00000000000C
Here the first occurence of bit '1' starting from LSB is at bit position number 3. Hence the answer should be binary "100".

My approach: I thought of generating 2's complement of the given number and then simply ANDing the given number and its 2's complement, should give the correct position number.

Is there any other way of finding the same thing in just one clock cycle ?

:banghead:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top