This application claims priority to Taiwan Patent Application Number 98144567, filed Dec. 23, 2009, which is herein incorporated by reference.
1. Technical Field
The present disclosure relates to a binary magnitude comparator and a binary magnitude comparator based content addressable memory cell.
2. Description of Related Art
A binary number comparator is applied to receive two n-bit binary number, i.e. the compariers A=(An-1An-2 . . . A1A0)2 and B=(Bn-1Bn-2 . . . B1B0)2, and to output at least one Boolean value to represent at least one of the following magnitude relations: G means A is greater than B, E means A is equal to B, L means A is less than B, LE or
The one bit comparator can be modified by the Karnaugh map or the Mac Klusky algorithm, and usually requires 20 transistors to achieve the logical circuit. As described in T. V. Le. “High-speed magnitude comparator circuit,” U.S. Pat. No. 5,281,946, Jan. 25, 1994, the n-bit binary number comparator that can deal more than one bit has to propagate the equality from the most significant bit to the least significant bit, and thus the computation time is increased.
Taiwan patent number 528982 provides a carry look-ahead adder to accelerate the n-bit binary number comparator. However, it requires large circuit area and rises bit carry issue and bit borrow issue.
Except by using the adders to achieve the n-bit binary number comparator, a serial type n-bit binary number comparator and a parallel type n-bit binary number comparator are disclosed. The serial type n-bit binary number comparator requires many pulse cycles to complete the comparison and thus the computation time is increased. The parallel type n-bit binary number comparators, such as the four strings parallels comparator described in U.S. Pat. No. 3,519,347 and the tree structure comparator described in U.S. Pat. No. 7,403,407, suffer the drawback of requiring large circuit area.
The content addressable memory (CAM) is broadly applied in the quick searching and matching systems such as the computer cache system and the net address look aside interface. The CAM is separated into two categories by the logic function, i.e. the binary CAM (SCAM) and the ternary CAM (TCAM). The CAM is separated into two categories by the structure of the memory cell, i.e. the static random access memory (SRAM) and the dynamic random access memory (DRAM). The SRAM is faster and stable but requires more transistors than the DRAM. No matter which kind of memory cell is selected to collocate the BCAM or the TCAM, the matching mechanism is limited by figuring out the equal or don't care relations of the bits one by one.
As described in U.S. Pat. No. 6,987,683, the stored values are sorted to improve the efficiency when searching an address. However, the circuit requires many transistors since the thresholds, the priorities or the weights have to be determined before searching.
As described in U.S. Pat. No. 7,403,407, the circuit is simplified but still requires 12 transistors to achieve the basic functions, let alone the extra circuit to propagate the equality. As described above, the comparators in prior system suffer many drawbacks such as large circuit area, many required transistors and cannot be embedded into the comparable content addressable memory (CCAM).
In one embodiment of the disclosure, a magnitude comparator for comparing magnitude of a first data and a second data is disclosed. The first data and the second data are both binary data. The magnitude comparator includes many non-least comparator cells and a P-channel transistor. Each of the non-least comparator cells includes a first transistor, a second transistor, a third transistor and a fourth transistor. The drain of the second transistor is electrically connected to the source of the first transistor, and the source of the second transistor is electrically connected to a ground terminal. The third transistor electrically connects the first transistor, and the fourth transistor electrically connects the first transistor and the third transistor. The source of the P-channel transistor electrically connects a supply terminal, the gate of the P-channel transistor electrically connects the ground terminal, and the drain of the P-channel transistor electrically connects the third transistor of the first comparator cell.
In another embodiment of the disclosure, a magnitude comparator based content addressable memory cell is disclosed. The magnitude comparator based content addressable memory cell includes a bit line, a memory compare cell, a word line and a P-channel transistor. The memory compare cell further includes many non-least comparator cells and a memory cell. The non-least comparator cell further includes a first transistor, a second transistor, a third transistor and a fourth transistor.
The bit line is applied to provide a complement of non-least bit of a first data. The memory cell electrically connects the bit line to store the complement of the non-least bit of the first data, and to provide a non-least bit of a second data. The word line electrically connects the memory cell to enable the memory cell to store the complement of the non-least bit of the first data. The P-channel transistor connects a supply terminal via the source, connects the ground terminal via the gate, and connects the third transistor of the first comparator cell via the drain.
In the other embodiment of the disclosure, a non-equal bin width histogrammer is disclosed. The non-equal bin width histogrammer includes a thermal meter decoder and a magnitude comparator based content addressable memory. The thermal meter decoder is applied to translate a thermal-meter code into a one-hot code. The magnitude comparator based content addressable memory is applied to provide the thermal-meter code. The magnitude comparator based content addressable memory includes a bit line, a memory compare cell, a word line and a P-channel transistor. The features of the magnitude comparator based content addressable memory have been described above.
The disclosure can be more fully understood by reading the following detailed description of the embodiments, with reference made to the accompanying drawings as follows:
The following comparators in the embodiments are assumed to receive two n-bit binary data An-1:0=(An-1An-2 . . . A1A0)2 and Bn-1:0=(Bn-1Bn-2 . . . B1B0)2 for explanation. The logical relations, such as Gi=(Ai>Bi), Ei=(A1=Bi) and Li=(Ai<Bi), and the logical results, such as Gn-1:0=(An-1:0>Bn-1:0), En-1:0=(An-1:0=Bn-1:0), Ln-1:0=(An-1:0<Bn-1:0) or their reversal phases, are therefore outputted.
The logical relations Gi, Ei, Li and their reversal phases can be illustrated by the following recursive equations
Similarly:
The six relations can by illustrated by recursive equations. For instance, the less than relation can be illustrated as following:
Ln-1:0=Ln-1+En-1(Ln-2+En-2(Ln-3+En-3( . . . ))) (3)
Furthermore, L and also be illustrated by A and B, i.e.:
Ln-1:0=
According to the adsorption law of the Boolean equation, the following equation can be applied for a random value X:
and thus the equation (4) can be rewritten as following:
Ln-1:0=
Similarly:
Gn-1:0=An-1
The logic programming of the above equations (6)-(9) can be achieved by the non-least comparator cells of one embodiment of the disclosure, and the non-least comparator cells requires only four pass transistors.
The non-least comparator cells 220 can be applied to deal the most significant bit (MSB) and the non-least bits of a data. Each of the non-least comparator cells 220 includes a first transistor 221, a second transistor 222, a third transistor 224 and a fourth transistor 223 which are both N-channel transistors. The first transistor 221 receives a 1's complement
The third transistor 224 receives the non-least bit B, of the second data Bn-1:0 via its gate, and electrically connects the drain of the first transistor 221 via its own drain. The fourth transistor 223 is parallel connected to the third transistor 224. The fourth transistor 223 receives the complement
In the non-least comparator cells 220, the first transistor 221 and the second transistor 222 are applied to achieve the logic equation Ai+
The least bit comparator cell 210 electrically connects the non-least comparator cells 220, and the least bit comparator cell 210 includes a fifth transistor 211 and a sixth transistor 212. The fifth transistor 211 receives a complement least bit
The complement
Gn-1:0=An-1
The comparator 300 includes many non-least comparator cells 320 connected in series, a least comparator cell 310 and a P-channel transistor 340. The P-channel transistor 340 electrically connects a supply terminal via the source, electrically connects the ground terminal via the gate, and electrically connects the drains of the third transistor 324 and the fourth transistor 323 of the n−1 stage, i.e. the most stage, of the non-least comparator cells 320 via its drain.
The non-least comparator cells 320 can be applied to compare the MSB or the non-least bits of a data. Each of the non-least comparator cells 320 includes a first transistor 321, a second transistor 322, a third transistor 324 and a fourth transistor 323 which are both N-channel transistors.
The first transistor 321 of the first stage of the non-least comparator cells 320 receives the non-least bit Bi of the second data Bn-1:0 via the gate, and outputs the non-least bit Gi of the logic equation via the drain. The second transistor 322 receives a complement
The fifth transistor 313 receives the complement least bit
Refer to
Refer to
The magnitude comparator based content addressable memory cell 400 includes a bit line (BLi), a memory compare cell 410, a word line (WLi) and many non-least comparator cells 220. The BLj provides a complement
The memory compare cell 410 electrically connects the bit line (BLj) to store the complement
The magnitude comparator based content addressable memory cell 500 is similar to that 400 described above. The magnitude comparator based content addressable memory cell 500 uses the non-least comparator cells 320 to execute the operation Gj, i.e. Aj>Bj.
When applying the content addressable storage array 600, many threshold values or label values are sorted and inputted into the magnitude memory cells 621 of the content addressable storage array 600. If there exists no repeat threshold values, the thermal code, such as 11 . . . 100 . . 0, will be shown in the complements of the logic equations, i.e.
The storage cell 631 can be achieved by the dynamic random access memory (DRAM), i.e. the non-inverter 641 and the inverter 643. The storage cell 631 also can be achieved by the static random access memory (SRAM). In
The memory cell switch transistor 615 is opened when the word line WLi carries a high voltage, and the complement
According to embodiments described above, the comparator can be applied in a variety of logic circuits broadly to decrease the required transistors, circuit area and to increase the programming speed when sorting, comparing or dispatching data. The comparator can also be embedded in many circuits to compare the variate threshold values or the non-equal margins, and thus can be applied in the neural network circuit.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present disclosure without departing from the scope or spirit of the disclosure. In view of the foregoing, it is intended that the present disclosure cover modifications and variations of this disclosure provided they fall within the scope of the following claims.
Number | Date | Country | Kind |
---|---|---|---|
98144567 A | Dec 2009 | TW | national |
Number | Name | Date | Kind |
---|---|---|---|
4749887 | Sanwo et al. | Jun 1988 | A |
5294911 | Uchida et al. | Mar 1994 | A |
6014074 | Park | Jan 2000 | A |
6292093 | Su et al. | Sep 2001 | B1 |
Number | Date | Country | |
---|---|---|---|
20110148605 A1 | Jun 2011 | US |