130 likes | 370 Views
Comparators. What is it?. A comparator is circuitry that compares two inputs A and B, determining whether the following conditions are true or false A = B A > B A < B A B A B A B. Two will do. Actually the first two will suffice, since the others are easily related to these
E N D
What is it? • A comparator is circuitry that compares two inputs A and B, determining whether the following conditions are true or false • A = B • A > B • A < B • A B • A B • A B
Two will do • Actually the first two will suffice, since the others are easily related to these • A < B (NOT(A > B)) AND (NOT(A = B)) • A B (A > B) OR (A = B) • A B NOT(A > B) • A B NOT(A = B)
Comparing word equality • To compare if two words are equal, you pair up the bits holding the same position in each word, and each individual pair must be equal for the words to be equal. • 1100 and 1110 {(1,1),(1,1), (0,1), (0,0)} are not equal • 1100 and 1100 {(1,1),(1,1), (0,0), (0,0)} are equal
Comparing word inequality • Assume unsigned integers, then • If the most significant bit of word A is greater than the most significant bit of word B, then word A is greater than word B. • If the most significant bit of word A is less than the most significant bit of word B, then word A is less than word B. • If the most significant bit of word A is equal to the most significant bit of word B, then we must compare the next most significant bits.
And so on • If the most significant bits are equal, one compares the next-most significant bits. • Then if the next most significant bits are equal, one compares the next-next-most significant bits, and so on. • It seems that one must know the outcome of testing the more significant bits before one proceeds to the less significant bits.
Timing issues • In terms of circuitry, this would seem to require many layers, the output of one layer being fed into the next layer. • There would seem to be as many layers as there are bits in the word. • Each layer of circuitry requires time to settle into the desired state. • More layers means more time.
Scaling • If the comparing is to be done in one clock cycle, this clock’s period restricts the size of the word that can be compared. • It is said that such circuitry “does not scale,” that is, changing the word size produces (timing) problems not seen in the smaller word size.
Combinatorial scaling • Recall that combinatorial logic is expressible in terms of a truth table. • Recall our procedure to realize a truth table as a circuit: we focus on the true (1) outputs, etc. • Thus logical circuits really require only three layers: inverting the inputs, ANDing inputs or inverted inputs, ORing the output of the AND gates
Complexity • Sometimes the price one pays to have a circuit that scales is loss of simplicity. • There are fewer layers, but more going on in a given layer. • There are other possible problems, • The scaling circuit may have a given input attached to many gates. • A given gate may have many inputs. • Potential power problems.