# Is there any integrated circuit that takes an 8 bit input and outputs a 3 bit sum of those inputs?

### 4 Answers

- daniel gLv 71 year ago
Sure, Shifting 8 bit input, counting the 1s does nicely. Overflow would get dropped, hence an error. 4 bit can count that high.

Piece of cake for an 8 bit Upc

- Lisa ALv 71 year ago
Is this a trick exam question? They want you to try and fail to design it, and realize why you can't. Because the sum of 8 binary numbers ranges from 0 to 8 decimal. Which is from 0000 to 1000 binary. So you need 4 bits of output, not 3. It isn't possible for the circuit that you describe to exist, because you can't design such a thing, logically.

- DixonLv 71 year ago
You actually need a four bit output because there are 9 possible sums; zero and 1 to 8.

I don't know if this circuit has a name and I can't remember ever seeing one as a stand alone IC but I've done it a few times in VHDL. For myself, I call it a "tally to n". So in this case it would be a tally to 8 adder.

In hardware you would do that with a pyramid off adders. Roughly described below - hope I didn't go off the rails tho...

The first stage would be 4 half adders, each one adding up pairs of bits from the input and giving a two bit output . We treat the sum and carry as a single two bit bus representing the sum. This is the jump from a tally to weighted numbers but we now have four weighted numbers to add together.

The next stage would be adding up pairs of the first stage output busses. Each pair would be added together with a 2 bit adder (3 bit output)

Similarly, the final stage adds the two previous stage outputs using a 3 bit adder, to give a four bit result.

- MorningfoxLv 71 year ago
Do you mean a count of how many of those inputs have a logic "1" value? If all of the inputs were "1", that would be an output value of "1000", so you need 4 bit output, not 3. I would consider using a EPROM with a look-up table.