Adding bits a, b, and c
carry_out = b&c|a&b|a&c;
You need to do this for all bits in the word - first for bits 0 using carry_in = c = 0, and iterating to carry_in (next_bit) = carry_out (previous_result).
Subtraction occurs with bit inverting b from (ab) and setting the initial transfer to 1.
However, if you need to add, for example, 32 numbers in parallel, you can put "a" with 32 pounds of all these numbers and perform binary operations in parallel. This is a method called bit slicing.
For CSA multiplication (carry save adder is definitely the best software approach - it has the smallest "area")
As an exercise, here is an algorithm that computes a + b (+ c) in parallel:
int a = 13113; int b = 43334; int c = 1; int main() { int sum=a^b^c,c2; c=((c&a)|(a&b)|(c&b))<<1; while (c) { c2=(c&sum)<<1; sum^=c; c=c2; } printf("%d\n",sum); }
source share