DSM-Practical-3
(Batch-A1)
Name Ansari Mohammed Shanouf Valijan
UID Number 2021300004
Class FY B.Tech Computer Engineering (Div-A)
Experiment Number 3
Aim:
To implement 4-bit, 5-bit and 8-bit comparators using given MSI.
Equipments Required (if performed offline):
7485 4-bit magnitude comparator IC
747266 quad 2 input IC (XNOR gate)
7404 hex 2 input IC (NOT gate)
7408 quad 2 input IC (AND gate)
Software Used:
Proteus 8 by Labcenter Electronics.
Theory:
Comparators: -
Comparators are the combinational digital circuits that are used to compare two
n-bit numbers. A comparator consists of 3 outputs which indicate whether a
number is greater than, smaller than or equal to another number. Given below
is a block diagram of an n-bit comparator: -
A B
n-bit
comparator
A>B A=B A<B
Figure-1: Block diagram of an n-bit comparator
In the above diagram A and B are n-bit numbers, and depending on whether
A>B, A<B or A=B, one of the three outputs is active high/logic ‘1’.
Comparators can be made with the help of logic gates; however, IC circuits can
be used directly to make the process fast and efficient. The IC of 4-bit
magnitude comparator is available which can be used to make higher bits
comparator.
For an n-bit comparator: -
Number of combinations possible = 22 n
Number of equal combinations = 2n
2n n
2 −2
Number of greater or less than combinations = n
In the IC of a 4-bit magnitude comparator, other than the 8 inputs that are
reserved for two 4-bit numbers, there are three more inputs which are known
as cascading inputs. These inputs basically make it possible to use 4-bit
comparators to compare two numbers with higher number of bits.
For example: A 5-bit comparator, An 8-bit comparator, A 24-bit comparator, etc
can be made with the help of 1 or more 4-bit magnitude comparators with 0 or
more additional gates (XNOR gates).
Procedure:
1. In the workspace, add the logic toggle and logic probe devices for inputs
and outputs respectively.
2. Place all the equipments as required to obtain a proper circuit for
respective comparators.
3. In case of a 1-bit magnitude comparator, use the required gates directly
and make proper connections with the help of wires.
4. In case of a 4-bit comparator, connect the A=B cascading input to logic ‘1’
and connect A>B, A<B cascading inputs to logic ‘0’.
5. In case of 5-bit and 8-bit comparators, connect the cascading inputs to the
appropriate bits/outputs to get the correct circuit.
6. Verify the correctness of the designed circuits by taking different
combinations of the inputs.
Results/Observations:
A] 1-bit Comparator
Figure-2: 1-bit comparator using logic gates showing A=B
Figure-3: 1-bit comparator using logic gates showing A>B
Figure-4: 1-bit comparator using logic gates showing A<B
Truth Table: -
Inputs Outputs
A B A>B A=B A<B
0 0 0 1 0
0 1 0 0 1
1 0 1 0 0
1 1 0 1 0
B] 4-bit Comparator
Figure-5: 4-bit comparator using IC showing A=B
Figure-6: 4-bit comparator using IC showing A>B
Figure-7: 4-bit comparator using IC showing A<B
C] 5-bit Comparator
Figure-8: 5-bit comparator using 7485 IC and an XNOR gate showing A=B
Figure-9: 5-bit comparator using 7485 IC and an XNOR gate showing A>B
Figure-10: 5-bit comparator using 7485 IC and an XNOR gate showing A<B
D] 8-bit Comparator
Figure-11: 8-bit comparator using two 7485 ICs showing A=B
Figure-12: 8-bit comparator using two 7485 ICs showing A>B
Figure-13: 8-bit comparator using two 7485 ICs showing A<B
Conclusion: