Abstract
Magnitude Comparators are combinational circuits that compare two -bit binary numbers ( and ) to determine their relative values. An Equality Comparator evaluates bitwise equivalence using XNOR gates combined through an AND tree (or by checking if ). A Less-Than Comparator () leverages two’s complement subtraction () and checks if the resulting sign bit (Most Significant Bit) indicates a negative value. By manipulating input order () and negating outputs, all six standard relational operations () can be synthesized from basic equality and less-than logic.
Equality Comparators ()
An Equality Comparator evaluates to Logic if and only if every corresponding pair of bits in two -bit inputs and are identical ( for all ).
Circuit Architecture
- Bitwise Comparison (XNOR Gate): For each bit position , an XNOR gate outputs if and match.
- Global Equivalence (AND Tree): The overall equality output is active only when all bitwise XNOR outputs are .

N-Bit Equality Comparator using Bitwise XNOR Gates and an N-Input AND Gate
Alternative Design: Subtraction-Based Equality
Equality can also be evaluated using an Adder-Subtractor block:
- Compute the difference .
- If , then (all difference bits ).
- Feed all difference bits into an -input NOR gate:
Mux/Gate Swap Comparison
Using an dedicated XNOR-AND tree requires fewer gate levels and has lower propagation delay compared to waiting for carry propagation through a full subtractor array.
Less-Than Comparators ()
A Less-Than Comparator determines whether is strictly less than .
Subtraction-Based Implementation
To evaluate , the circuit performs two’s complement subtraction:
In two’s complement representation:
- If , the result is non-negative, and the Most Significant Bit (MSB / sign bit) is ().
- If , the result is negative, and the Most Significant Bit (MSB / sign bit) is ().

N-Bit Less-Than Comparator derived from Subtractor Sign Bit ()
Overflow-Corrected Signed Comparisons
For signed numbers where arithmetic overflow () can occur, the true less-than condition incorporates overflow correction:
Deriving All Relational Operators
All six standard relational operators can be constructed using an Equality block () and a Less-Than block () by swapping input ports () or inverting output signals.
| Desired Relation | Hardware Expression | Derivation Rule |
|---|---|---|
| Equal () | Direct Equality Output | |
| Not Equal () | Invert Equality Output | |
| Less Than () | Direct Less-Than Output () | |
| Greater Than or Equal () | Invert Less-Than Output () | |
| Greater Than () | Swap Input Ports () | |
| Less Than or Equal () | Invert Swapped Less-Than Output () |