Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

COmparator using xor gate

Status
Not open for further replies.

djc

Advanced Member level 1
Joined
Jan 27, 2013
Messages
402
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Location
India
Activity points
4,554
Hello all,

I want to make a comparator using XOR gate. Let's say it is a 1 bit comparator. How many XOR gates do i have to use. How to design this. Please guide me on this.
 

Hi,

show what you have done so far.

Klaus
 

Hi,

You need two XOR gates to implement to one-bit comparator. The two single bit signals are connected to the inputs of the first XOR gate. One of the inputs of the second XOR gate is connected to the output of the first XOR gate and the other is tied to Vcc (bit 1). The output of the second XOR gate gives the desired output.
 

Hi,

You need two XOR gates to implement to one-bit comparator.
It depends on what the "desired output" is.

an analog comapator can be: (I know this is not relevant here)
* Lower than
* greater than

while a digital comparator can be:
* lower than
* lower than or equal
* equal
* greater than or equal
* greather than

Klaus
 
  • Like
Reactions: djc

    djc

    Points: 2
    Helpful Answer Positive Rating
@OP,

You need to focus on what Klaus has mentioned regarding digital comparator. Do you need all those comparisons or not.
Else a single XOR gate is a very simple 1 bit comparator in itself.
Hint - Look at the truth table for a XOR gate!
 

Hi,

The solution that I provided was an output of 1 for equal inputs and 0 for unequal inputs. That was what I could assume based on what the OP wrote. Whatever output that the OP desires is achievable.
 

Solution you provided helped me implementing the logic for equality case. Further i wanted to implement greater than and less than cases too. Using truth table, assuming A and B are the inputs, the output is

A=B --> A'B' + AB
A<B --> A'B
A>B --> AB'

Now working on how to implement this using XOR gate.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top