Comparator (digital technology)
A comparator in digital technology is an electronic circuit that compares two digital values.
Identity Comparator
Identity comparators ( English Identity Comparator ) test two bits for equality, which with the help of a XNOR gate is done. To compare bytes , two equivalent bits are compared with each other and the result is linked with an AND gate .
Compares | family | designation |
---|---|---|
2 × 8-bit byte | TTL | SN74LS688 (from TI ) |
2 × 9-bit bytes | TTL | AM29809 (from AMD ) |
Size comparator
Magnitude comparators (Engl. Magnitude Comparator ) in addition to equality on the relations Bigger and Smaller test. In order to be able to carry out the size comparison, the two numbers must be coded in the same way. In addition, the size comparator must be designed for the code used.
a | b | y a> b | y a = b | y a <b | |
---|---|---|---|---|---|
0 | 0 | 0 | 1 | 0 | |
0 | 1 | 0 | 0 | 1 | |
1 | 0 | 1 | 0 | 0 | |
1 | 1 | 0 | 1 | 0 |
n-bit size comparator
An n-bit size comparator is based on the fact that the difference is formed from the sizes to be compared and the result is checked for 0, <0,> 0. In the binary code, the adder is based on the addition of the two's complement , i.e. (-B) is the same as (+! B + 1). When adding a number with its inverted number (e.g. 1001101 + 0110010 = 1111111), the result is all bits 1. If a number is subtracted from itself, (A - A = A + (! A + 1) = 0 , carry = 1) the result is 0, with carry 1.
If A is to be compared with B, then:
condition | Note | equivalent to | Intermediate result | Carry | Result |
---|---|---|---|---|---|
A == B | A = B | B +! B + 1 | b'1..11 + 1 | 1 | 0 |
A> B | A = B + d | B + d +! B + 1 | b'1..11 + 1 + d | 1 | d |
A <B | A = B - d | B - d +! B + 1 | b1..11 + 1 -d | 0 | -d |
Compares | family | designation |
---|---|---|
2 × 5-bit byte | ECL | MC10166 |
2 × 8-bit byte | TTL | SN74LS682 to SN74LS689 |
extension
To compare bytes that have more digits than is specified by the comparator module, several comparators can be connected in series or in parallel. The parallel solution has the advantage of lower latency for bytes with many digits , which results in a higher speed. The serial structure is only recommended if it means that fewer comparator modules have to be used.