The picture above shows a typical full adder.
What is a full adder?
A full adder is an addition operator that considers rounding.
One bit full adders are Ci-1,Ai,Bi,Si,Ci.
The inputs are Ci-1,Ai,Bi.
Ci-1: whether or not there is a rounding after the previous operation, if there is a rounding, it will be 1, if there is no rounding, it will be 0.
Ai: the number to be added
Bi: the number to be added
Output: Si, Ci
Si: output result
Ci: output the rounding of this operation
The operation Ci-1=0 at the beginning, because the previous operations did not produce a rounding until Ai=Bi=1 when a rounding is produced.
To wit:
0+0 outputs the result Si=0 without rounding, so Ci=0.
1+0 outputs the result Si=1 without rounding, so Ci=0.
1+1, according to the binary algorithm, rounding, Ci = 1, after rounding the output result is cleared to zero, Si = 0
Use this rule to perform the arithmetic according to the diagram above.
Si=Ai⊕Bi⊕Ci-1
I'm going to give you a check over here in decimal degrees, so it might be a little clearer for you.
Let's start by clarifying the following points:
The input Ci is whether the previous step is rounded or not
The output Ci is whether the sum is rounded or not
Expand with 45+55 as an example
Note that a and b must be in the same rank, first, second, and third places, not a=45 and b=55.
This means that in the first place a=5, b=5
In the tens place a=4, b=5
Most people come to me mainly because the input and output Ci don't know how to participate in the operation.
Starting from the lowest single digit, the single digit is calculated as Ci-1=0, a=5, b=5, resulting in Si=0, Ci=1.
Because at the beginning there is only the additive a = 5 and the additive b = 5, add up to 10, decimal rounding, the result is 0, rounded to 1
The result of this single-digit operation, Si, becomes the first digit of the result (S), and Ci is involved in the next digit because it is not zero.
Tenth place Ci-1=1,a=4,b=5,Ci-1+a+b=1+4+5=10,Si=0,Ci=1
The tens place is calculated with the added number a=4 and the additive number b=5, since there is a rounding in the single digit calculation, the sum is 10, and the decimal is rounded to the nearest digit, the result is 0, and the rounding to the nearest digit is 1
The result of the operation in the tens place Si becomes the result of the tens place (S ten), Ci because it is not 0, to participate in the calculation of the next place
Although the next hundred a,b are 0, but because Ci-1 is not 0, but also to continue to operate in the hundreds place
Ci-1=1,a=0,b=0,Ci-1+a+b=1,Si=1,Ci=0
Hundred digit calculation when the additive a = 0 and additive b = 0, due to the ten digit calculation there is a rounding, add up to 1, the decimal does not round, the result S hundred = 1, rounding mark Ci = 0
Since all the following bits are 0, Ci=0, stop the operation. Get the final result S hundred S ten S one = 100
The same calculation is done in binary, except that it is binary instead of decimal.