So, it's a full binary adder, but what does that mean? A and B are the two bits to be added together, and Cin is the value of any carry operation from the previous addition (if there was one). Then S is the sum of A and B and Cout is the carry value from the addition. There's a wee app at the bottom of the page that demonstrates this.
Why start a site about software with a hardware example? Well, maybe because I was teaching a computer architecture unit as I wrote this... No, really it's because the underlying logic is what's important here. Boolean algeba describes hardware operation, but predates computing machinery by a hundred years or so. There's also a case to be made that Boolean algebra is one of the fundamental formal systems that everything else builds on (if you're feeling brave, see the diagram on p2 of this paper by Max Tegmark). So, anyway...
You can look at the configuration of the circuit diagram and derive two Boolean expressions describing the operations. I think it's interesting that computing derives arithmetic from logical primitives, that should tell you something about the importance of Boolean algebra. Unfortunately, there are a wide variety of notations used to write Boolean expressions. The following table gives a quick comparison of some of the different symbols used in different contexts.
Here Logic refers to the standard notation used in philosophical and mathematical logic, Algebra refers to an alternative notation used in algebraic approaches, and Code refers to the symbols used for bitwise operations in the C family of programming languages. So, NOT (X AND Y) OR Z would be written in the following ways in each notation system:
- Logic: ¬(X ∧ Y) ∨ Z
- Algebra: (X ⋅ Y)' + Z
- Code: ~(X & Y) | Z
Note that code could also refer to the logical operators used to construct Boolean expressions in the C family of languages. In that case, AND would be written as &&, OR would be || and NOT would be !. Confused yet?
If you're not familiar with these fundamental logical operations, then you have your first learning activty: research Boolean logic on the web and get a basic understanding of these operators and the ways they behave when you combine them together.
S = (A ^ B) ^ Ci
Co = ((A ^ B) & Ci) | (A & B)
REx: Try writing the truth tables for these expressions so you can see why they work as a definition of binary addition.
| S = 0
Co = 0
The app on the right lets you try different inputs and see the resulting output. After you've written the the tables, check your results: type 1 or 0 into any of the inputs (A, B and carry in Ci) and the outputs (sum S and carry out Co) will be calculated when you click the Compute button.
You can find a Wiki page describing the adder circuit here.