Digital comparator (source code)

= Digital comparator

= Binary comparator
{synonym}

A <combinational logic> device comparing two fixed-width <binary representations>. For unsigned inputs $a,b$, a two-output encoding is $L=1$ exactly when $a<b$ and $G=1$ exactly when $a>b$. Equality gives $(L,G)=(0,0)$; $(1,1)$ is unreachable. A one-<bit> implementation is $L=\neg a\land b$, $G=a\land\neg b$.