7 Facts On Facts On Binary Adder:Full Adder & Half Adder

  1. Definitions and Overview of adder
  2. Types of adder
  3. Half adder
  4. Full adder
  5. BCD adder

Definitions:

An adder is a device which add up two numbers and produce the result. A binary adder is something which deals with addition of binary numbers.

A binary adder is a digital device and needed for digital computations. The operation performed in a binary adder, obeys the rules of binary addition. Here two bits corresponding to 2n are added and the resultant is then added to the carry from the 2n-1 digit.

The binary addition rules are stated as follow. Here 0 is logic low and 1 is logic high. A and B are two inputs.

ABY = A + B
000
011
101
110 (carry 1)
Binary Addition

Example of addition operations:

  • 11111 + 1011 + 101 + 10 + 1
  • 11111+ 1011 = 101010
  • 101010 + 101 = 101111
  • 110001 + 1 = 110010

So the answer is 110010

Types of Adder

This addition operation is implemented by various digital circuitries. They are –

  • Half Adder
  • Full Adder
  • BCD Adder

A binary adder not only performs addition operations but also used in other digital applications. Decoding of address, calculation of index are few of its applications.

Half Adder

A half adder is a type of binary adder which add one bit of data and produces the result. It has two input side through which we supply the digital logic values and it has two outputs through which we receive the result of the operation. The result can be shown in a single digit. The output shows the digit in the sum that has the same significance as the individual digits added. The other output shows the carry bit.

Half Adder Truth table

The operation of the half adder is shown in the following truth table.

ABSumCarrySum of A & B
000000
011001
101001
110110
Truth Table of Half Adder

Now from the truth table, we can observe that the first three rows can represent the sum using a single digit. At the last row, the sum is represented using two digits as it has 1 as carry. Here the sum is zero and carry 1 must be taken to the position of next higher significance.

Sum = A′ B + A B′

Carry = AB

So,

Sum = A XOR B

Carry = A AND B

To implement the logic, we need one XOR gate and one AND gate. XOR gate and AND gate can also be made using universal gates like NAND and NOR. So, a half adder can be designed using only universal gates.

The following image shows A and B as the input and S as the sum and C as the carry.

Full Binary Adder
Half binary adder , Image Source – inductiveloadHalf Adder, marked as public domain, more details on Wikimedia Commonsmedia

Full Adder

Another type of binary adder is full adder. It also adds binary data and produces the output. Now, when two binary numbers are added, except the least significant digit there is a carry-in as Ci-1 and carry-out as Ci. The full adder is designed to handle a carry-in for each stage. That is how a full order overcomes the shortcoming of half adder of handling carry-in.

Full adder truth table

AiBiCi-1SiCi
00000
00110
01010
01101
10010
10101
11001
11111
Full Adder Truth Table

Full Adder Circuit

Si = Ai Bi Ci-1 + Ai Bi Ci-1 + Ai Bi Ci-1 + Ai Bi Ci-1 + (Ai Bi + Ai Bi) Ci-1   + (Ai Bi + Ai Bi) Ci-1

And the carry comes as:

Ci = Ai Bi Ci-1 + Ai Bi Ci-1 + Ai Bi Ci-1 + Ai Bi Ci-1 

Or, Ci = (Ai Bi + Ai Bi) Ci-1   + (Ai Bi + Ai Bi) Ci-1

Or, Ci = Ai Bi + (Ai Bi + Ai Bi) Ci-1

Now, consider a half adder has inputs A and B. The output sum is S and carry is C. Now the expression of Si and Ci can be obtained from the expressions of Sum and carry of half adder circuit.

Si = S Ci-1 + S Ci-1

Ci = C + S Ci-1

Now, to implement a full adder using half adders we need two half adders and one OR gate. Full adder implementations using half adders is represented in the below figure.

Full adder logic diagram
Full binary adder , Image Source – InductiveloadFull-adder logic diagram, marked as public domain, more details on Wikimedia Commons

As we can see in the figure that the first half adder (marked as-) has the input Ai and Bi. The second half adder (marked as-) has inputs of C i-1 and output of the first half adder that is S. The output of the second half adder are Si and S Ci-1.

Now, S Ci-1 represents the carry out. The carry of the first half adder that is C and the carry of the second half adder that is S Ci-1 are fed as input of a OR gate. The output of the OR gate is the final carry out of the full adder circuit.

Parallel Binary Adders

A full adder is needed for the addition of bits in each stage of addition except the addition of least significant digits on the other hand two half adders are needed to complete a full adder. It follows the rule that the addition of two n-bit numbers will require 2 * m -1 number of half adder and m-1 numbers of OR gates. This type of binary adders is known as parallel binary adders. The speed of operation of these types of adders are very fast. That is why they are preferred in modern computational devices.  

Let us add 101 and 111 as an example of parallel binary adder. The figure shown below represents the addition.

4 bit carry lookahead adder
Parallel binary adder, Image source – en:User:Cburnett4-bit carry lookahead adderCC BY-SA 3.0

The first half adder (marked as-1) adds the extreme right-hand bits 1 and 1 to produce the binary sum 0 and the carry 1 according to the rules of binary addition. The output of the half adder is fed into the input of the first full adder (marked as- 2). The other two inputs of first full adder are the two next bits that is 0 and 1. The outputs of the first full adder are 0 as sum and 1 as carry. They are further fed into input of second full adder. The other two inputs are 1 and 1. The outputs of the second full adder is 1 as sum and 1 as carry. So, the result of the summation is 1100.

Now, a point to be noted that in place of a half adder at the least significant digit position, a full adder can be used with its carry input made 0.

BCD Adder

The term BCD in BCD adder stand for Binary Coded Decimal. BCD is a special type of binary encoding where each digit has certain number of bits for representation. The BCD of first 10 decimal value is shown in the table.

Decimal Digit BCD  
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001
BCD ADDER

BCD adder has two inputs which varies from 0 to 9. The output varies from 0 to 18 and if the previous carry is considered then the range will be up to 19.

The table for BCD adder is given below.

decimal or bcd adder
BCD Adder Truth Table

From the above table, we can observe that from 1 to 9 the binary and the BCD is same. From 10 to 19 decimal numbers, both the binary and codes are different.

The circuit diagram of a BCD adder is shown below.

  • In the above diagram there is a four-bit binary adder which has input as addended and augend. It has also input of carry.
  • The binary adder gives output of the addition and an carry output.
  • Now, using the output and the carry the circuit is further designed to find out the final carry.
  • The output is further fed into a 4-bit adder.
  • Now, the circuit is designed to make the 1st and 4th bit of the addended number as 0 and also the 2nd and 3rd bit to make as same as Carry. When the carry is 1, the circuit is designed in such a way that the addended will be 0110. 6 is added with augend to get the BCD.

Example of BCD

0110 + 0101 = 1011

Now this is invalid as BCD. The number is greater than 9. So, we have to add 6 to the result.

The final result will be = 1011 + 0110 =

1011 + 0110 = 10001

So the final answer will be 10001

Know about Subtractors! Click Here!

VHDL implementation of Half adder and Full Adder

HALF-BINARY ADDER DATAFLOW MODELLING

library IEEE ;

use IEEE.std_logic_1164.all ;

entity half_adder_dataflow is

    Port ( a : in  STD_LOGIC;

           b : in  STD_LOGIC;

           s : out  STD_LOGIC;

           c : out  STD_LOGIC);

end half_adder_dataflow;

architecture Behavioral of half_adder_dataflow is

begin

s <= a XOR b;             

c <= a AND b;            

end Behavioral;

HALF- BINARY ADDER BEHAVIORAL MODELLING:

entity SUDIPTA_ROY_HALFADD is

    Port ( A : in  STD_LOGIC;

           B : in  STD_LOGIC;

           C : out  STD_LOGIC;

           S : out  STD_LOGIC;

           Z : out  STD_LOGIC);

end SUDIPTA_ROY_HALFADD;

architecture Behavioral of SUDIPTA_ROY_HALFADD is

begin

process(A, B)

begin

if(A=’0′ and B=’0′) then

S <=’0′;

C <=’0′;

elsif(A=’0′ and B=’1′) then

S <=’1′;

C<=’0′;

elsif(A=’1′ and B=’0′) then

S <=’0′;

C<=’1′;

else

S <=’1′;

C<=’1′;

end if;

end process;

end Behavioral;

FULL-ADDER DATAFLOW MODELLING

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;

entity SUDIPTA_ROY_FULLADD is

    Port ( A : in  STD_LOGIC;

           B : in  STD_LOGIC;

           Cin : in  STD_LOGIC;

           S : out  STD_LOGIC;

           Car : out  STD_LOGIC);

end SUDIPTA_ROY_FULLADD;

architecture Dataflow of SUDIPTA_ROY_FULLADD is

begin

S<=(A xor B) xor Cin;

Car<=( A and B) or (B and Cin) or (Cin and A);

end Dataflow;

FULL-ADDER BEHAVIORAL MODELLING

entity SAERI_DATT_FULLADD is

    Port ( A : in  STD_LOGIC;

           B : in  STD_LOGIC;

           Cin : in  STD_LOGIC;

           S : out  STD_LOGIC;

           Car : out  STD_LOGIC);

end SAERI_DATT_FULLADD;

architecture Behavioral of SAERI_DATT_FULLADD is

begin

process(A,B,Cin)

begin

if(A=’0′ and B=’0′ and Cin=’0′) then

S<=’0′;

Car<=’0′;

elsif(A=’0′ and B=’0′ and Cin=’1′) then

S<=’1′;

Car<=’0′;

elsif(A=’0′ and B=’1′ and Cin=’0′) then

S<=’1′;

Car<=’0′;

elsif(A=’0′ and B=’1′ and Cin=’1′) then

S<=’0′;

Car<=’1′;

elsif(A=’1′ and B=’0′ and Cin=’0′) then

S<=’1′;

Car<=’0′;

elsif(A=’1′ and B=’0′ and Cin=’1′) then

S<=’0′;

Car<=’1′;

elsif(A=’1′ and B=’1′ and Cin=’0′) then

S<=’0′;

Car<=’1′;

else

S<=’1′;

Car<=’1′;

 end if;

 end process;

 end Behavioral;