# Serial binary comparator

#### Sanel Civic

Joined May 18, 2018
5
Hi guys I need help with my project for school.
I need to project an serial binary comparator with two inputs x1, x2 and three outputs y1, y2, y3.
The binary numbers come on the inputs the same time from the most significant bit.
On the outputs I need to get a logical "1" at the y1 if A>B, on y2 if A=B, and on y3 if A<B.
I can only use one JK flip-flop, one D flip-flop, and AND, OR, NOT circuits.
Any ideas ? :/

#### AnalogKid

Joined Aug 1, 2013
10,800
Are the x1 and x2 inputs individual bits, 8-bit bytes in parallel, or what?

ak

#### Sanel Civic

Joined May 18, 2018
5
By the text of this project it needs to be more bits and made like a sequential circuit.
Soo the bits are limited by the 2 flip flops that can store them.
And they need to be serial, just 2 inputs for 2 binary numbers.

#### WBahn

Joined Mar 31, 2012
29,534
MOD NOTE: Moved to Homework Help.

#### WBahn

Joined Mar 31, 2012
29,534
Since this is schoolwork, you need to show your best attempt to work the problem.

Think about how you would do it by hand.

Consider what information you need to remember from one bit to the next in the input stream?

#### Sanel Civic

Joined May 18, 2018
5
Im trying the last 6 hours but I can't figure it out, the only thing i have to save here is if A=B, because it starts with the highest bit

#### shteii01

Joined Feb 19, 2010
4,644

#### WBahn

Joined Mar 31, 2012
29,534
Im trying the last 6 hours but I can't figure it out, the only thing i have to save here is if A=B, because it starts with the highest bit
So let's play a game.

I have two n-bit numbers (I'm not even going to tell you what n is).

The first two bits of each are x = 1 and y = 0.

What can you tell me about the values as a whole?

#### Sanel Civic

Joined May 18, 2018
5
x>y and you don't even need to compare them anymore
I figured it out, for example i have two numbers, 11001 and 11101, the second* one is bigger i don't even need to compare them after the thrid number, so how can I make the circuit stop changing the output and just have that one output on logical 1

#### WBahn

Joined Mar 31, 2012
29,534
x>y and you don't even need to compare them anymore
I figured it out, for example i have two numbers, 11001 and 11101, the second* one is bigger i don't even need to compare them after the thrid number, so how can I make the circuit stop changing the output and just have that one output on logical 1
Sounds like you need to remember something, doesn't it.

Hint: There's a reason that flip flops are used to make a thing called "memory".

#### Sanel Civic

Joined May 18, 2018
5
I got itttt, thank you for your response, love you guys <3 <3

#### WBahn

Joined Mar 31, 2012
29,534
I got itttt, thank you for your response, love you guys <3 <3
Good!

Hopefully you are a bit impressed by how a seemingly pretty complicated problem turns out to have a very simple solution. Certainly this is not always the case, but you'd be surprised how often it is.

But also notice that the key to getting the simple solution was to understand some fundamentals about how values are represented and how information about how values relate to each other can be gleaned from that representation.

Furthermore, it shows the power of considering how you would do something by hand.