Silicon to Scripting 6
Now that we half a Half Adder
, something that can add two 1 bit numbers (into a 2 bit number), we can make a full adder that also takes a carry.
This will allow us to chain together Full Adders
to add arbitrary long sequences of bits, and thus arbitrary large numbers.
Full Adder
The truth table for this level may seem a bit confusing. It’s just describing a formal specification for adding three 1 bit numbers together into a 2 bit number.
Let’s start with an Add
(half adder) that’s hooked up to the a
and b
inputs.
The h
of this Add
has an implicit and the l
has an implicit .
Now we need to take into account the c
input.
Since the c
has an implicit , we can Add
it with the l
output of the first Add
we added.
Now we have three outlets, but two outputs.
Since both h
outlets of the Add
have an implicit , we can OR
them together (because they can never both be on).
And for the l
output, we can use the other l
outlet of the second Add
.
Multi-bit Adder
Now we are going to make a component that can add two 2 bit numbers and a carry into a 2 bit number and a carry.
The key to this level is keeping track of the implicit value behind a bit (e.g. , ).
Note: the c
output of this level has an implicit value of instead of .
Let’s connect the bits with the same “value” to some Add
s.
Now we can connect the outlets with the same “value” with another Add
.
The max number we can make is , which means that the two outlets with a “value” of will never both be on at the same time, so we can OR
them together. The other two outlets are self explanitory if you know what their “value” is.