logical problem !

Discussion in 'VHDL' started by quantum_dot, Sep 17, 2007.

  1. quantum_dot

    quantum_dot

    Joined:
    Nov 21, 2006
    Messages:
    31
    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:
     
    quantum_dot, Sep 17, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dangerlee

    logical left shifter or latch ??

    dangerlee, May 5, 2004, in forum: VHDL
    Replies:
    4
    Views:
    847
    Egbert Molenkamp
    May 7, 2004
  2. Weng Tianxiang
    Replies:
    12
    Views:
    1,407
  3. Jahren
    Replies:
    0
    Views:
    873
    Jahren
    Dec 6, 2007
  4. Andreas Eibach
    Replies:
    7
    Views:
    406
    CBFalconer
    Nov 16, 2008
  5. focode
    Replies:
    14
    Views:
    693
    Arne Vajhøj
    Jan 4, 2010
Loading...

Share This Page