Counting 1 bits using full adders

Discussion in 'Homework Help' started by oldlaptopuser, Oct 4, 2015.

  1. oldlaptopuser

    Thread Starter New Member

    Oct 4, 2015
    3
    0
    Hello,

    I'm only using FA and simple gates (and, or, xor, not, etc). I'm given 6 bits as input, and I'm trying to count the 1 bits, I've done the following:

    I use 2 FA as a filter, if they both carry out, I use another FA as a filter to see 2 or 4 is carried. With these 3 FA, I'll receive 4 outputs with the values of 1, 1, 2, and 4.

    I can convey 0-6 bits used in 3 bits (000 - 110). What should I be looking at to assign those 4 outputs to the 3 bits? I feel like my mind is slipping and the solution should be relatively simple, but I get confused.

    So many combinations seem possible, it seems a brute force method seems horrible. What should I be looking at?

    Right now I'm pursuing adding both possible 1's in a FA to see if I have a 1 or 2. So now the potential output is 1, 2, 2, 4 (as opposed to 1,1,2,4) but this is still 4 outputs.
     
    Last edited: Oct 4, 2015
  2. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    How about showing a sketch of the circuit(s) you are considering?

    You can build the circuit using 4 FA and no other gates at all. In fact, you could count the number of 1 bits among seven inputs.

    The key is to exploit the primary difference between a half adder and a full adder.
     
  3. oldlaptopuser

    Thread Starter New Member

    Oct 4, 2015
    3
    0
    Nevermind! I was able to figure it out. I'm so happy, my eyes got teary!

    However, I don't think my solution is optimal after what you just said. I've attached my solution. What should I be looking for to further minimize?
     
  4. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    Good job. Nothing like the sense of accomplishment in figuring out the solution on your own.

    If you only have six inputs, you can also use three FA and one HA and since a HA is just an XOR and an AND gate, you can use three FA, one XOR and one AND.
     
  5. oldlaptopuser

    Thread Starter New Member

    Oct 4, 2015
    3
    0
    Oh jeez, my mind is reeling. A HA IS nothing but a XOR and AND. That's incredible. Thank you.
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,777
    4,805
    No problem. Glad you are still thinking about it and figuring out how to improve your solution.
     
Loading...