Counting the position of ones in a binary vector

Discussion in 'Homework Help' started by ganeshmirajkar, May 4, 2011.

  1. ganeshmirajkar

    Thread Starter New Member

    May 4, 2011
    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

    eg2 if vector is 16'b0000_1010_0000_1010 then output should be

    Please help.
    Thanks in advance....
  2. Georacer


    Nov 25, 2009
    Do you actually want to build the circuit? It looks awful big for a mere homework assignment.

    Hint: Use some counters to help you in your work.
    One to count how deep you are in the input vector in order to produce the position of each ace.
    One to count how many aces you have recorder in order to position you in the output vector.

    Keep in mind that this is the Homework Help section, where you have to post your efforts in solving your problem first, before receiving any help.
  3. ganeshmirajkar

    Thread Starter New Member

    May 4, 2011
    yes i actually want to build this circuit in an fpga. Well this is no homework actually...this is one of the design problems.....i am facing.