# Comparing two 2-bit binary numbers

In order to compare two 2-bit numbers, I need to create a truth table, develop the equation for the equal more or less case, optimize the equations the the Karnaugh maps, and then develop the circuits.

The circuit needs to be developed to define if the numbers are equal, or one number is more or less than the other.

In order to test this circuit, I need to use binary switches and binary probes to set up two numbers and exercise all possible cases to make sure the developed circuits covers all the possible relations between two 2-bit binary numbers.

Can someone please help me out with this. I use LogicsWork4 to create circuits on the computer just to let you know.

-
Which part are you having difficulty with? – Alfonso Fernandez Mar 4 '13 at 17:27
Hello Alfonso Fernandez, I am struggling with everything mentioned within this question. Thanks! – silent man Mar 4 '13 at 17:34
@silentman Even if you're struggling with everything, I'm sure you can make some attempt at the problem. Could you at least show some of your work (even if it is not perfect)? (Also, is this homework? (It sounds like it.) If so, please tag as such.) – apnorton Mar 4 '13 at 18:25

You better have a look at the digital comparator. The functions are derived for a 4-bit comparator and ready to use. I think you can build your circuit for 2 bit binary numbers after reading the wiki.

-
I still don't get it. Could you build the circuit for me – silent man Mar 4 '13 at 17:55
You have to tell me what part you do not get, so that I can help you understand it. We are not a community doing homework for each other but helping understand the parts you do not and help you do it yourself. – Varaquilex Mar 4 '13 at 17:58

Since two binary numbers are only equal if and only if all digits are equal, your question reduces to designing a circuit that compares one digit numbers - this is the XNOR gate. To get the final result, use an AND gate on the result.

Let the first number be $A,B$ and the second $C,D$. Then your circuit simply reads: $$(A \odot C)\cdot(B \odot D)$$

-
I still don't get it. Could you build the circuit for me – silent man Mar 4 '13 at 17:56
@silentman - I just did that. – nbubis Mar 4 '13 at 18:13

Hint: Let $a = a_n a_{n-1} \dots a_1$ and $b = b_n b_{n-1} \dots b_1$ be two unsigned $n$-bit binary numbers, such that $a_n$ and $b_n$ are their most significant bits, $a_{n-1}$ and $b_{n-1}$ the second most significant bits, and so on down to the least significant bits $a_1$ and $b_1$. Then $a > b$ if and only if either:

1. $a_n = 1$ and $b_n = 0$, or
2. $a_n = b_n$ and $a_{n-1} \dots a_1 > b_{n-1} \dots b_1$.
-