Electronic – Given 4 inputs (A,B,C,D) how can I design a circuit that counts the number of 1s

adderdigital-logic

The question is in the title.

If I have 4 inputs, how can I count the number of 1s using full/half adders and produce the binary equivalent of how many 1s exist in the 4 inputs?

Best Answer

The solution. Basically figured it out myself and with the comments... You need to count the 3 bits with the full-adder and then use 2 half adders to add the sum of the 3 bits and the 4th bit and then another half adder for the 2 carries.