BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to fast numerical sorting and more particularly a double-buffered, two-pass sorter wherein the two-sort passes are performed simultaneously.
2. Description of the Prior Art
Heretofore, numerical sorting was done primarily by relatively slow software programs. The limited sorting hardware that was available is based on a cumbersome comparison technique which sometimes required more comparator elements than words in the input list. In some instances the circuitry required increased geometrically as the number N of elements in the input list expanded. Further, these prior art hardware and software sorters are not fast enough for CRT display applications. U.S. Pat. No. 4,030,077 issued June 14, 1977 teaches multipass hardware sorting with minimum circuit requirements. FIGS. 1-6 of this specification, and the detailed description associated therewith, are from the above U.S. patent.
SUMMARY OF THE INVENTION
It is therefore an object of this invention to provide a hardware numerical sorter for sorting a series of sequential input lists, which:
IS FASTER;
SIMULTANEOUSLY PROCESSES A PLURALITY OF THE SEQUENTIAL INPUT LISTS;
MINIMIZES IDLE TIME BETWEEN SORTING SEQUENTIAL LISTS;
RECEIVES UNSORTED INPUT ITEMS AND PROVIDES SORTED OUTPUT ITEMS SUBSTANTIALLY CONTINUOUSLY;
HAS A HIGH THROUGHPUT RATE; AND
SORTS DEPENDENT LISTS.
BRIEF DESCRIPTION OF THE DRAWING
Further objects and advantages of the multipass sorter and the operation of the numerical sort stack will become apparent from the following detailed description taken in conjunction with the drawings in which:
FIG. 1 is a block diagram of a two-pass overlap sorter with double buffer storage between stages; and
FIG. 2 illustrages a CRT display generated by the dependent list capability of the FIG. 1 overlap sorter.
DESCRIPTION OF THE PREFERRED EMBODIMENTS
FIGS. 1 through 6 and the detailed description thereof (column 2, line 24 to column 8, line 68) of U.S. Pat. No. 4,030,077 by J. Florence and M. Rohner are incorporated hereinto by reference.
Simultaneous Sorting with Double Buffering
FIG. 1 shows a high-speed embodiment of a two-pass sorter 700 with a read-write overlap operation for allowing two input lists to be processed simultaneously. The odd runs are written from first stack 110 into run buffer 130 ODD while the even runs are sorted into second stack 140 from run buffer 130 EVEN. First stack 110 continuously sorts to run buffers 130 ODD and EVEN alternately. In the FIG. 1 embodiment of U.S. Pat. No. 4,030,077, first stack 110 was idle between input lists as the single run buffer 130 was in one of two modes: either receiving runs from stack one or outputting runs into second stack 140. Control signals SEL-ODD and SEL-ODD bar control the read-write status of run buffers 130 ODD and EVEN and NK buffers 120 ODD and EVEN. Run buffer multiplexer 710 is responsive to SEL-ODD to select the proper run buffer output for sorting into second stack 140. NK buffer multiplexer 720 similarly provides the proper NK buffer output to NK output register 170 NK. Dependent list generator 730 is responsive to NK data for returning specific items to input register 106 through return line 740 and input list multiplexer 750.
Dependent List
A sequence of lists are dependent if some or all items of one list are related to, or are the same as, the items of a subsequent list. The KEY of the item in list n may be a function of the KEY in list n-1 and the NK portion of the item. This can be expressed by a general equation:
EXAMPLE OF DEPENDENT LIST SORTING
FIG. 2 shows a digitally generated raster scan image 800 of polygons 810, 820, 830 and a line 840. The polygons are the visible faces of a cube displayed on a raster scan device such as a CRT. Each face may be scanned at a particular intensity or color to reflect shading, etc. The scan lines of the raster, shown by dashed lines, are labeled A, B, C, D, E . . . . The edges of the polygons and line 840 intersect the scan lines at points shown by dots (data points) shown in FIG. 2. The sorter 700 may be employed in the digital image generation circuitry to arrange these intersections or data points in increasing order of the x position coordinate. In this application of sorter 700, there is an input list for every scan line, the items of the list are the data points, the KEY is the X coordinate of the data point, and the NK portion is the remainder of display data such as: the slope or shift in x coordinate between adjacent scan lines, the scan line on which the edge starts, the number of scan lines the edge spans, the color and intensity of the polygon and other paramenters.
The sorter 700 arranges the data points in each scan line in order of their KEY'S or X values. The data points appear in sorted order in output registar 170. Dependent list generator 730 updates the KEY of each item for the next list by adding an X slope increment to the X coordinate. The updated KEYs are returned to input register 106 through input multiplexer 750. The dependent list generator also decrements the number of scan lines each edge spans by one.
Sorter 700 may be employed in the digital image generation circuitry which processes display data including new line and edge starts and intersections from a data base to a CRT display device. Sorter 700 receives an unsorted input list of edge start points (initial data points typically vertices) for each CRT scan, and arranges the start points numerically by X coordinate (horizontal position) in order of appearance within each scan. In the FIG. 2, application of sorter 700, the KEY is the X position data and the NK is the remainder of the display data. The inner points (dependent data points between the vertices of each edge) which form the body of each edge are generated by updating the associated initial data or start point for that edge. The start point updating involves two types of NK data in two separate operations as follows:
(1) Update Increment -- Delta X
The update increment is the slope or change in X position of an edge between adjacent scans. The NK delta X of each data point is added to the KEY of that data point (X position) and returned to input register 106 through input multiplexer 750, to form the X coordinate for a dependent data point, in the next list. The dependent data point is displayed in the next scan line as a point displaced by delta X from the data point in the previous scan line of that edge.
(2) Update Cycle Number -- L
The length of each line determines how many times the initial data point must be updated to display the entire edge. The update cycle number is decremented by one each cycle as it passes through dependent list generator 730. When the update cycle number equals zero, a RETURN STOP signal is forwarded to input list multiplexer 750 causing it to deselect that data point from the next list and select a new initial data point from the input if there is one.
Dependent list generator 730 may be formed by:
(1) A set of four bit adders (74283) for adding the update increment (delta X) to the KEY (X);
(2) Another set of four bit adders (74283) for decrementing the update cycle number L by adding -1 thereto; and
(3) A zero detect circuit for providing a RETURN STOP signal to input list multiplexer 750.