Sorting apparatus4604726Abstract An improved apparatus for forming an ordered sequence of n digital numbers from a randomly arranged set of n digital numbers is shown to be made up of: (a) n registers, each initially holding a different one of the randomly arranged set of n digital numbers; (b) a digital comparator for each adjacent pair of registers to determine whether or not the digital numbers in each adjacent pair of registers are in the ordered sequence and to interchange the digital numbers in any adjacent pair of registers whenever such numbers are not in the ordered sequence; and (c) a switching arrangement, operative in response to each successive one of (2n-1) clock pulses, alternately to switch each digital comparator from the associated adjacent pair of registers to a different selected pair of registers whereby the digital numbers may be shifted through the n registers as required to form the ordered sequence. Claims What is claimed is: Description BACKGROUND OF THE INVENTION
TABLE 1
__________________________________________________________________________
REGISTER
INITIAL
PULSE
PULSE
PULSE
PULSE
PULSE
PULSE
NUMBER SET 1 2 3 4 5 6
__________________________________________________________________________
0 1 2 2 4 4 6 6
1 2 1 4 2 6 4 5
2 3 4 1 6 2 5 4
3 4 3 6 1 5 2 3
4 5 6 3 5 1 3 2
5 6 5 5 3 3 1 1
__________________________________________________________________________
The example presented in TABLE 1 represents the worst case of a block of digital numbers (1, 2, 3, 4, 5, 6) to be arranged in reverse order (6, 5, 4, 3, 2, 1) from that in which such numbers are initially stored in a set of registers numbered from 0 to 5. The brackets in the TABLE designate register pairs to be processed on the next clock pulse. Recalling that a register pair is "even" or "odd" in accordance with the lower register number in any pair and that the first clock pulse is applied to "even" register pairs, the brackets in the INITIAL SET column indicate that register pairs 0, 2 and 4 are to be processed on the first clock pulse. As the numbers in registers 0, 2 and 4 are less than the corresponding numbers in registers 1, 3 and 5, the numbers in each of the register pairs 0, 2 and 4 are interchanged, resulting in the sequence shown in the PULSE 1 column. On the second clock pulse the odd register pairs 1 and 2 and 3 and 4 are processed as indicated by the brackets in the PULSE 1 column. Again, as the numbers in registers 1 and 3 are less than the corresponding numbers in registers 2 and 4, the numbers in the register pairs are interchanged, resulting in the sequence shown in the PULSE 2 column. This process repeats until after the 6th clock pulse the data are rearranged in a descending ordered sequence as shown in the PULSE 6 column. In many signal processing applications it is desirable to operate the digital sorter 20 in a pipelined fashion wherein blocks of digital numbers arrive at the input of the sorter a number at a time with no gaps between consecutive blocks. Obviously, some modifications must be made to the digital sorter 20 to support pipelined operation. These modifications will be described in a general manner before embarking on a detailed description of a pipelined sorter. Thus, for pipelined sorting of n number blocks, the sorter must contain 2 n-1 registers. Each of such registers will be m+1 bit devices with the first m bits holding the digital number to be sorted. The (m+1).sup.th bit, referred to as the "tag bit", is used as a block delimiter. The tag bit of the first number to be sorted is set to a logic level 1 by logic external to the sorter. The tag bits of the remaining numbers in the block are set to a logic level 0. Assume now for the moment that i numbers have been shifted into the sorter and stored in registers zero through i-1. The first clock pulse then applied to the sorter processes the data in the even register pairs as was explained hereinabove with reference to TABLE 1. The second clock pulse applied to the sorter will shift the numbers in the original number block by one position so that that block now occupies registers 1 through i and, at the same time, the second clock pulse will enter the i+1.sup.th number into register 0. It should be noted that the shifting of the original number block by one register aligns the numbers in such a manner that the even register pairs then hold numbers that were originally held in the odd register pairs. In consequence, then, the even numbered comparator gates can be used again and the odd numbered comparator gates may be discarded. Further, in the interest of speed and efficiency, the operations just described as occurring in two consecutive clock pulses can, in fact, be executed with a single clock pulse. Thus, with each clock pulse the numbers in even register pairs are compared and the numbers are shifted one position (register) in either the original or reversed order, depending upon whether or not the number in the lower numbered register is less than the number in the higher numbered register. For pipelined operation one additional factor must be considered. That is to say, sorting operations between register pairs must not occur between numbers in separate but contiguous blocks. To this end, when the tag bit of an even register is set (at a logic level 1) the word in the upper register of the pair is the first word of the subsequent block. Hence, in this case, both numbers are simply shifted one position with no consideration of the relative magnitude of the two numbers. Finally, it should be noted that the tag bits are always shifted one position with each clock pulse regardless of the attitude of the register in which it resides. If the smaller, or even numbered, register of a register pair is designated as R.sub.n and the odd numbered register of the pair is designated as R.sub.n +1, then the just described operation of a pipelined sorter may be summarized by the following two rules: (A) If the tag bit of R.sub.n is set or if the contents of R.sub.n are greater than or equal to the contents of R.sub.n+1, a clock pulse will shift the contents of both registers by one position; (B) If, however, the tag bit of R.sub.n is a zero and the contents of register R.sub.n are less than the contents of register R.sub.n+1, a clock pulse will transfer the contents of register R.sub.n to register R.sub.n+2 and the contents of register R.sub.n+1 are left unchanged; (C) Tag bits are always shifted one position regardless of the magnitude of the register in which it resides.
TABLE 2
__________________________________________________________________________
PIPELINED SORTER
REGISTER
INITIAL
1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
NUMBER SET PULSE NUMBER
__________________________________________________________________________
0 X *6
5 4 3 2 1 *9
4 8 4 7 2 *6
5 7 3
1 X X *6
6 6 6 6 6 *9
9 8 8 8 8 *6
6 7
2 X X X *5
4 3 2 1 6 *4
9 4 7 2 8 *5
6
3 X X X X *5
5 5 5 5 6 *4
9 9 9 9 9 *5
4 X X X X X *4
3 2 1 5 6 *4
4 7 2 8 9
5 X X X X X X *4
4 4 4 5 6 *4
4 7 7 8
6 X X X X X X X *3
2 1 4 5 6 *4
4 2 7
7 X X X X X X X X *3
3 3 4 5 6 *4
4 4
8 X X X X X X X X X *2
1 3 4 5 6 *4
2
9 X X X X X X X X X X *2
2 3 4 5 6 *4
10 X X X X X X X X X X X *1
2 3 4 5 6
__________________________________________________________________________
TABLE 2 is presented as an example of the operation of a pipelined sorter. Within the TABLE even numbered register pairs are contained within the continuous horizontal lines. The asterisk indicates that the corresponding register tag bit is set. The initial contents of the sorter (not shown) are indicated by X's as "don't cares". Illustrated in TABLE 2 is a full sort for one six number block and partial sorts for two succeeding blocks. The first block contains the same numbers as in TABLE 1 and numbers in the first block arrive at the registers in the same sequence as presented in TABLE 1. The first six clock pulses load the first block into the sorter (not shown) and perform a partial sort as shown in TABLE 2. Clock pulses 7 through 11 complete the sort of block 1 and also load the first five numbers of block 2. The first clock pulse loads the number 6 into register 0 and, as mentioned hereinabove, the asterisk indicates that the corresponding tag bit is set to a logic level 1. According to rule A, then, the second clock pulse will shift the contents of register 0 into register 1 and load the number 5 into register 0. On the third clock pulse the contents of registers 0 and 1 are examined and, in accordance with rule B, as the tag bit in register 0 is not set and the contents of register 0 are less than the contents of register 1, the contents of register 0 are shifted to register 2 and the contents of register 1 are left unchanged. The third clock pulse is also effective to shift the number 4 into register 0. On the fourth clock pulse the contents of registers 0 and 1 as well as registers 2 and 3 are examined. The contents of register 0 are shifted to register 2 and the contents of register 1 remain unchanged in accordance with rule B, while the contents of register 2 are shifted into register 3 according to rule A. The fourth clock pulse also shifts the number 3 into register 0. The loading and sorting process continues as described for each subsequent clock pulse. The original block, after being sorted, is read out of the sorter (not shown) beginning with the eleventh clock pulse, thereby indicating that the delay through the pipelined sorter is 2 n-1 clock pulse intervals. Referring now to FIG. 3, a pipelined sorter 30 according to this invention is shown to include six registers labeled A.sub.n through F.sub.n. Before proceeding with a detailed description of the pipelined sorter it should be noted that, for the sake of drawing ease and clarity, the processing for only the n.sup.th bit of each of the registers is shown, and the requisite clock signals are not shown. Further, the requisite logic for controlling the data transfer in accordance with the status of the tag bit is not shown. It should, however, be appreciated that the requisite logic to support the tag bit function could be provided by conventional shift register logic as is well known and widely practiced in the art. Thus, to handle the situation where the tag bit is set, such conventional shift register logic would be controlled by the clock signals directly without consideration of the A.gtoreq.B signal or the A<B signal. Within the pipelined sorter 30 registers A, C and E are even-numbered registers. At the outset it should be noted that the comparator circuits (not numbered) required to develop the COMPARE CONTINUE signal accept inputs only from the even-numbered register pairs, as A and B, C and D, E and F. This is in accordance with the manner in which the data is clocked through the pipelined sorter 30 as was explained hereinabove. The NAND gates 51.sub.A, 51.sub.C, 51.sub.E, which also form part of the comparator circuits, are required between the register pairs. The NAND gates 51.sub.A, 51.sub.C and 51.sub.E are effective, in conjunction with inverters 53, 55, contained in each box marked 54 to develop the control signals as indicated in a manner described in detail hereinabove with reference to FIG. 2. The noninverted n.sup.th bit, A.sub.n, from the A register is provided as an input to transfer gates 22B and 22C along with the A.gtoreq.B and A<B control signals and the noninverted n.sup.th bit, B.sub.n, from the B register. Thus, if the contents of the A register are greater than or equal to the contents of the B register, transfer gate 22B is effective to transfer the n.sub.th bit from the A register to the B register and gate 22C is effective to transfer the n.sup.th bit from the B register to the C register. If, on the other hand, the contents of the A register are less than the contents of the B register, transfer gate 22B is effective to reinsert the n.sup.th bit from the B register into the nth bit of the B register and transfer gate 22C is effective to transfer the n.sup.th bit from the A register to the nth bit of the C register. The data transfer between the remaining registers is identical to that just described for the A, B and C registers. Having described a preferred embodiment of this invention, it will be apparent to one of skill in the art that many changes may be made in the illustrated embodiment without departing from its inventive concepts. Thus, for example, a plurality of pipelined sorters could be serially connected together to handle longer blocks of data than could be handled by a single device. Further, an analog version of the pipelined sorter could be formed by replacing the digital registers with charge coupled device (CCD) shift registers, replacing the digital comparators with differential amplifiers (analog comparators) and replacing the transfer gates with their analog equivalents. It is felt, therefore, that this invention should not be restricted to its disclosed embodiment, but rather should be limited only by the spirit and scope of the appended claims.
|
Same subclass Same class Consider this
|
||||||||||||||
