Floating point comparison is similar to the comparison of two numbers in fixed point arithmetic as discussed in the post for combinational circuits. The same architecture can be used here also. Yet this architecture is discussed here to have clear idea about floating point comparison.
The steps involving the comparison of two floating point numbers and are
- Compare the sign bits. If both are of same sign then proceed to the next step.
- Compare the exponents. If both exponents are also equal then go to the next step.
- Compare the mantissas. Generate three outputs ( and ).
Here we have shown a comparator for two 16-bit floating point numbers and . This 16-bit comparator is realized using 3 comparators viz, 1-bit comparator (Sign check), 4-bit comparator (Exponent check) and 11-bit comparator (mantissa check). Two sign bits are compared using a simple 1-bit comparator. Here we will use the opposite of the convention used in case of 1 bit comparator. This is because, here if the sign bit is then the number is negative and thus lesser. If sign of both the numbers are same then the exponents are compared. Here a 4-bit comparator is used to compare the exponents. If both the numbers have same sign and their exponents are also equal then at the last step mantissas are compared. The two mantissas are compared using a 11-bit comparator. The architecture of the comparator is shown in Figure 1.