Abstract:
A binary comparator for comparing two binary digits A and B includes multiple Equality Check Pass Gates (ECPGs E0-E3) connected serially to one another, for comparing the respective bit pairs from the least significant bit to the most significant bit of the binary digits A and B, two resistance units (P1, P2), two inverters (INV31, INV32) and multiple switching transistors, and is capable of obtaining the result of comparing the two binary digits A and B (A&gt;B, A=B or A&lt;B) in a short time due to the simple constitution thereof.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention is directed to a binary comparator, and in particular to a simply-constituted binary comparator capable of comparing two binary digits in a short time. 
     In the present specification, binary digits A and B (`A=a n  a n-1  . . . a 0  `, `B=b n  b n-1  . . . b 0  `) are compared in the case that the number of bits is 4, that is, n is 3, as an example. 
     2. Description of the Background Art 
     FIG. 1 is a constitutional diagram of a binary comparator implemented with full adders in accordance with the conventional art. The conventional binary comparator includes: four inverters (INV3, INV2, INV1, INV0) for respectively inverting the logic states of each bit (b3, b2, b1, b0) of a binary digit B; full adders (ADD3, ADD2, ADD1, ADD0) to which the outputs of the inverters (INV3, INV2, INV1, INV0) and each bit of a binary digit A (a3, a2, a0, a1) are respectively inputted; inverters (INV13, INV12, INV11, INV10) for respectively inverting the outputs of the full adders (ADD3, ADD2, ADD1, ADD0); and an AND gate (AND10) for ANDing the outputs of the inverters (INV13, INV12, INVL11, INV10). The carry input of the full adder (ADD0) at the LSB location is always set to 1, and the carry is externally outputted from the full adder (ADD3) at the MSB location. 
     The operation of the above-mentioned binary comparator implemented with full adders in accordance with the conventional art will now be described. In order to explain the operation thereof easily, it is assumed that the binary digit A is 1011 2  and the binary digit B is 1001 2 . Therefore, a3=1, a2=0, a1=1, a0=1 and b3=1, b2=0, b1=0, b0=1. 
     The bit `a0=1`, the bit `bo=0` and the carry `1` are inputted to the full adder (ADD0). As a result, the sum and the carry values respectively become `0` and `1`. The sum `0` becomes `1` after being inverted in the inverter (INV10). 
     The bit `a1=1` and the bit `b1=1` are inputted to the full adder (ADD1), and the carry `1` is inputted from the full adder (ADD0) to the full adder (ADD1). Consequently, both the sum and the carry values become `1`. The sum `1` becomes `0` after being inverted in the inverter (IVN11). 
     The bit `a2=0` and the bit `b2=1` are inputted to the full adder (ADD2), and the carry `1` is inputted from the full adder (ADD1) to the full adder (ADD2). Accordingly, the sum and the carry values respectively become `0` and `1`. The sum `0` becomes `1` after being inverted in the inverter (INV12). 
     The bit `a3=1` and the bit `b3=0` are inputted to the full adder (ADD3), and the carry `1` is inputted from the full adder (ADD2) to the full adder (ADD3). As a result, the sum and the carry values respectively become `0` and `1`. The sum `0` becomes `1` after being inverted in the inverter (INV13). Here, the carry `1` is outputted externally. The carry `1` implies that the binary digit A is larger than the binary digit B. 
     The respective outputs `1`, `1`, `0` and `1` of the inverters (INV13, INV12, INV11, INV10) are ANDed in the AND gate (AND 10). Consequently, the output thereof becomes `0`, which implies that the binary digits A and B are not equal. 
     As described above, the respective full adders in conjunction with the input inverters perform A-B operation, namely, a subtraction. In the case that the outputs of all full adders are `0`, then A is equal to B. However, in the case the output of the carry is `1`, then A is larger than B. 
     The operations performed above are represented by the following logic expressions. 
     
         (A=B).tbd.(a3⊕b3)·(a2⊕b2)·(a1⊕b1)·(a0⊕b0)                                                  (1) 
    
     
         (A&gt;B).tbd.a3b3+a2b2(a3⊕b3)+a1b1(a3⊕b3)(a2⊕b2)+a0b0(a3⊕b3)(a2⊕b2)(a1⊕b1)                                       (2) 
    
     Here, `⊕` and `(a i  ⊕b i )` respectively represent an exclusive-OR operation and an exclusive-NOR operation. 
     Expression (1) implies that A is equal to B if the values of the respective bits are equal to each other. Expression (2) implies that the values of the bits a3 and b3 which are respectively MSB[s] of the binary digits A and B are compared, and then, if the values thereof (a3, b3) are equal to each other, the value of the bit a2 is compared with that of the bit b2, and if the values thereof (a2, b2) are equal, the value of the bit a1 is compared with that of the bit b1, and then, if the values thereof (a1, b1) are equal, the value of the bit a0 is compared with the value of the bit b0. 
     The entire operation speed of the circuit is determined by the full adder thereof. However, the above four full adders are complex in constitution because they include multiple transistors. 
     FIG. 2 is a constitutional diagram of a binary comparator implemented with logic gates in accordance with the conventional art. The constitution of the binary comparator in FIG. 2 is simpler than that of the binary comparator in FIG. 1 because the binary comparator illustrated in FIG. 2 is constituted by using the boolean properties represented in Expressions (1) and (2). 
     As shown in FIG. 2, the binary comparator includes four NOR gates (NOR3, NOR2, NOR1, NOR0), four AND gates (AND23, AND22, AND21, AND20), and an OR gate (OR). 
     The Nor gate (NOR3) performs the exclusive-NOR operation `(a 3  ⊕b 3 )` upon the input bits (a 3 , b 3 ) and the other NOR gates (NOR2-NOR0) also perform exclusive-NOR operations upon the input bits (a 2 , b 2 ) (a 1 , b 1 ) (a 0 , b 0 ), respectively. 
     The respective outputs of the four NOR gates (NOR3-NOR0) are ANDed in the AND gate (AND20). The operation performed in the AND gate (AND 20) is represented in the above logic expression (1). 
     That is, the AND gates (AND23, AND22, AND21) respectively perform the operations `a 2  b 2  (a 3  ⊕b 3 )`, `a 1  b 1  (a 3  ⊕b 3 )(a 2  ⊕b 2 )` and `a 0  b 0  (a 3  ⊕b 3 )(a 2  ⊕b 2 )(a 1  ⊕b 1 )`. In addition, the operation performed in the OR gate (OR) is represented by the above logic expression (2). 
     However, the constitution of the binary comparator adopting the logic gates in accordance with the conventional art illustrated in FIG. 2 is also complex due to the multiple transistors. Accordingly, the binary comparators described above have a disadvantage in that the operation speed thereof is slow. 
     SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a binary comparator whose operation speed is fast, by using a small number of transistors. 
     An object of the present invention is to provide a binary comparator that substantially overcomes one or more problems caused by limitations or disadvantages of the background art. 
     In order to achieve the above-described object, in accordance with the present invention, there is provided a binary comparator for comparing two binary digits A and B (A=a n  a n-1  . . . a 0 , B=b n  b n-1  . . . b 0 ) having the identical number of bits which includes: 
     first and second resistance units (P1, P2) with their one sides respectively connected to a power supply voltage; 
     multiple Equality Check Pass Gates (hereinafter, &#34;ECPG&#34;) (En-E0) as many as the respective bits of the two binary digits A and B connected serially between the other side of the first resistance unit (P1) and ground, for comparing the respective bits (a n , b n ), (a n-1 , b n-1 ), . . . , (a 0 , b 0 ) of the two binary digits A and B; 
     a first inverter (INV31) connected to a junction of the first resistance unit (P1) and the ECPG (E0) comparing the lowest bits of A and B (a 0 , b 0 ), for inverting a level of an input signal and outputting it externally; 
     multiple switching transistors (Nn-N0) respectively connected between the other side of the second resistance unit (P2) and the other sides of the multiple ECPGs, for being switched by the AND-combined values `(a n  b n )(a n-1  b n-1 ), . . . , (a 0  b 0 )` of the respective bit values of the binary digit A and the inverted binary digit B; and 
     a second inverter (INV32) connected to a junction of the other side of the second resistance unit (P2) and the multiple switching transistors (Nn-N0), for inverting a level of an input signal and outputting it externally. 
     To further achieve the above objects in a whole or in parts, there is provided a comparator that compares first and second binary signals according to the present invention that includes substantially claim 12. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention will become better understood with reference to the accompanying drawings which are given only by way of illustration and thus are not limitative of the present invention, wherein: 
     FIG. 1 is a constitutional diagram of a binary comparator implemented with full adders in accordance with the conventional art; 
     FIG. 2 is a constitutional diagram of a binary comparator implemented with logic gate elements in accordance with the conventional art; 
     FIGS. 3 is a constitutional diagram illustrating a preferred embodiment of a binary comparator in accordance with the present invention; and 
     FIG. 4 is a detailed circuit diagram of the respective parts of the binary comparator illustrated in FIG. 3. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The present invention will now be explained based on FIGS. 3 and 4. The two binary digits A and B are respectively expressed as `A=a n , a n-1  . . . a 0  ` and `B=b n  b n-1  . . . b 0  `. The case for `n` being 3 is given as an example in the present specification. 
     FIG. 3 is a constitutional diagram illustrating a preferred embodiment of a binary comparator in accordance with the present invention. As shown in FIG. 3, the source of a first PMOS transistor (P1) is connected to a power supply voltage (Vcc), the gate thereof is grounded, and four equality check pass gates (hereafter ECPGs) are serially connected between the drain of the PMOS transistor (P1) and ground. First through fourth ECPGs are labeled (E0, E1, E2, E3) in FIG 3. Bits `a 0  ` and `b 0  ` are inputted to the first ECPG (E0), `a 1  ` and `b 1  ` are inputted to the second ECPG (E1), `a 2  ` and `b 2  ` are input to the third ECPG (E2) and, `a 3  ` and `b 3  ` are inputted to the fourth ECPG (E3). A first inverter (INV31) is connected between the drain of the PMOS transistor (P1) and a first output terminal (OUT1). 
     In addition, the source of a second PMOS transistor (P2) is connected to the power supply voltage (Vcc), the gate thereof is grounded, and the drains of four NMOS transistors (N0-N3) are commonly connected together to a node (y), namely, the drain of the second PMOS transistor (P1). 
     The source of the NMOS transistor (N0) is connected to a junction (node x1) between the first ECPG (E0) and the second ECPG (E1), and the value `a 0  b 0  ` is inputted to the gate of the NMOS transistor (N0). The source of the second NMOS transistor (N1) is connected to a junction (node x2) between the second ECPG (E1) and the third ECPG (E2), and the value `a 1  b 1  ` is inputted to the gate of the NMOS transistor (N1). The source of the third NMOS transistor (N2) is connected to a junction (node x3) between the third ECPG (E2) and the fourth ECPG (E3), and the value `a 2  b 2  ` is inputted to the gate of the NMOS transistor (N2). The source of the fourth NMOS transistor (N3) is connected to ground, and the value `a 3  b 3  ` is inputted to the gate of the NMOS transistor (N3). 
     The above-described two PMOS transistors (P1, P2) operate as resistance units. 
     A second inverter (INV32) is connected between the drain of the PMOS transistor (P2) and a second output terminal (OUT2). 
     FIG. 4 illustrates the detailed constitutional diagram of a preferred embodiment of each of the ECPGs (E0-E3) and AND gates (AND0-AND3) for obtaining the bit values which are respectively outputted from the ECPGs (E0-E3) and applied to the gates of the four NMOS transistors (N0-N3). As shown in FIG. 4, the four ECPGs (E0-E3) are turned on or off pursuant to the input bit values (a 0 , b 0 ) (a 1 , b 1 ) (a 2 , b 2 ) (a 3 , b 3 ) like a switch. That is, if the logic states of the two inputs, a i  and b i , are equal, the ECPG concerned is turned on, and if the logic states thereof are different, it is turned off. 
     In addition, the respective bits (a i ) of the binary digit A are inputted to one input terminal of the respective AND gates (AND0-AND3), and the inverted values of the respective bits (b i ) of the binary digit B are respectively inputted to the other input terminals of the AND gates (AND0-AND3). The output terminals of the AND gates (AND0-AND3) are connected to the respective gates of the four NMOS transistors (N0-N3). 
     The operation of the preferred embodiment of the binary comparator of FIG. 3 according to the present invention will now be described. 
     If the values of the inputs A and B are equal, that is, if (a 0 , b 0 ) (a 1 , b 1 ) (a 2 , b 2 ) (a 3 , b 3 ) are each respectively equal, the four ECPGs (E0, E1, E2, E3) are all turned on. Accordingly, the node (x) is at a ground level and the output terminal (OUT1) is rendered to a logic level of `1` by the inverter (INV 31) whose input terminal is connected to the node (x). The level `1` at output terminal (OUT1) implies that the value of the binary digit A is equal to that of the binary digit B (A=B). 
     On the other hand, if the two inputs, A and B are not equal, one or more among the four ECPGs (E0, E1, E2, E3) is not turned on. If `a 3  ` is different from `b 3  `, the fourth ECPG (E3) is turned off. In the case that `a 3  ` is greater than `b 3  `, the fourth NMOS transistor (N3) is turned on, the level of the node (y) is thereby at ground level and the level at output terminal (OUT2) is transited to `1`. 
     If `a 3  ` is equal to `b 3  `, the fourth ECPG (E3) is turned on. If `a 2  ` is different from `b 2  `, the third ECPG (E2) is turned off. In the case that `a 2  ` is greater than `b 2  ` the third NMOS transistor (N2) is turned on, the node (y) is at ground level and the output terminal (OUT2) is transited to `1`. 
     The second ECPG (E1) and the second NMOS transistor (N1), and the first ECPG (E0) and the first NMOS transistor (NO) are also operated respectively in the same way as described above, pursuant to the logic states of `a 1  and b 1  ` and `a 0  and b 0` . 
     The above-described case where the two inputs A and B are not equal will now be explained by separating it into the cases that the input A is greater than the input B and that the input A is smaller than the input B. First, the case that the input A is greater than the input B is described below. 
     It is assumed that the binary digits A and B are 1011 2  and 1001 2 , respectively. Accordingly, a3=1, a2=0, a1=1, a0=1 and b3=1, b2=0, b1=0, b0=1. 
     The fourth ECPG (E3), the third ECPG (E2) and the first ECPG (E0) are turned on. As the two inputs of the second ECPG (E1), `a 1  ` and `b 1  ` are not equal, the second ECPG (E1) is turned off. Accordingly, the node (x) is at a power supply voltage level and the output terminal (OUT1) is at a level of `0`. 
     In addition, the input `a 1  ` is inputted to the AND gate (AND1) and the inverted input `b 1  ` is inputted to the AND gate (AND1). Therefore, the output of the AND gate (AND1), `a 1  b 1  ` is at a high level and thus, the second NMOS transistor (N1) is turned on. The remaining three AND gates (N0, N2, N3) are turned off by the values a 0  b 0  , a 2  b 2  , a 3  b 3   respectively inputted thereto. Accordingly, the node (y) is at a ground level and the output terminal (OUT2) is rendered to a level of `1`. Consequently, if the level of the output terminal (OUT2) is `1`, it implies that the binary digit A is greater than the binary digit B (A&gt;B). 
     The contrary case where the binary digit A is smaller than the binary digit B is next explained. It is assumed that the binary digits A and B are respectively 1001 2  and 1011 2 . The operations of the elements except for the second NMOS transistor (N1) are identical to the operations described previously when the binary digits A and B are 1011 2  and 1001 2 , respectively. The value `a 1  b 1  ` inputted to the second NMOS transistor (N1) is at a low level and the node (y) is at the power supply voltage level (Vcc). Accordingly, the output terminal (OUT2) is set to a level of &#34;0&#34;. Consequently, if the levels of the output terminals (OUT1, OUT2) are both `0`, it implies that the binary digit A is smaller than the binary digit B (A&lt;B). 
     As described so far, the values A and B compared above have four bits, respectively. If the number of bits of A and B are respectively five, a fifth ECPG would be serially connected to the four ECPGs (E0-E3) additionally, a fifth transistor would be connected in parallel with the four transistors (N0-N3), and an AND gate would be connected additionally between the added ECPG and transistor. 
     That is, an ECPG would be connected additionally between the node (x) and the first ECPG (E0) illustrated in FIG. 3. A transistor would be added between a junction of the added ECPG and the first ECPG (E0) and the node (y). And, an AND gate would be added between the added ECPG and transistor, as illustrated in FIG. 4. 
     Therefore, in order to compare two values whose numbers of bits are identically `n`, the binary comparator in accordance with the present invention includes two inverters, `n` ECPGs and `n` NMOS transistors. 
     The number of the transistors used in the preferred embodiment of the binary comparator of FIG. 3 according to the present invention is one third the number of the transistors used in the comparator of FIG. 2 in accordance with the conventional art. 
     In addition, the time for obtaining the output `A=B` is similar in the conventional art and the preferred embodiment of the binary comparator according to the present invention. However, it is faster to obtain the output `A&gt;B` in accordance with the preferred embodiment of the binary comparator according to the present invention than in the conventional art. 
     As the present invention may be embodied in several forms without departing from the spirit of essential characteristics thereof, it should also be understood that the above-described embodiment is not limited by any of the details of the foregoing description, unless otherwise specified, but rather should be construed broadly within its spirit and scope as defined in the appended claims, and therefore all changes and modifications that fall within the meets and bounds of the claims, or equivalences of such meets and bounds are therefore intended to be embraced by the appended claims.