Silicon to Scripting 5
Now that we have an encoding for binary numbers, let’s look at the truth table for the Half Adder
component.
Half Adder
a (in) | b (in) | h (out) | l (out) |
---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 0 | 1 |
1 | 0 | 0 | 1 |
1 | 1 | 1 | 0 |
We can interpret this table as a + b = hl
.
0 + 0 = 00
0 + 1 = 01
1 + 0 = 01
1 + 1 = 10
One other thing to notice is that this level has two outputs. It’s going to be helpful in the future when solving more complex levels to specifically acknowledge the number of inputs and outputs. This means that we can split the level into two parts.
- solving the
h
output - solving the
l
output
Looking at the h
output, it looks like something we already did. It’s an AND
gate.
Looking at the l
output, it also looks familiar: it’s an XOR
gate.
We built something that can add numbers out of boolean logic gates. We didn’t do anything special here on the actual construction and logic, it all came down to interpretation.
Step back, look at what we just made. Out of relays, we constructed something that can do something very abstract: add numbers.