Equality Comparators using Logic Gates

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

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:

Truth Table of an XNOR logic gate

Truth Table of an XNOR logic gate

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:

4-bit Digital Equality Comparator Logic Gates Diagram

4-bit Digital Equality Comparator Logic Gates Diagram

Logic.ly

You can recreate this circuit online using the logic.ly circuit simulator.

4-bit Digital Equality Comparator Circuit using logic.ly

4-bit Digital Equality Comparator Circuit using logic.ly

Share Button
Tagged with: