ANKARA UNIVERSITY
DEPARTMENT
OF
COMPUTER ENGINEERING
BLM 275
DIGITAL LOGIC
DESIGN
LABORATORY
MANUAL
Experiment #4
ADDERS, SUBTRACTORS and MAGNITUDE COMPARATORS
Objective:
To construct and test various adders and subtractor circuits.
To construct and test magnitude comparator circuit.
Apparatus:
IC type 7486 quad 2-input XOR gates.
IC type 7408 quad 2-input AND gates.
IC type 7404 Hex inverter.
IC type 7483 4-bit binary adder.
IC type 7485 4-bit magnitude comparator
a) Addition:
IC type 7483 is a 4-bit binary adder with fast carry. The pin assignment is shownin Fig.l. The
two 4-bit input binary numbers are Al through A4 and Bl through B4.
The 4-bit sum is obtained from S1 through S4. CO is the input carry and C4 the out carry.
This IC can be used as an adder-subtractor and as a magnitude comparator.
b) Subtraction:
The subtraction of two binary numbers can be done by taking the 2's complement of the
subtrahend and adding it to the minued. The 2's complement can be obtained by taking the 1's
complement and adding 1. To perform A-B, we complement the four bits of B, add them to
the four bits of A, and add 1 through the input carry. This is done as shown in Fig.4.
Four XOR gates complement the bits of B when the mode select M=l and leave the bits of B
unchaged when M = 0. Thus, when the mode select M is equal to 1, the input carry CO is
equal to 1 and the sum output is A plus the 2's complement of B. When M is equal to 0, the
input carry is equal to 0 and the sum generates A+B.
c.) Magnitude Comparison
The comparison of two numbers is an operation that determines whether one number is
greater than, equal to, or less than the other number.
The IC 7485 is a 4-bit magnitude comparator. It compares two 4-bit binary numbers
(labeled as A & B), and generates an output of 1 at one of three outputs labeled A>B, A<B,
A=3. Three inputs are available for cascading comparators. See Figure 3.
Procedure:
a). Design and construct a half adder circuit using only XOR gate and NAND gates (Use
LogicWorks).
b). Design and construct a full adder circuit using only XOR and NAND gates (Use
LogicWorks).
c). Use IC 7483 to add the following two 4-bit numbers A and B.
Table 1
A 4 A3 A 2 Al B4 B3 B2 B1 Sum Carry
Out
1001 0 0 1 0
0 1 1 0 1 0 1 1
1100 1 0 1 0
A inputs are connected to 0V or 5V.
B inputs are connected to DATA switches.
Define the output sum and carry in Table 1 for given A and B inputs. Input carry Ci is
taken as 0. Show that if the input carry is 1, it adds 1 to the output sum.
d). Connect the adder-subtractor circuit as shown in Figure 2. A, B and C inputs are taken as
in (c) . Perform the following operation and record the values of the output sum and the
output carry C4.
Table 2
Decimal Output Output Carry
A B Sum C4
9+5
9–5
9 + 13
9–9
10 + 6
6 - 10
• Show that C4=1 when sum exceeds 15.
• Comment on sum and C4 for the substraction operations when A ≥ B and A<B.
5
1 A4 C4
14
3
5 DATA INPUT A3
Vcc A 8 A2 S4
15
B4 C4 10 A1
A4
S4 2
B3 16 B4 S3
A3 S3
7483
B2 7483 6
S2 4 S2
A2 B3
DATA INPUT
B1 S1 B 9
S1
A1
C0 GND
7 B2
12
11
B1
C0 GND
13 12
Mode Select M
M = 0 for add
M = 1 for subtract
Figure 1. IC type 7483 4 Figure .4 bit adder-subtractor
bit binary adder
e). Use IC7485 to compare the following two 4 bit numbers A and B. Record the outputs
in Table 3.
Table 3
A B Outputs
1001 0110
1100 1110
0011 0101
0101 0101
f). A magnitude comparator can be constructed by using a subtractor as in Fig.2 and an
additional combinational circuit.
B4 Vcc
A4
B3 A>B
A3 7485 A=B
B2
A2 A<B
B1
A1 GND
Figure 3
This is done with a combinational circuit which has 5 inputs S1, S2, S3, S4 and C4, and
three outputs x, y, and z.
5
1 A4 C4
14
3 Vcc
DATA INPUT A3
A 8 A2 S4
15 x
10 A1
2 y
16 B4 S3 Comb circuit
z
7483 6
4 S2
B3
DATA INPUT
B S1
9
GND
7 B2
11 B1
C0 GND
13 12
Mode Select M
M = 0 for add
M = 1 for subtract
Figure 4.
X = 1 if A = B Where S = 0000
Y = 1 if A < B Where C4 = 0
Z = 1 if A > B Where C4 = 1 S = 0000
Design and construct this logic circuit with minimum number of gates. Check the comparator
action with Part (e).
Design Work (LogicWorks):
1. Design a circuit by using two 7485 and a NOR gate which would give an output 1
whenever the 4 bit input is less than 8 or greater than 12.