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

Relevance
• 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

• Log in to reply to the answers
• 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.

• Sorry, I meant 4 bit output. It's not an exam question. I'm just building a project where I have to read the digital outputs of 8 sensors and I don't want to use 8 GPIOs on my microcontroller so I was wondering if there's any IC that counts all the inputs and gives out the result on a 4 bit bus.

• Log in to reply to the answers
• 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.

• Log in to reply to the answers
• Log in to reply to the answers