Current Comparators
When you use the word comparator, you might automatically assume that it compares voltages. However, that doesn’t always have to be the case. Sometimes, it’s useful to compare currents. Figure 11-8 shows a bipolar current comparator.

Figure 11-8. Bipolar current comparator.
With the simple current mirror of transistors Q1 and Q2, even a small difference in the magnitudes of I1 and I2 will show up quite dramatically at the base of Q3. This will turn Q3 ON or OFF.
Setting Ibias to twice the level of I1 and I2 eliminates the base-current error. The only remaining error is due to the Early effect of Q3. This is easily reduced by adding another NPN stage and using a more sophisticated current mirror in place of Q4.
CMOS Current Comparator
The CMOS version is almost identical, as we see in Figure 11-9.

Figure 11-9. A CMOS version of the current comparator.
There is, of course, no base-current error. However, the comments above about the Early effect (or channel shortening) still apply.
Even without any improvements, both circuits switch abruptly within 0.0006% over a wide temperature range. Matching variations, however, are another matter. You may have to make the input current mirrors quite large to get enough accuracy. To find out, use a Monte Carlo analysis.