JPH06214752A - Sorting processor - Google Patents

Sorting processor

Info

Publication number
JPH06214752A
JPH06214752A JP688993A JP688993A JPH06214752A JP H06214752 A JPH06214752 A JP H06214752A JP 688993 A JP688993 A JP 688993A JP 688993 A JP688993 A JP 688993A JP H06214752 A JPH06214752 A JP H06214752A
Authority
JP
Japan
Prior art keywords
data
output
stored
key
register
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP688993A
Other languages
Japanese (ja)
Other versions
JPH0774988B2 (en
Inventor
Seiji Baba
清司 馬場
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP688993A priority Critical patent/JPH0774988B2/en
Publication of JPH06214752A publication Critical patent/JPH06214752A/en
Publication of JPH0774988B2 publication Critical patent/JPH0774988B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

PURPOSE:To provide a sorting processor adding codes indicating that data are equal when equal data exist in a sorting processing and adding the number of the bytes of an equal part to data when data are not equal so as to output them. CONSTITUTION:A comparator 4 comparing the contents of first and second registers 9 and 10 with each other, judging the register of a larger value or that of a smaller value and outputting the result, a result register 7 storing the judged result of the comparator 4 and designating either of the registers whose compared result value is larger or smaller, a duplex flag generation part 11 monitoring the contents of the result register 7, and detecting a state that the compared results of the comparator 4 are equal to each other when the results are equal so as to generate a flag, and a counter for the number of equal bytes 12 counting the number of times of comparison in the comparator 4 while the compared results are equal to each other are provided. A comparator control part 8 refers to the duplex key flag generation part 11 and the counter for the number of equal bytes 12 after the comparison of previously given lengths is terminated and outputs the flag and the number of the equal bytes to a prescribed position of data in a local memory 3.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明はソート処理装置に関し、
特に入力された二つのデータについて数値または文字の
大小関係を調べその大きい順または小さい順に入力され
たデータを並び替えるソート処理装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a sort processing device,
In particular, the present invention relates to a sort processing device for checking the magnitude relationship of numerical values or characters in two input data and rearranging the input data in the ascending or descending order.

【0002】[0002]

【従来の技術】図4は従来のこの種のソート処理装置の
一例を示すブロック図である。
2. Description of the Related Art FIG. 4 is a block diagram showing an example of a conventional sort processing apparatus of this type.

【0003】従来この種のハードウェアを主体としたソ
ート処理装置は、図4に示したように、入力データを一
時記憶する入力バッファ1と、入力バッファ1の出力側
に接続され入力バッファ1の出力を第1の比較データと
して記憶する第1のレジスタ9と、入力バッファ1の出
力を入力とするローカルメモリ3と、ローカルメモリ3
から出力される第2の比較データを入力とする第2のレ
ジスタ10と、後述する比較器制御部8Aにて発生され
た比較指示信号に従って第1のレジスタ9と第2のレジ
スタ10との内容についてその大小関係を比較する比較
器4と、比較器4で比較された結果を記憶する結果レジ
スタ7と、ローカルメモリ3から出力される出力データ
を記憶し、出力指示信号によって外部へ出力する出力バ
ッファ2と、外部から与えられた、比較データ中の比較
すべき桁の長さ(即ち、キー長)を記憶し、前記比較指
示信号の回数をカウントし、記憶している桁の長さに達
するとカウント終了指示信号を比較器制御部8Aに出力
するキー長カウンタ5と、比較すべき入力データのレコ
ード長を記憶しており比較器制御部8Aに接続されてい
るレコード長記憶部6と、入力バッファ1と出力バッフ
ァ2とローカルメモリ3と比較器4とキー長カウンタ5
とレコード長記憶部6とを制御する比較器制御部8Aと
を備えている。
As shown in FIG. 4, a sort processing device mainly composed of hardware of the related art has an input buffer 1 for temporarily storing input data and an input buffer 1 connected to an output side of the input buffer 1. A first register 9 that stores the output as first comparison data, a local memory 3 that receives the output of the input buffer 1, and a local memory 3
Contents of the second register 10 that receives the second comparison data output from the first register 9 and the contents of the first register 9 and the second register 10 according to a comparison instruction signal generated by a comparator control unit 8A described later. The output that stores the output data output from the local memory 3 and the result register 7 that stores the result compared by the comparator 4, and the output that is output to the outside by the output instruction signal The buffer 2 and the length of the digit to be compared in the comparison data (that is, the key length) stored from the outside are stored, the number of times of the comparison instruction signal is counted, and the stored digit length is set to the stored digit length. A key length counter 5 that outputs a count end instruction signal to the comparator control unit 8A when it reaches, and a record length storage that stores the record length of the input data to be compared and is connected to the comparator control unit 8A. Compared to 6, the input buffer 1 and the output buffer 2 and the local memory 3 device 4 and the key length counter 5
And a comparator control unit 8A for controlling the record length storage unit 6.

【0004】ローカルメモリ3は、第1及び第2の記憶
領域を持っており、最初に入力されたデータは、例え
ば、第1の記憶領域に記憶され、次にデータが入力バッ
ファ1から出力されると、すでに入力されたデータが第
1の記憶領域に存在していれば第1の記憶領域のデータ
を第2の記憶領域に移し、第1の記憶領域に新たに入力
されたデータを記憶させる。
The local memory 3 has first and second storage areas, and the first input data is stored in, for example, the first storage area, and then the data is output from the input buffer 1. Then, if the input data is already present in the first storage area, the data in the first storage area is moved to the second storage area, and the newly input data is stored in the first storage area. Let

【0005】図3は図4で示されている従来のこの種の
ソート処理装置、および後述する本発明のソート処理装
置が対象とするデータとこのデータに対するソート領域
の関係の一例を示す説明図である。
FIG. 3 is an explanatory diagram showing an example of the relationship between the data to be processed by the conventional sort processing apparatus of this type shown in FIG. 4 and the sort processing apparatus of the present invention described later and the sort area for this data. Is.

【0006】図3及び図4を参照して、対象となるデー
タは所定のレコード長を持つデータであって、図3にお
いては、データ長は20桁のレコード長を持っており、
レコード長記憶部6には予め外部からレコード長として
20が入力され記憶されている。
Referring to FIGS. 3 and 4, target data is data having a predetermined record length. In FIG. 3, the data length has a record length of 20 digits.
In the record length storage unit 6, 20 is previously input and stored as a record length from the outside.

【0007】図3においては、実際にソート対象となる
データの部分はキー領域21であり、入力されるデータ
の最上位から連続する3桁である。この桁数3がキー長
カウンタ5に予め外部から入力され記憶されている。
In FIG. 3, the portion of the data to be actually sorted is the key area 21, which has three consecutive digits from the top of the input data. The digit number 3 is input to the key length counter 5 from the outside and stored in advance.

【0008】比較器4は、1回の比較指示信号で第1及
び第2のレジスタ9及び10に記憶されているデータの
内でデータの上位の3桁(キー領域21)の最上位桁か
ら、第1及び第2のレジスタの記憶内容を比較し大小関
係を調べ、予め指定されている方たとえば、大なる方の
データを記憶しているレジスタを指定するための信号を
結果レジスタ7に出力する。以下の説明では、比較した
結果値の大きな方のデータを記憶しているレジスタを指
定する信号を比較器4が出力すると仮定する。
The comparator 4 starts from the most significant digit of the upper three digits (key area 21) of the data stored in the first and second registers 9 and 10 by one comparison instruction signal. , The stored contents of the first and second registers are compared to check the magnitude relationship, and a signal for designating a predesignated one, for example, a register storing the larger data is output to the result register 7. To do. In the following description, it is assumed that the comparator 4 outputs a signal designating the register storing the data having the larger comparison result value.

【0009】もし、比較器4による上述の比較の結果、
両者が等しいときは、第1および第2のレジスタ9およ
び10の何れを指定する信号も出力しない。
If the result of the above comparison by the comparator 4 is:
When both are equal, no signal designating either the first or second register 9 or 10 is output.

【0010】開始指示信号が外部から比較器制御部8A
に加えられると、比較器制御部8Aは出力指示信号を出
力バッファ2に出力して、すでに出力バッファ2が記憶
している内容を出力データとして外部に出力する。
The start instruction signal is externally supplied from the comparator control unit 8A.
In addition, the comparator control unit 8A outputs an output instruction signal to the output buffer 2 and outputs the contents already stored in the output buffer 2 as output data to the outside.

【0011】続いて、比較器制御部8Aは結果レジスタ
7の内容を参照して指定された第1または第2のレジス
タに該当するローカルメモリ3内の第1または第2の記
憶領域のデータを出力データとして出力バッファ2及び
第2のレジスタ10に出力して記憶させ、次いでローカ
ルメモリ3内に残存するデータをローカルメモリ3の第
2の記憶領域に移す。この場合、残存するデータがロー
カルメモリ3の第2の記憶領域にある場合にはそのまま
としておく。
Subsequently, the comparator control unit 8A refers to the contents of the result register 7 to retrieve the data in the first or second storage area in the local memory 3 corresponding to the designated first or second register. The output data is output to the output buffer 2 and the second register 10 and stored therein, and then the data remaining in the local memory 3 is transferred to the second storage area of the local memory 3. In this case, if the remaining data is in the second storage area of the local memory 3, it is left as it is.

【0012】もし、結果レジスタ7により第1のレジス
タ9と第2のレジスタ10の何れをも指定されていない
ときには、第2のレジスタ10の内容を記憶しているロ
ーカルメモリ3の該当するデータ、すなわちローカルメ
モリ3の第2の記憶領域に記憶されているデータを比較
器制御部8Aが出力バッファ2に出力させる。
If neither the first register 9 nor the second register 10 is designated by the result register 7, the corresponding data in the local memory 3 storing the contents of the second register 10, That is, the comparator controller 8A causes the output buffer 2 to output the data stored in the second storage area of the local memory 3.

【0013】次いで比較器制御部8Aは、第2の記憶領
域に記憶されたデータを第2の比較データとして第2の
レジスタ10に出力させ記憶させると共にそれまで入力
バッファ1に記憶していたデータをローカルメモリ3の
第1の記憶領域に記憶させるとともに第1の比較データ
として第1のレジスタ9にも記憶させる。
Next, the comparator control unit 8A outputs the data stored in the second storage area to the second register 10 as the second comparison data, stores the data, and stores the data stored in the input buffer 1 until then. Is stored in the first storage area of the local memory 3 and is also stored in the first register 9 as the first comparison data.

【0014】次いで比較器制御部8Aは外部から加えら
れる新たな入力データを入力して入力バッファ1に記憶
させる。
Next, the comparator controller 8A inputs new input data added from the outside and stores it in the input buffer 1.

【0015】続いて、比較器制御部8Aは比較指示信号
を比較器4に出力し、その比較指示信号の回数をキー長
カウンタ5でカウントさせ、比較器4により第1及び第
2のレジスタ9及び10の内容について比較を行わせ
る。キー長カウンタ5が記憶している桁数分の比較がす
でに終了している場合は比較器制御部8Aは比較指示信
号は出力しない。
Subsequently, the comparator control unit 8A outputs a comparison instruction signal to the comparator 4, causes the key length counter 5 to count the number of comparison instruction signals, and the comparator 4 causes the first and second registers 9 to 9a. And the contents of 10 are compared. When the comparison for the number of digits stored in the key length counter 5 has already been completed, the comparator control unit 8A does not output the comparison instruction signal.

【0016】すなわち、キー長カウンタ5に記憶されて
いるキー長が3であれば、図3に示すように、上述のレ
ジスタ9と10にそれぞれ格納されている第1の比較デ
ータと第2の比較データのキー領域21の最上位の桁か
ら始まり最上位から3番目の桁までについての値の比較
が比較器4により行われる。
That is, if the key length stored in the key length counter 5 is 3, as shown in FIG. 3, the first comparison data and the second comparison data stored in the above-mentioned registers 9 and 10, respectively. The comparator 4 compares the values from the most significant digit of the key area 21 of the comparison data to the third most significant digit.

【0017】上述した動作が、外部から入力され予めレ
コード長記憶部6が記憶しているレコード長分だけ、出
力・入力・比較の順番に繰り返され、その結果第1の比
較データの方が第2の比較データの値より大であれば、
第1のレジスタを指定する値が結果レジスタに記憶され
る。もしも、比較器4で比較された第1の比較データと
第2の比較データのキー領域21の値が等しいときに
は、結果レジスタ7には何れのレジスタを指定する値も
記憶されない。
The above-described operation is repeated in the order of output / input / comparison by the record length which is input from the outside and stored in the record length storage unit 6 in advance, and as a result, the first comparison data is the first. If it is larger than the value of the comparison data of 2,
The value designating the first register is stored in the result register. If the values in the key area 21 of the first comparison data and the second comparison data compared by the comparator 4 are equal, the value designating any register is not stored in the result register 7.

【0018】比較器制御部8Aの動作は外部から終了指
示信号が加えられたときに終了する。
The operation of the comparator controller 8A ends when an end instruction signal is externally applied.

【0019】このようなソート処理装置を直列にN台接
続すれば、2N −1個のデータが大きなものから小さな
順に、あるいは小さいものから大きなものの順にデータ
の順序を並び替えることができる。
If N sort processing devices of this kind are connected in series, the order of data can be rearranged in the order of 2 N -1 pieces of data from the largest to the smallest or from the smallest to the largest.

【0020】なお、対象とするキー領域の内容が数字で
はなく文字であっても、予めそれぞれの文字の配列順に
文字に対して数字を割り当てておき、比較器4で比較す
るときには文字に対する数字により比較すれば、アルフ
ァベット順あるいはイロハ順などにソート処理によりデ
ータを並び替えることが出来る。
Even if the content of the target key area is not a number but a character, a number is assigned to the character in advance in the order of arrangement of the respective characters, and when the comparator 4 compares the numbers, the number is assigned to the character. By comparison, the data can be rearranged by sorting in alphabetical order or Iloha order.

【0021】[0021]

【発明が解決しようとする課題】上述した従来のソート
処理装置は、もし処理の対象となるデータのキー領域2
1の値が等しいものであっても、これらの互いに等しい
複数のデータは入力された順に出力されるだけであり、
等しいことを示す符号がこれらのデータには付与されて
いないので、このようなキー領域21の値が同一である
2個以上のデータをそれぞれ区分するためには、このよ
うにしてソート処理装置により処理を行ったデータ群の
中のすべてのデータについて、前述のレコード全体の内
容を調べるためのプログラムにより処理をさせることが
必要となるが、このようなプログラムの処理の対象とし
ては最初にソート処理装置によりソート処理を行ったデ
ータすべてを対象とするために多くの時間を要するとい
う欠点を有している。
In the above-described conventional sort processing apparatus, if the key area 2 of the data to be processed is
Even if the values of 1 are the same, these plural data which are equal to each other are only output in the order in which they are input,
Since a code indicating equality is not given to these data, in order to distinguish two or more data having the same value of the key area 21 from each other, the sort processing device is used in this way. All the data in the processed data group needs to be processed by the program for checking the contents of the above-mentioned entire record, but the sort process is the first to be processed by such a program. It has a drawback that it takes a lot of time to target all the data sorted by the apparatus.

【0022】また、キー領域の一部の部分が一致してい
るようなレコードをグルーピングしたりグルーピングさ
れたデータ群のキー領域の特定キーについて集計処理を
行ったりする場合にも上述の従来のソート処理装置によ
り処理を行ったデータ群のすべてについてプログラムに
よるグルーピング処理、集計処理を行う必要があるが処
理対象が最初にソート処理装置によりソート処理を行っ
たデータすべてを対象とするためにプログラムによりソ
ート処理を再度実行する以上の多くの時間を要するとい
う欠点を有している。
The above-mentioned conventional sorting is also used when grouping records in which a part of the key area is the same or performing a totaling process on a specific key of the key area of the grouped data group. It is necessary to perform grouping processing and totaling processing by the program for all the data groups processed by the processing device, but the processing target is sorted by the program to target all the data first sorted by the processing device It has the disadvantage that it takes more time than it takes to execute the process again.

【0023】従来の別のソート処理装置が、例えば、特
開昭61−16326号公報や特開昭61−28942
4号公報7に開示されているが、これらのソート処理装
置も図4のソート処理装置と同様の欠点を有している。
Another conventional sorting apparatus is disclosed in, for example, Japanese Patent Laid-Open No. 61-16326 and Japanese Patent Laid-Open No. 61-28942.
Although disclosed in Japanese Patent Laid-Open No. 4-7, these sort processing devices also have the same drawbacks as the sort processing device of FIG.

【0024】本発明の目的は、ソート処理装置によりソ
ートを行うとき、対象となるデータのキー領域が互いに
等しいデータには同等である旨の符号を付加し、ソート
処理装置の最終段で直前に出力したレコードとキー領域
の先頭から数えて何桁目まで一致しているかを示す情報
を付加したレコードを出力することにより、上述のよう
なプログラムでの処理アルゴリズムおよび情報量を極小
におさえ、そのプログラムによる処理時間を短くするこ
との出来るソート処理装置を提供することにある。
An object of the present invention is to add a code indicating that data having the same key areas of target data to each other when sorting is performed by the sort processing device, and immediately before the last stage of the sort processing device. By outputting a record with added information indicating how many digits are counted from the beginning of the key area from the output record, the processing algorithm and the amount of information in the program as described above can be minimized. An object of the present invention is to provide a sort processing device capable of shortening processing time by a program.

【0025】[0025]

【課題を解決するための手段】本発明によれば、出力指
示信号が加えられるとそれまで記憶していたデータを外
部に出力すると共に、入力されるデータを記憶する出力
バッファと、前記出力指示信号が加えられると内部に記
憶されていたデータの内で出力フラグが付されているデ
ータを次期出力データとして出力すると共に、第1の比
較データを前記次期出力データを出力した領域に記憶
し、残留して記憶している他の一つのデータを第2の比
較データとして出力するローカルメモリと、入力指示信
号が加えられると、それまで記憶していた入力データを
前記第1の比較データとして出力すると共に、新たな入
力されたデータを記憶する入力バッファと、前記第1の
比較データを記憶する第1のレジスタと、前記第2の比
較データを記憶する第2のレジスタと、比較指示信号に
より制御され前記第1及び第2のレジスタの内容を比較
し大小関係を決定する比較器と、前記比較器の出力であ
る大小関係の判定結果を記憶する結果レジスタと、前記
結果レジスタの内容を監視し、相等しい関係である場合
には二重キーフラグを生成し記憶する二重キーフラグ生
成部と、外部から予め入力されたソートすべき各データ
のレコード長を記憶しているレコード長記憶部と、外部
から予め入力された前記比較器で比較すべきデータの長
さをキー長として記憶しているキー長カウンタと、外部
から加えられる開始指示信号により始動し、前記結果レ
ジスタと前記二重キーフラグ生成部の内容を参照し、二
重キーフラグが生成されているときには前記ローカルメ
モリが記憶している2つのデータの予め定められた領域
に二重キーフラグを付与し、大小関係の内で前記結果レ
ジスタにより指定された方に属するデータを記憶してい
るローカルメモリ中の該当するデータ側を次期出力デー
タとして指定するか、前記二重キーフラグ生成部が二重
キーフラグを生成しているときには前記第2のレジスタ
に記憶されているのと同一の前記ローカルメモリ中のデ
ータを次期出力データとして指定し、前記レコード長記
憶部の記憶しているレコード長の分だけ出力指示信号と
入力指示信号とを出力し、前記キー長カウンタが持つキ
ー長の分だけ前記比較指示信号を出力する比較器制御部
とを備えることを特徴とするソート処理装置が得られ
る。
According to the present invention, when an output instruction signal is applied, the data stored until then is output to the outside, and an output buffer for storing the input data, and the output instruction. When the signal is applied, the data to which the output flag is added among the data stored inside is output as the next output data, and the first comparison data is stored in the area where the next output data is output, A local memory for outputting the other remaining stored data as the second comparison data and, when an input instruction signal is applied, outputs the input data stored until then as the first comparison data. And also stores an input buffer for storing new input data, a first register for storing the first comparison data, and the second comparison data. No. 2 register, a comparator controlled by a comparison instruction signal to compare the contents of the first and second registers to determine the magnitude relationship, and a result register for storing the determination result of the magnitude relationship which is the output of the comparator. And, the contents of the result register are monitored, and if there is an equal relationship, a double key flag generating unit for generating and storing a double key flag, and a record length of each data to be sorted inputted in advance from outside is stored. Record length storage unit, a key length counter that stores the length of data to be compared by the comparator that is input in advance from the outside as a key length, and start by a start instruction signal added from the outside, By referring to the contents of the result register and the dual key flag generation unit, when the dual key flag is generated, the two data stored in the local memory are stored. A dual key flag is given to the defined area, and the corresponding data side in the local memory storing the data belonging to the one designated by the result register in the magnitude relation is designated as the next output data, or When the double key flag generation unit is generating the double key flag, the same data in the local memory that is stored in the second register is designated as the next output data, and the record length storage unit A comparator control unit that outputs an output instruction signal and an input instruction signal for the stored record length, and outputs the comparison instruction signal for the key length of the key length counter. A sort processing device for performing the above is obtained.

【0026】更に本発明によれば、前記比較器の比較結
果を参照し第1及び第2のレジスタの内容とが不一致に
なるまでの比較バイト数を記憶する一致バイト数カウン
タを更に備え、前記比較器制御部は、外部から加えられ
る開始指示信号により始動し、前記結果レジスタと前記
二重キーフラグ生成部の内容を参照し、二重キーフラグ
が生成されているときには前記ローカルメモリが記憶し
ている2つのデータの予め定められた領域に二重キーフ
ラグを付与し、大小関係の内で前記結果レジスタにより
指定された方に属するデータを記憶しているローカルメ
モリ中の該当するデータ側を次期出力データとして指定
するか、前記二重キーフラグ生成部が二重キーフラグを
生成しているときには前記第2のレジスタに記憶されて
いるのと同一の前記ローカルメモリ中のデータを次期出
力データとして指定し、前記一致バイト数カウンタの内
容を次期出力データの予め定められた領域に格納し、前
記レコード長記憶部の記憶しているレコード長の分だけ
出力指示信号と入力指示信号とを出力し、前記キー長カ
ウンタが持つキー長の分だけ前記比較指示信号を出力す
ることを特徴とするソート処理装置が得られる。
Further, according to the present invention, there is further provided a match byte number counter for referring to the comparison result of the comparator and storing the number of comparison bytes until the contents of the first and second registers do not match. The comparator control unit is started by a start instruction signal applied from the outside, refers to the contents of the result register and the double key flag generation unit, and stores the local memory when the double key flag is generated. A double key flag is given to a predetermined area of two data, and the corresponding data side in the local memory which stores the data belonging to the one designated by the result register in the magnitude relation is set as the next output data. Or as the same as the one stored in the second register when the dual key flag generator is generating the dual key flag. The data in the local memory is designated as the next output data, the contents of the coincidence byte number counter are stored in a predetermined area of the next output data, and only the record length stored in the record length storage section is output. A sort processing device is obtained which outputs an instruction signal and an input instruction signal, and outputs the comparison instruction signal for the key length of the key length counter.

【0027】[0027]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。
Embodiments of the present invention will now be described with reference to the drawings.

【0028】図1は本発明の一実施例によるソート処理
装置のブロック図であり、図2は図1に示されているソ
ート処理装置を複数台接続した本発明の別の実施例によ
るソート処理装置のブロック図である。
FIG. 1 is a block diagram of a sort processing apparatus according to one embodiment of the present invention, and FIG. 2 is a sort processing according to another embodiment of the present invention in which a plurality of sort processing apparatuses shown in FIG. 1 are connected. It is a block diagram of an apparatus.

【0029】本発明の一実施例によるソート処理装置
は、図1に示すように比較器制御部8と二重キーフラグ
制御部11と一致バイト数カウンタ12以外の構成要素
は、すでに図4において説明した従来のこの種の装置と
同一であるので、これらすでに説明した構成要素につい
ての説明は以後省略する。
The sort processing apparatus according to one embodiment of the present invention has already been described with reference to FIG. 4 except for the components other than the comparator control unit 8, the double key flag control unit 11 and the matching byte number counter 12, as shown in FIG. Since it is the same as the conventional device of this type, the description of these already-described components will be omitted.

【0030】すなわち、図1に示されている本発明のソ
ート処理装置には、結果レジスタ7の内容を監視し比較
器4による比較結果が同等であるとき、この状態を検出
し二重キーフラグを立てる二重キーフラグ生成部11
と、比較器4での比較結果を参照し、第1のレジスタ9
の内容と第2のレジスタ10の内容においてキー領域2
1の先頭から一致している桁数(即ち、バイト数)をカ
ウントする一致バイト数カウンタ12と、図4で説明し
た比較制御部8Aの代わりに比較制御部8が使用されて
いる。比較器制御部8はキー長カウンタ5とレコード長
記憶部6と入力バッファ1と出力バッファ2とローカル
メモリ3と比較器4と結果レジスタ7に接続されてお
り、その他に二重キーフラグ生成部11にも接続されて
いる。
That is, in the sort processing apparatus of the present invention shown in FIG. 1, when the contents of the result register 7 are monitored and the comparison result by the comparator 4 is equivalent, this state is detected and the double key flag is set. Double key flag generation unit 11 to be set
And the comparison result of the comparator 4 is referred to, and the first register 9
Of the key area 2 in the contents of 2 and the contents of the second register 10.
The matching byte number counter 12 that counts the number of matching digits (that is, the number of bytes) from the beginning of 1 and the comparison control unit 8 is used instead of the comparison control unit 8A described in FIG. The comparator control unit 8 is connected to the key length counter 5, the record length storage unit 6, the input buffer 1, the output buffer 2, the local memory 3, the comparator 4 and the result register 7, and the double key flag generation unit 11 is also provided. Is also connected to.

【0031】二重キーフラグ生成部11は、結果レジス
タ7の内容を監視し、キー長カウンタ5に記憶された回
数だけ比較が比較器4にて行われた後、比較結果が同等
である場合にはこの結果を検出し、二重キーフラグを立
てる。
The double key flag generator 11 monitors the contents of the result register 7 and, if the comparison result is equal after the comparison has been performed by the comparator 4 the number of times stored in the key length counter 5. Detects this result and sets a dual key flag.

【0032】一致バイト数カウンタ12は、比較器4で
の比較回数と比較結果を参照し、第1のレジスタ9の内
容と第2のレジスタ10の内容においてキー領域21の
先頭から一致している桁数をカウントする。これによ
り、比較対象の二つのデータにおいてキー領域21の先
頭から何バイト分が一致しているのかを検出することが
できる。
The matching byte number counter 12 refers to the number of comparisons and the comparison result in the comparator 4, and the contents of the first register 9 and the contents of the second register 10 match from the beginning of the key area 21. Count the number of digits. This makes it possible to detect how many bytes from the head of the key area 21 are the same in the two data to be compared.

【0033】比較器制御部8は比較器4にキー長カウン
タ5が記憶している値の数だけ比較指示信号を出力する
と、結果レジスタ7の内容を参照して、第1のレジスタ
9か第2のレジスタ10の内の何れかの指定がされてい
るときにはローカルメモリ3に記憶されているデータの
内で前述の結果レジスタ7により指定されたレジスタが
記憶しているデータと同一のデータをローカルメモリ3
から出力バッファ2に出力させる動作はすでに図4にお
いて説明した比較器制御部8Aと同一であるが、結果レ
ジスタ7が第1のレジスタ9および第2のレジスタ10
の何れをも指定していないときには二重キーフラグ生成
部11の内容を参照し二重キーフラグが立っていればロ
ーカルメモリ3内の第1及び第2の記憶領域に記憶され
ているそれぞれのデータの予め定められた位置(たとえ
ば、末尾)にそれぞれのデータが相等であることを示す
符号(フラグ)を付与し、その後、一致バイト数カウン
タ12の内容を参照しローカルメモリ3内の第1の記憶
領域に記憶されているデータの予め定められた位置(た
とえば、二重キーフラグの後尾)に一致バイト数カウン
ト値を書き込む。このようにして付与したデータの内で
ローカルメモリ3の第2の記憶領域に記憶されているデ
ータをこのように付与したフラグと共に出力バッファ2
に出力させ、ローカルメモリ3内の第1の記憶領域に記
憶させているデータを第2の記憶領域に移動して記憶さ
せる。このようにして、出力バッファ2から出力された
データは、図3に示すように、3桁のキー領域21の後
に、残レコード領域22、二重キーフラッグ領域23、
一致バイト数カウント領域24を有する。
When the comparator control unit 8 outputs the comparison instruction signal to the comparator 4 by the number of the values stored in the key length counter 5, the contents of the result register 7 are referred to and the first register 9 or the first register 9 When any one of the two registers 10 is designated, the same data as the data stored in the register designated by the result register 7 is locally stored in the data stored in the local memory 3. Memory 3
From the output register 2 to the output buffer 2 is the same as the comparator control unit 8A described in FIG. 4, but the result register 7 is the first register 9 and the second register 10.
When neither of the two is specified, the contents of the double key flag generation unit 11 are referred to. If the double key flag is set, the data of the respective data stored in the first and second storage areas in the local memory 3 are A code (flag) indicating that each data is equal is given to a predetermined position (for example, the end), and then the contents of the matching byte number counter 12 are referred to and the first storage in the local memory 3 is performed. The matching byte number count value is written at a predetermined position (for example, the tail of the double key flag) of the data stored in the area. Of the data thus added, the data stored in the second storage area of the local memory 3 together with the flag thus added are output buffer 2
The data stored in the first storage area in the local memory 3 is moved to the second storage area and stored therein. In this way, the data output from the output buffer 2 has a three-digit key area 21 followed by a remaining record area 22, a double key flag area 23,
It has a matching byte number counting area 24.

【0034】このような比較器4でデータ中のキー領域
の値についての比較を行った後に結果レジスタ7と二重
キーフラグ生成部11の内容を参照し、その参照結果に
基づいてローカルメモリ3内のデータの出力を制御する
動作以外は、比較器制御部8の動作は比較器制御部8A
と同一である。
After the value of the key area in the data is compared by the comparator 4 as described above, the contents of the result register 7 and the double key flag generator 11 are referred to, and the contents of the local memory 3 are stored based on the reference result. Other than the operation of controlling the output of the data of the
Is the same as

【0035】図2に示された本発明の別の実施例におい
ては、図1で説明したソート処理装置30Aから30N
+1までのN+1台を直列に接続したもので、初段のソ
ート処理装置30Aの入力バッファ1は外部からの入力
データを入力し、初段のソート処理装置30Aの出力バ
ッファ2の出力を第二段目のソート処理装置30Bの入
力バッファ1に接続し、以後前段のソート処理装置の出
力バッファ2を次段のソート処理装置の入力バッファ1
に接続しておく、このように接続することにより2N
1個のデータについて、そのキー領域の値が大なるもの
から小なるものへの順にソート処理装置30Nの出力バ
ッファ2から外部に出力させることができる。
In another embodiment of the present invention shown in FIG. 2, the sort processing devices 30A to 30N described in FIG.
N + 1 units up to +1 are connected in series. The input buffer 1 of the first-stage sort processing device 30A receives input data from the outside, and the output of the output buffer 2 of the first-stage sort processing device 30A is changed to the second stage. Connected to the input buffer 1 of the sort processing apparatus 30B, and thereafter the output buffer 2 of the sort processing apparatus of the previous stage is connected to the input buffer 1 of the sort processing apparatus of the next stage.
Is connected to, and by connecting in this way, 2 N
For one piece of data, the value of the key area can be output to the outside from the output buffer 2 of the sort processing device 30N in order from the largest value to the smallest value.

【0036】さらに、図1で説明したソート処理装置3
0N+1を最終段に接続し、ソート処理装置30Nから
のソートされた入力データを入力することにより二重キ
ーの検出および直前に出力されたデータとの一致バイト
数のカウントをソート処理装置で行うことができる。
Further, the sort processing device 3 described with reference to FIG.
By connecting 0N + 1 to the final stage and inputting sorted input data from the sort processing device 30N, the sort processing device detects the double key and counts the number of matching bytes with the data output immediately before. You can

【0037】もし、これらのそれぞれのソート処理装置
30Aから30N+1のそれぞれの比較器4で比較した
二つのデータについてキー領域の小なる方を結果レジス
タ7で指定するようにすれば、図2に示したソート処理
装置30N+1からはキー領域の小なるものから大なる
ものへの順にデータがソートされて出力されることにな
る。
If the result register 7 designates the smaller one of the key areas for the two data compared by the respective comparators 4 of the respective sort processing devices 30A to 30N + 1, the result shown in FIG. From the sort processing device 30N + 1, the data is sorted and output in order from the smallest key area to the largest key area.

【0038】さらに、図2に示したソート処理装置30
N+1として、図1に示したソート処理装置を使用し、
その他のソート処理装置については図4で示したソート
処理装置を使用しても、すべてのソート処理装置30A
から30N+1として図1に示したソート処理装置を使
用したのと同一の動作を行わせることができる。
Further, the sort processing device 30 shown in FIG.
As N + 1, the sort processing device shown in FIG. 1 is used,
For other sort processing devices, even if the sort processing device shown in FIG. 4 is used, all sort processing devices 30A
From 30N + 1 to 30N + 1, the same operation as that using the sort processing apparatus shown in FIG. 1 can be performed.

【0039】[0039]

【発明の効果】以上説明したように、本発明のソート処
理装置は、対象となるデータの内の指定されたキー領域
の値についての大なるものから小なるものへ、あるいは
その逆の順序にソートして並べ替えて出力させるときデ
ータのキーの値が互いに等しいデータについては、これ
らのデータの予め定められた所定の位置に比較した値が
相等しいことを示す二重キーフラグを付与して出力する
ため、その後にこれらキー領域の値に相等しいものが存
在しているかを別途用意されたプログラムにより処理す
るときは、データ全体の内でこのような二重キーフラグ
の部分だけに着目すればよいためプログラムによる処理
時間が従来のように二重キーフラグを持たないデータを
ソートする場合に比べて短くできるという効果を有す
る。
As described above, the sort processing apparatus of the present invention changes the value of the designated key area in the target data from the largest value to the smallest value or vice versa. When sorting, rearranging, and outputting, when the data has the same key value, the data is output with a double key flag indicating that the values compared with the predetermined positions of these data are equal. Therefore, after that, when processing whether a value equal to the value of these key areas exists by using a separately prepared program, it suffices to focus only on such double key flag portion in the entire data. Therefore, there is an effect that the processing time by the program can be shortened as compared with the conventional case where data having no double key flag is sorted.

【0040】また、ソートされたデータ内の所定の位置
に直前に出力されたデータとのキー領域の一致バイト数
を格納して出力するため、その後にこれらキー領域の複
数の項目について項目の一致を検出してグルーピング、
集計等を別途用意したプログラムにより処理するときに
は、データ全体の内でこのような一致バイト数情報の部
分だけに着目して処理を行えば良いためプログラムによ
る処理時間が短くできるという効果を有する。
Further, since the number of matching bytes of the key area with the data output immediately before is stored and output at a predetermined position in the sorted data, the items of the plurality of items in these key areas are then matched. Detect and group,
When processing such as totaling is performed by a separately prepared program, it is sufficient to focus only on such a portion of the matching byte number information in the entire data, so that the processing time by the program can be shortened.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の一実施例によるソート処理装置のブロ
ック図である。
FIG. 1 is a block diagram of a sort processing apparatus according to an embodiment of the present invention.

【図2】本発明の別の実施例によるソート処理装置のブ
ロック図である。
FIG. 2 is a block diagram of a sort processing apparatus according to another embodiment of the present invention.

【図3】図1および図4でソートの対象となるデータと
ソートの対象となるキー領域の関係を示す説明図であ
る。
FIG. 3 is an explanatory diagram showing a relationship between data to be sorted and a key area to be sorted in FIGS. 1 and 4.

【図4】従来のソート処理装置の一例のブロック図であ
る。
FIG. 4 is a block diagram of an example of a conventional sort processing device.

【符号の説明】[Explanation of symbols]

1 入力バッファ 2 出力バッファ 3 ローカルメモリ 4 比較器 5 キー長カウンタ 6 レコード長記憶部 7 結果レジスタ 8 比較器制御部 8A 比較器制御部 9 第1のレジスタ 10 第2のレジスタ 11 二重キーフラグ生成部 12 一致バイト数カウンタ 21 キー領域 22 残レコード領域 23 二重キーフラグ領域 24 一致バイト数カウント領域 30A〜30N+1 ソート処理装置 1 Input Buffer 2 Output Buffer 3 Local Memory 4 Comparator 5 Key Length Counter 6 Record Length Storage 7 Result Register 8 Comparator Control 8A Comparator Control 9 First Register 10 Second Register 11 Double Key Flag Generator 12 Matching Bytes Counter 21 Key Area 22 Remaining Record Area 23 Double Key Flag Area 24 Matching Bytes Count Area 30A to 30N + 1 Sort Processing Device

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 出力指示信号が加えられるとそれまで記
憶していたデータを外部に出力すると共に、入力される
データを記憶する出力バッファと、前記出力指示信号が
加えられると内部に記憶されていたデータの内で出力フ
ラグが付されているデータを次期出力データとして出力
すると共に、第1の比較データを前記次期出力データを
出力した領域に記憶し、残留して記憶している他の一つ
のデータを第2の比較データとして出力するローカルメ
モリと、入力指示信号が加えられると、それまで記憶し
ていた入力データを前記第1の比較データとして出力す
ると共に、新たな入力されたデータを記憶する入力バッ
ファと、前記第1の比較データを記憶する第1のレジス
タと、前記第2の比較データを記憶する第2のレジスタ
と、比較指示信号により制御され前記第1及び第2のレ
ジスタの内容を比較し大小関係を決定する比較器と、前
記比較器の出力である大小関係の判定結果を記憶する結
果レジスタと、前記結果レジスタの内容を監視し、相等
しい関係である場合には二重キーフラグを生成し記憶す
る二重キーフラグ生成部と、外部から予め入力されたソ
ートすべき各データのレコード長を記憶しているレコー
ド長記憶部と、外部から予め入力された前記比較器で比
較すべきデータの長さをキー長として記憶しているキー
長カウンタと、外部から加えられる開始指示信号により
始動し、前記結果レジスタと前記二重キーフラグ生成部
の内容を参照し、二重キーフラグが生成されているとき
には前記ローカルメモリが記憶している2つのデータの
予め定められた領域に二重キーフラグを付与し、大小関
係の内で前記結果レジスタにより指定された方に属する
データを記憶しているローカルメモリ中の該当するデー
タ側を次期出力データとして指定するか、前記二重キー
フラグ生成部が二重キーフラグを生成しているときには
前記第2のレジスタに記憶されているのと同一の前記ロ
ーカルメモリ中のデータを次期出力データとして指定
し、前記レコード長記憶部の記憶しているレコード長の
分だけ出力指示信号と入力指示信号とを出力し、前記キ
ー長カウンタが持つキー長の分だけ前記比較指示信号を
出力する比較器制御部とを備えることを特徴とするソー
ト処理装置。
1. When an output instruction signal is applied, the data that has been stored up to that time is output to the outside, and an output buffer that stores the input data, and an output buffer that is internally stored when the output instruction signal is applied. The data to which the output flag is added is output as the next output data, and the first comparison data is stored in the area where the next output data is output, and the other stored data is stored. When a local memory that outputs two data as the second comparison data and an input instruction signal are added, the input data stored until then is output as the first comparison data, and the newly input data is output. An input buffer for storing, a first register for storing the first comparison data, a second register for storing the second comparison data, and a comparison instruction signal A comparator for controlling the contents of the first and second registers to determine the magnitude relationship, a result register for storing the determination result of the magnitude relationship which is the output of the comparator, and the contents of the result register. A double key flag generation unit that monitors and generates and stores a double key flag when they are in the same relationship, and a record length storage unit that stores the record length of each data to be sorted that is input in advance from the outside. , A key length counter that stores the length of data to be compared by the comparator, which is input in advance from the outside, as a key length, and a start instruction signal that is externally applied to start the result register and the double key flag. Referring to the contents of the generation unit, when the double key flag is generated, the double key flag is stored in a predetermined area of the two data stored in the local memory. Assign the corresponding data side in the local memory that stores the data belonging to the one designated by the result register among the magnitude relations, or designate the corresponding data side as the next output data, When the key flag is being generated, the same data in the local memory as that stored in the second register is designated as the next output data, and only the record length stored in the record length storage unit is designated. A sort processing device, comprising: a comparator control unit that outputs an output instruction signal and an input instruction signal, and outputs the comparison instruction signal by the key length of the key length counter.
【請求項2】 請求項1記載のソート処理装置を複数台
直列に接続したことを特徴とするソート処理装置。
2. A sort processing device, wherein a plurality of sort processing devices according to claim 1 are connected in series.
【請求項3】 請求項1記載のソート処理装置におい
て、前記比較器の比較結果を参照し第1及び第2のレジ
スタの内容とが不一致になるまでの比較バイト数を記憶
する一致バイト数カウンタを更に備え、前記比較器制御
部は、外部から加えられる開始指示信号により始動し、
前記結果レジスタと前記二重キーフラグ生成部の内容を
参照し、二重キーフラグが生成されているときには前記
ローカルメモリが記憶している2つのデータの予め定め
られた領域に二重キーフラグを付与し、大小関係の内で
前記結果レジスタにより指定された方に属するデータを
記憶しているローカルメモリ中の該当するデータ側を次
期出力データとして指定するか、前記二重キーフラグ生
成部が二重キーフラグを生成しているときには前記第2
のレジスタに記憶されているのと同一の前記ローカルメ
モリ中のデータを次期出力データとして指定し、前記一
致バイト数カウンタの内容を次期出力データの予め定め
られた領域に格納し、前記レコード長記憶部の記憶して
いるレコード長の分だけ出力指示信号と入力指示信号と
を出力し、前記キー長カウンタが持つキー長の分だけ前
記比較指示信号を出力することを特徴とするソート処理
装置。
3. The sort processing device according to claim 1, wherein a match byte number counter that stores the number of comparison bytes until the contents of the first and second registers do not match with each other by referring to the comparison result of the comparator. Further comprising, the comparator control unit is started by a start instruction signal added from the outside,
Referring to the contents of the result register and the double key flag generation unit, when the double key flag is generated, the dual key flag is given to a predetermined area of the two data stored in the local memory, Either the corresponding data side in the local memory storing the data belonging to the one designated by the result register in the magnitude relation is designated as the next output data, or the dual key flag generation unit generates the dual key flag. When doing the second
The same data stored in the register of the local memory is designated as the next output data, the content of the coincidence byte number counter is stored in a predetermined area of the next output data, and the record length is stored. A sort processing device, which outputs an output instruction signal and an input instruction signal for a record length stored in a unit, and outputs the comparison instruction signal for a key length held by the key length counter.
【請求項4】 請求項3記載のソート処理装置を複数台
直列に接続したことを特徴とするソート処理装置。
4. A sort processing device, wherein a plurality of sort processing devices according to claim 3 are connected in series.
【請求項5】 一つの入力レコード中にソート対象キー
であるキー領域とソート対象外のレコード領域と二重キ
ー検出フラグ格納領域と直前に出力されたレコードのデ
ータとの一致バイト数格納領域と制御フラグ領域とを持
ち、ハードウェアによるソート処理により判定された二
重キー検出結果と一致バイト数カウント結果を前記レコ
ード内の予め定められた領域に格納し出力することによ
り上位ソフトウェアに対しソート結果を報告し、前記レ
コード内の領域の内容を参照することによってソートキ
ー部の再比較を行わずに結果の集計、グルーピング、二
重キーエラーの報告を行うことを特徴とする請求項3記
載のソート処理装置。
5. A key area that is a sort target key, a record area that is not a sort target, a double key detection flag storage area, and a matching byte count storage area in the record that was output immediately before in one input record. It has a control flag area and stores the result of double key detection determined by the sort processing by hardware and the count result of the number of matching bytes in a predetermined area in the record and outputs it to the upper software. 4. The sort according to claim 3, wherein the results are aggregated, grouped, and a double key error is reported without re-comparing the sort key parts by referring to the contents of the area in the record. Processing equipment.
JP688993A 1993-01-19 1993-01-19 Processing equipment Expired - Fee Related JPH0774988B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP688993A JPH0774988B2 (en) 1993-01-19 1993-01-19 Processing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP688993A JPH0774988B2 (en) 1993-01-19 1993-01-19 Processing equipment

Publications (2)

Publication Number Publication Date
JPH06214752A true JPH06214752A (en) 1994-08-05
JPH0774988B2 JPH0774988B2 (en) 1995-08-09

Family

ID=11650804

Family Applications (1)

Application Number Title Priority Date Filing Date
JP688993A Expired - Fee Related JPH0774988B2 (en) 1993-01-19 1993-01-19 Processing equipment

Country Status (1)

Country Link
JP (1) JPH0774988B2 (en)

Also Published As

Publication number Publication date
JPH0774988B2 (en) 1995-08-09

Similar Documents

Publication Publication Date Title
US5819268A (en) Method and system for testing for equality/difference in multiple tables of a database
JP2790466B2 (en) Character string search method and apparatus
JPS5958558A (en) Parallel cyclic redundant checking circuit
JP2752634B2 (en) Sorting device
JPS60105039A (en) Collation system of character string
JPH06214752A (en) Sorting processor
US6694344B1 (en) Examination of residues of data-conversions
JPH01311623A (en) Acceleration arithmetic circuit
JPH0667843A (en) Sorting processor
US5894427A (en) Technique for concurrent detection of bit patterns
JPH07101460B2 (en) Code detector
US4933893A (en) Arithmetic processing method and apparatus for performing arithmetic or logical operations within a minimum number of operation cycles
JPH04279973A (en) Character string comparison system
JPH064582A (en) Central processing unit
JPS61278933A (en) Data sorting out system
JP2508004B2 (en) Sort processing device
JPH03147036A (en) Variable length data processor
JPS63123133A (en) Error processing system
JPH0833812B2 (en) Sorting device
JPH10135847A (en) Parallel header error correction circuit and header error correction method for atm communication equipment
JPH0371262A (en) Data processor
JPH0650478B2 (en) Data compression storage system
JPH06202849A (en) Information processor
JPH048815B2 (en)
JPH0664586B2 (en) String matching method

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19960130

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20070809

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080809

Year of fee payment: 13

LAPS Cancellation because of no payment of annual fees