I've always been fascinated with the processor, and in particular the arithmetic logic unit. On the picture below you can see a 1 bit full adder using only AND, OR and XOR gates. I've implemented the design using Logic Gate Simulator, which is open source. For those unfamiliar with the different symbols, I have attached a legend at the end of this post.
A and B are the input bits to be added. The C on top is the Carry in. The Carry in is not that useful in this implementation since it's only a 1 bit implementation. The O is result, and the C in the bottom is the Carry out, but in this case it works
as an overflow flag.
As you can see, the output is as expected for A and B.
As far as calculations go, it's not very exciting, but it's working as intended.
But we soon run into trouble. Lets see what happens if both bits are set to 1.
1 + 1 = 10 in binary, but since we only have one output bit, we get an overflow. How do we add more bits? It turns out to be quite easy. Just string two full adders together!
The function of Carry in and Carry out now becomes more clear. We are of course just pushing the overflow problem in front of us, but that's part of the reality of working with limited physical resources.