Experiment No:2
Date: / /
DESIGN AND IMPLEMENTATION OF ADDERS, SUBTRACTORS AND CODE
CONVERTERS.
AIM
1. To design and implement Half adder, Full adder, Half subtractor and Full
subtractor.
2. To design and implement-
(i) Binary code to gray code converter.
(ii) Gray code to binary code converter.
APPARATUS REQUIRED:
Apparatus Quantity
1. Bread board 1 No.
2. IC 7408 1 No.
3. IC 7486 2 Nos.
4. IC 7432 1 No.
5 IC 7404 1 No.
6. Power supply 1 No.
7. LED 4 Nos.
8. Connecting wires As required
THEORY
PART 1:
Adders-
A typical adder circuit produces a sum bit (denoted by S) and a carry bit (denoted
by C) as the output. Adders are realized for adding binary numbers but they can be also
realized for adding other formats like BCD (binary coded decimal), XS-3 etc. Besides
addition, adder circuits can be used for a lot of other applications in digital electronics
like address decoding, table index calculation etc. Adder circuits are of two types: Half
adder ad Full adder.
Half Adder:
Half adders are capable of taking two inputs [Link] adds two binary digits called as
augend and addend and produces two outputs as sum and carry. In this four input
combinations are possible. This concept is extended to any number of inputs.
Full Adder:
The concept of half adder could be extended to higher number of bits by propagating the
carry from one stage to the other. This leads to the concept of full adder. Here in addition
to the two inputs (Augend and addend), the carry produced in the previous addition
operation is treated as another input. Hence these adders are capable of having three
inputs and they produce two outputs: sum and carry. The carry thus generated will be
further treated as input to the next stage of addition operation. These kind of adders are
called ripple carry adders. Here three inputs are present, hence eight input combinations
are possible.
Subtractors-
In Digital electronics, a subtractor can be designed using the same approach as
that of an adder.
Half Subtractor:
Half subtractors are capable of taking two inputs only. They are the minuend and
the [Link] produces two outputs the Difference and the Borrow.
Full Subtractor:
Full Subtractor is the extension of half subtractor. Here apart from the minuend
and subtrahend the borrow of the previous subtraction operation is also given as the
input. Hence Full subtractor has 3 inputs (8 input combination possible) and 2 outputs.
PART II:
Code is a symbolic representation of discrete information.
The Gray Code is a non-weighted code which belongs to a class of codes called
minimum change codes. In this codes while traversing from one step to another step only
one bit in the code group changes. In case of Gray Code two adjacent code numbers
differs from each other by only by one bit. As this code it is not applicable in any types of
arithmetical operations but it has some applications in analog to digital converters and in
some input/output devices.
The Boolean expressions are obtained as follows-
G3=D.
G2=C D.
G1=B C.
G0=A B.
The Binary code is a weighted code with the digits in each position having a
weight of two. Hence it can be used for doing arithmetic operations. The Boolean
expression for converting gray code back to binary code is obtained as follows-
A= (G3 G2) (G1 G0).
B=G3 G2 G1.
C=G3 G2.
D=G3.
The Excess-3 code simply adds 3 to each number to make the codes look
different. The Excess-3 BCD system has some properties that made it useful in early
computers. The Excess-3 BCD system is formed by adding 0011 to each BCD value as in
Table 1. For example, the decimal number 7, which is coded as 0111 in BCD, is coded as
0111+0011=1010 in Excess-3 BCD.
Table1: The excess-3 representation of the decimal numerals.
PROCEDURE FOR PART 1:
1. Check all the ICs using the IC tester and ensure that rated voltage is obtained from
the power supply using multi-meter.
2. Place the IC on IC Trainer Kit.
3. Connect VCCand Ground to the corresponding pins of IC Trainer Kit.
4. Connect the inputs of the IC to the input switches provided in the IC Trainer Kit.
[Link] the outputs to the switches of LEDs.
[Link] various combinations of inputs accordingto the truth table and observe the
response of LEDs.
7. Repeat the above steps for all the ICs.
PROCEDURE FOR PART II:
1. Check all the ICs using the IC tester and ensure that rated voltage is obtained from
the power supply using multi-meter.
2. Place the IC's on a bread board.
3. Connect VCC and ground pins of IC to corresponding terminals in the IC trainer
kit.
4. Wire up the circuit as per circuit diagram obtained from the Boolean expression for
the binary code to gray code converter.
[Link] the truth table by providing various input combinations and checking the
corresponding outputs.
6. Repeat the procedure for gray code to binary code converter also.
PART I
HALF ADDER:
SYMBOL:
TRUTH TABLE:
A B S C
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
From the truth table,
_
CARRY C = A B
S=A B
CIRCUIT DIAGRAM:
FULL ADDER:
SYMBOL:
TRUTH TABLE:
A B Cin S Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
From the truth table,
Expression for Sum:
S=A B C
Expression for Carry:
C(i+1) = AB+BC+CA
CIRCUIT DIAGRAM:
HALF SUBTRACTOR:
INPUTS OUTPUTS
A B B0 D
0 0 0 0
0 1 1 1
1 0 0 1
1 1 0 0
From truth table:
_ _
D = AB + AB = A B _
B0= AB
CIRCUIT DIAGARM FOR HALF SUBTRACTOR:
FULL SUBTRACTOR:
TRUTH TABLE:
INPUTS OUTPUTS
X Y Z B D
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 1 0
1 0 0 0 1
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
From the truth table,
Expression for Borrow, B:
_ _
B= XZ + YZ + XY
_
= YZ + X (Y+Z)
Expression for Difference, D:
D=X Y Z
FULL SUBTRACTOR:
PART II
Truth Table for binary code to gray code conversion:
BINARY GRAY
D C B A G3 G2 G1 G0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 0 0 0 1 1
0 0 1 1 0 0 1 0
0 1 0 0 0 1 1 0
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 1
0 1 1 1 0 1 0 0
1 0 0 0 1 1 0 0
1 0 0 1 1 1 0 1
1 0 1 0 1 1 1 1
1 0 1 1 1 1 1 0
1 1 0 0 1 0 1 0
1 1 0 1 1 0 1 1
1 1 1 0 1 0 0 1
1 1 1 1 1 0 0 0
K-Map Simplification:
For G0:
G0=
G0= A B
For G1:
G1=
G1= B C
For G2:
G2=
G2= C D
For G3:
G3= D
Circuit Diagram:
Binary to Gray Code Converter:
Truth Table for gray code to binary code conversion:
GRAY BINARY
G3 G2 G1 G0 D C B A
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 1
0 0 1 1 0 0 1 0
0 0 1 0 0 0 1 1
0 1 1 0 0 1 0 0
0 1 1 1 0 1 0 1
0 1 0 1 0 1 1 0
0 1 0 0 0 1 1 1
1 1 0 0 1 0 0 0
1 1 0 1 1 0 0 1
1 1 1 1 1 0 1 0
1 1 1 0 1 0 1 1
1 0 1 0 1 1 0 0
1 0 1 1 1 1 0 1
1 0 0 1 1 1 1 0
1 0 0 0 1 1 1 1
K-Map Simplification:
For A:
A=
A= G0)+G3G3 (G1
A= (G1 G0)(G3 G2)
A= (G3 G2) (G1 G0 )
For B:
B=
B= G1)+G3(G2
B= G3 G2 G1
For C:
C=
C= G3 G2
For D:
D=G3
Circuit Diagram:
Gray to Binary Code Converter:
RESULT:
[Link] Half adder, Full adder, Halfsubtractor, Full subtractor are designed and
implemented.
[Link] binary code to gray code converter and Gray code to binary code converter were
designed and implemented.
The truth tables were verified for all the input combinations.