A magnitude comparator determines whether one binary value is smaller, equal or larger than another. For unsigned numbers, start at the most significant bit: the first differing bit decides the order. Equality requires every corresponding bit to match.

Worked example

Compare unsigned A = 1010 and B = 1001. The first two bits match. At the third bit from the left, A has 1 and B has 0, so A > B. You can also confirm their decimal values, 10 and 9.

What to watch for

A simple unsigned comparison is not a signed comparison. In twos complement, a leading one denotes a negative value and must be interpreted accordingly.

Try it yourself

Are unsigned 0111 and 1000 ordered the same way when read as four-bit twos complement?

Answer: No. Unsigned, 7 < 8. Signed, they represent +7 and −8, so the first is larger.

How to study this topic

Name each input and define its active level before drawing gates. Follow one data path at a time, then check the other combinations. A complete specification is the best starting point for a reliable circuit.

Explore related programmes

These recorded programmes are upcoming. This article is general educational content, not a syllabus or course sample.

Digital Electronics