Comparators

A digital logic component that compares two binary numbers.

Comparator

Equality Comparator

Outputs whether the two numbers are equal or not.

Magnitude Comparator

Outputs whether the two numbers are equal or less than or greater than.

1-Bit Magnitude Comparator

Suppose the comparator takes in AA and BB. And the output GG denotes whether AA is greater than BB.

G=ABG = A\overline{B}

E=AB+ABE = AB + \overline{A}\cdot\overline{B}

L=ABL = \overline{A} B

n-Bit Magnitude Comparator

Let xi=AiBi+AiBi=AiBix_i = A_i B_i + \overline{A_i}\cdot \overline{B_i} = \overline{A_i \oplus B_i}. xix_i denotes if Ai=BiA_i = B_i.

G=i=0n1((j=i+1n1xj)AiBi)G = \sum_{i=0}^{n-1} \Bigg(\bigg(\prod_{j=i+1}^{n-1}{x_j}\bigg) A_i\overline{B_i}\Bigg) E=i=0n1xiE = \prod_{i=0}^{n-1} {x_i} L=i=0n1((j=i+1n1xj)AiBi)L = \sum_{i=0}^{n-1} \Bigg(\bigg(\prod_{j=i+1}^{n-1}{x_j}\bigg) \overline{A_i}B_i\Bigg)
Written by September 13, 2026 1 min read
Was this helpful?