Let's say we have two double digit binary number: AB and CD with input of logic input as follows:
A
C
B
D
[ we want to compare the corresponding digit ]
Output:
top : TRUE if AB > CD
middle : TRUE if AB < CD
bottom : TRUE if AB = CD
How does it work?
- In order for AB to be larger than CD, A must be greater than C OR (A is equal to C and B is greater than D)
- similar reasoning for the case AB < CD.
- in order for AB = CD, A must be equal to C and B must be equal to D
BONUS:
If we put the entire circuit in a black box, we can make 4 digits binary comparator easily by putting the black box in the similar arrangement as the 'single digit binary comparator' (the most-left part)