Count number of 1's in a 7 bit number

Discussion in 'Homework Help' started by tsn, Sep 16, 2013.

  1. tsn

    Thread Starter New Member

    Sep 16, 2013
    3
    0
    What is the minimal logic circuit to count the number of logic ones in a 7 bit input, using only half adders and full adders of one bit only(both)?

    Thanks a lot:)
     
  2. #12

    Expert

    Nov 30, 2010
    16,343
    6,828
    Sorry, this isn't, "Free Homework Answers". It's, "Homework Help". Tell us what you know about solving the problem and we'll start from there.
     
  3. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,692
    2,756
    The same answer for everything else:

    42
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    As #12 indicated, you need to show YOUR efforts to solve YOUR homework problem. We can then help guide you from where you are to where you need to end up.
     
  5. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,812
    834
    My Ouija board says 7...
     
  6. tsn

    Thread Starter New Member

    Sep 16, 2013
    3
    0
    Sorry, you are right.. I should explain myself.
    I have been thinking ,as a beginning, using 2 full adders.
    Lets say the number would be presented as a0a1...a6

    So the first FA will get a0,a1,a2
    The second FA a3,a4,a5
    Than using another FA with the a6 bit, and connect the sums of the two, and then use another FA to the Carry of the 2 FA..

    But I am not sure its best solution..

    Any ideas?

    Thanks:)
     
  7. Papabravo

    Expert

    Feb 24, 2006
    10,163
    1,797
    If the 7-bit input is loaded into a shift register you can examine the bits one at a time with seven clock pulses. You need a 3-bit counter with an enable. You have a state machine that examines a data bit and increments the counter if it is a '1' and holds the present state it it is a '0. The states would be:
    {LOAD, BIT0, BIT1, BIT2, BIT3, BIT4, BIT5, BIT6, DONE}
    Input would be START and outputs would be the 3-bit counter
     
  8. tsn

    Thread Starter New Member

    Sep 16, 2013
    3
    0
    Thanks but I am not allowed to use what you have mentioned..
    I can use HA and FA of one bit only
     
  9. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    I think you are on the right track. It's bit hard to follow which FAs you are talking about when. It would help if you could through a sketch together (Something simple in Paint will do fine) to make it all clear.

    But I think you have what came immediately to my mind, which involves four FAs.
     
  10. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    1) His constraints won't let him use anything by Half Adders and Full Adders.

    2) It can be done with considerably less hardware than this.
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    If you want to count the number of ones in order to determine the parity simply use a parity encoder.
     
  12. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    But that's not what he's trying to do. The OP's description of what he is trying to do and the constraints he is working under were actually among the better descriptions we have seen lately.
     
  13. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,394
    1,607
    If you search my older posts you'll find the answer, the underlying math, even a schematic.
     
Loading...