An equality comparator is a hardware electronic circuit made from logic gates that takes two binary numbers as input determines whether these are equal or not. Equality comparators and magnitude comparators (used to determine whether a binary input is larger, lower or equal to another binary input) are used in central processing units (CPUs) and microcontrollers.
XNOR Logic Gate
An XNOR logic gate can be used to compare two 1-bit inputs and as it outputs 1 if both inputs are the same, and 0 if they are different:
4-bit Equality Comparator
Two binary inputs are equal if all their bits are equal. We can therefore design a multi-bit equality comparator by combining several XNOR gates together to compare each bit of both inputs.
For instance, here is the logic gate diagram of a 4-bit equality comparator:
Logic Gates Studio
You can recreate this circuit online using the our logic gates circuit simulator.
You can recreate this circuit online using the logic.ly circuit simulator.