Common Computer Science References
Note: for the 2-bit adder and everything after, we will assume there is no carry in from anything right of the ones column.
(assuming no carry in into the ones).
This means for the 2-bit adder, there will be 4 inputs and 3 outputs:
Ex 11+10=101
The carry out from the ones goes directly into the carry in of the twos. There is no LED or an output in the truth table.
We will display the carry out from the twos (which is actually the fours column, right!)
For this circuit, once again we are just using positive binary numbers, not 2s complement.
Note: that we are not using an if ... elseif ... statement any more.
If we were, we would now need 16 of them. Clearly this is a bad idea.
By using loops, we can get the same effect of adding all the digits, but it is much smaller code.