The full adder adds 2 bits together, along with a carry in from the previous bit-addition.
The full adder generate a sum bit and a carry out bit for the next addition stage.
and it has 2 outputs:
Schematically:
The figure on the right shows the operation of the full adder circuit when it adds the bits 1 and 0, while the previous stage generates a carry (cin = 1).
Here is the boolean function in table form for the adder circuit:
cin | a | b |   | cout | s |
---|---|---|---|---|---|
- | - | - | + | - | - |
0 | 0 | 0 |   | 0 | 0 |
0 | 0 | 1 |   | 0 | 1 |
0 | 1 | 0 |   | 0 | 1 |
0 | 1 | 1 |   | 1 | 0 |
1 | 0 | 0 |   | 0 | 1 |
1 | 0 | 1 |   | 1 | 0 |
1 | 1 | 0 |   | 1 | 0 |
1 | 1 | 1 |   | 1 | 1 |
You can see that:
The optimal full adder circuit is as follows:
The EDiSim macro definition for the Full_Adder is as follows:
Define Full_Adder CarryIn a b | CarryOut Sum; Xor aa a b x; Xor aa x CarryIn Sum; And aa a b y; And aa CarryIn x z; Or aa y z CarryOut; Endef; |
This diagram will help you see the connection (signal names) used in EDiSim macro:
Note:
|
For example, the following circuit will implement a 4-bit adder circuit that can be used to add two 4-bit numbers:
Define FourBit_Adder a3 a2 a1 a0 b3 b2 b1 b0 | CarryOut s3 s2 s1 s0; Full_Adder ch ZERO a0 b0 | c1 s0; Full_Adder cf c1 a1 b1 | c2 s1; Full_Adder cd c2 a2 b2 | c3 s2; Full_Adder cb c3 a3 b3 | CarryOut s3; Endef; |