Electronic – fastest gate setup to add 7 integer of 32bits

digital-logic

I would like to add 7 integer of 32 bit each together, using gates. The naive solution is to add two together, than the sum of these two with the third integer. The the sum of the first three added to the fourth integer… etc. However this is probably the slowest solution. I am looking for a fast way to do it. This is for sha256 algorithm. The main speed bottleneck is caused by a 7 input 32 bit adder.

Consider the 32 bit labelled: a, b, c, d, e, f, g. I would like to output a+b+c+d+e+f+g using gates asap.

A faster way would be

(((a + b) + (c + d)) + ((e + f) + (g)))   //This is performed in 3 steps.

(((((((a + b) + c) + d) + e) + f) + g)    //This is performed in 6 steps.

I would like to know if it can be done faster than the 3 steps process, by using special adders that can take multiple inputs.

Best Answer

Your 3-stage adder would likely be the best possible. You need to balance the need for an adder with multiple inputs, and mulitple stages of adding. You could probably end up designing a 7-input adder from scratch, but it would probably be terribly slow due to its complexity.

That said, if your goal is to speed up your SHA implementation, you may sometimes need to take a big-picture view on the system.