M Marwadi University
Fa Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
Aim:Verify the truth table of one bit and two-bit comparator using logic gates.
Software: DEEDS
Theory:
A magnitude digital comparator is a combinational circuit that compares two digital or binary
numbers in order to find out whether one binary number is equal, less than or greater than the
other binary number. We logically design a circuit for which we will have two inputs one for
A and other for B and have three output terminals, one for A > B condition, one for A = B
condition and one for A < B condition.
1- Bit Magnitude Comparator:
A comparator used to compare two bits is called a single bit comparator. It consists of two
inputs each for two single bit numbers and three outputs to generate less than, equal to and
greater than between two binary numbers. The truth table for a 1-bit comparator is given below
:
From the above truth table logical expressions for each output can be expressed as follows:
A >B : AB'
A <B : A'B
A = B : A'B' + AB
M Marwadi University
Fa Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
2- Bit Magnitude Comparator:
A comparator used to compare two binary numbers each of two bits is called a 2-bit magnitude
comparator. It consists of four inputs and three outputs to generate less than, equal to and greater than
between two binary numbers.
The truth table for a 2-bit comparator is given below
From the above truth table logical expressions for each output can be expressed as follows:
A >B : A1B1’ + A0B1’B0’ + A1A0B0’
A = B : A1’A0’B1’B0’ + A1’A0B1’B0 + A1A0B1B0 + A1A0’B1B0’
: A1’B1’ (A0’B0’ + A0B0) + A1B1 (A0B0 + A0’B0’)
: (A0B0 + A0’B0’) (A1B1 + A1’B1’)
: (A0 Ex-Nor B0) (A1 Ex-Nor B1)
A <B : A1’B1 + A0’B1B0 + A1’A0’B0
M Marwadi University
Fa Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
By using these Boolean expressions, we can implement a logic circuit for this comparator as given
below:
Applications of Comparators:
1. Comparators are used in central processing units (CPUs) and microcontrollers (MCUs).
2. These are used in control applications in which the binary numbers representing physical variables
such as temperature, position, etc. are compared with a reference value.
3. Comparators are also used as process controllers and for Servo motor control.
4. Used in password verification and biometric applications.
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date:13/03/2025 Enrollment No:92400120074
Procedure:
Open DEEDS Software:
Launch the DEEDS Digital Circuit Simulator (DLD).
Create a New Project:
Click on File → New to start a new digital circuit design.
Select Logic Gates:
From the Component Library, choose the required logic gates:
o AND, OR, NOT, XOR gates for implementing the comparator circuit.
Design the 1-Bit Comparator:
Place two input terminals (A and B).
Use logic gates to implement the following expressions:
o A>B:AB′A > B : AB'A>B:AB′
o A<B:A′BA < B : A'BA<B:A′B
o A=B:A′B′+ABA = B : A'B' + ABA=B:A′B′+AB
Connect the outputs to three output terminals.
Design the 2-Bit Comparator:
Place four input terminals (A1, A0, B1, B0).
Implement the following Boolean expressions using logic gates:
o A>B:A1B1’+A0B1’B0’+A1A0B0’A > B : A1B1’ + A0B1’B0’ +
A1A0B0’A>B:A1B1’+A0B1’B0’+A1A0B0’
o A=B:(A0B0+A0’B0’)(A1B1+A1’B1’)A = B : (A0B0 + A0’B0’) (A1B1 +
A1’B1’)A=B:(A0B0+A0’B0’)(A1B1+A1’B1’)
o A<B:A1’B1+A0’B1B0+A1’A0’B0A < B : A1’B1 + A0’B1B0 +
A1’A0’B0A<B:A1’B1+A0’B1B0+A1’A0’B0
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date:13/03/2025 Enrollment No:92400120074
Connect the outputs to three output terminals.
Run the Simulation:
Click on Simulate and test different combinations of inputs.
Verify the outputs match the truth table.
Capture the Screenshot:
Take a screenshot of the simulation results and paste it into the lab report.
Save and Export the Design:
Save the DEEDS project file for future reference.
Paste your simulation result screen shot here:
Name:Akhil Reddy Enrolment NO:-92400120074
One-bit comparator:-
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
Two-bit comparator: -
Name:Akhil Reddy Enrolment NO:-92400120074
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
Name:Akhil Reddy Enrolment NO:-92400120074
Conclusion:
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
POST LAB EXERCISE
1. What is the purpose of a one-bit comparator?
A) To compare two numbers and generate a carry
B) To compare two single-bit inputs and determine if they are equal, greater, or less
C) To invert a single-bit input
D) To add two bits together
Answer:
B) To compare two single-bit inputs and determine if they are equal, greater, or less
2. Which logic gates are primarily used to implement a one-bit comparator?
A) AND, OR, NOT
B) XOR, AND, OR
C) NAND, NOR, NOT
D) AND, OR, XOR, NOT
Answer:
B) XOR, AND, OR
3. What does the output of a one-bit comparator indicate?
A) Only if the two bits are equal
B) Whether one bit is greater than, less than, or equal to the other
C) The sum of the two bits
D) Whether the bits are inverted
Answer:
B) Whether one bit is greater than, less than, or equal to the other
4. In a two-bit comparator, which of the following is compared?
A) Only the least significant bit
B) The most significant bit and least significant bit of two binary numbers
C) The sum of the two binary numbers
D) The difference between two binary numbers
Answer:
B) The most significant bit and least significant bit of two binary numbers
5. What would the output of a two-bit comparator be if both inputs are equal?
A) 00
B) 01
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
C) 10
D) 11
Answer:
D) 11 (indicating both numbers are equal)
6. Which combination of logic gates is used to detect whether the two inputs are equal in a one-bit comparator?
A) AND and NOT gates
B) XOR and NOT gates
C) XOR gate
D) OR gate
Answer:
C) XOR gate
7. What is the result of a 2-bit comparator when the first input (A) is greater than the second input (B)?
A) 00
B) 01
C) 10
D) 11
Answer:
C) 10 (A is greater than B)
8. How does the two-bit comparator compare the most significant bit (MSB)?
A) It directly compares the MSBs of both inputs and uses it to determine if one input is greater than the other
B) The MSBs are ignored; only the least significant bits (LSBs) are compared
C) The MSBs are inverted before comparison
D) The MSBs are compared only if the least significant bits are equal
Answer:
A) It directly compares the MSBs of both inputs and uses it to determine if one input is greater than the other
9. What logic gate combination can be used to check if two binary numbers are not equal?
A) AND
B) XOR
C) OR
D) NOT
Answer:
B) XOR
Marwadi University
Faculty of Engineering &Technology
Subject: Digital Electronics Aim: Verify the truth table of one bit and two-bit comparator using logic
(01EC0102) gates.
Experiment No:5 Date: Enrollment No:92400120074
10. When building a comparator using logic gates, why is it important to test all possible input combinations?
A) To ensure that the comparator performs only one function
B) To verify that the truth table for the comparator is accurate
C) To check for proper power supply connections
D) To reduce the number of gates used
Answer:
B) To verify that the truth table for the comparator is accurate