# How do I design a cascade network of 1-bit comparators to determine if two n-bit numbers are equal?

I'm reading through the "Logic Design" chapter in Givone's Digitial Principles and Design and this is one of the problems at the end of the chapter. I read the section on comparators thoroughly, but still do not understand how to do this problem.

Essentially, the end goal is to design a 1-bit comparator that can be cascaded into a larger network in order to determine if 2 n-bit numbers are equal.

How do I even approach this problem?

What's primarily tripping me up is the "n-bit number" restriction. Does this mean my network should be able to handle two numbers of infinite length? or does it mean that the 1-bit comparator I design should be able to function if it's put into a cascaded network containing n of them?

Any pointers would be greatly appreciated.

I'm not sure if this is homework or not, so I am not going to directly answer, but hopefully, the following will help you visualise the problem and solve it.

How would you check if a two decimal numbers are the same? For example, how would you check if 123456 == 123456?

Well, you'd first check the units, are they same? 6 == 6, so yes Then you'd check the tens, are they the same? 5 == 5, so yes And so on.

Now you have checked 6 times for the 6 digit number. So how do you combine the result?

Well, you know that in order for the numbers to be equal, the units must be equal and the tens must be equal, and the hundreds must be equal, and ...

So how do you apply the same thing to binary?

You do it in the same way, only in binary your digits are representing powers of two rather than ten, so instead you check that the units are equal, and you check that the twos are equal, and check the fours are equal, and the eights, and so on.

Hopefully now you should be able to see how you can combine your 1 bit comparators (remember that 1 bit = 1 binary digit) to compare an n bit number.

Just to clarify another point that I've just noticed you read, n bit simply means the number of bits required in a specific application - for example if you need to compare 8 bit numbers, then n=8.

But based on the above, it should be clear that there is a structure that can be applied in a general case for any number of bits.