CN1092362C - Array dislocation comparison device and method for realizing query - Google Patents

Array dislocation comparison device and method for realizing query Download PDF

Info

Publication number
CN1092362C
CN1092362C CN98104091A CN98104091A CN1092362C CN 1092362 C CN1092362 C CN 1092362C CN 98104091 A CN98104091 A CN 98104091A CN 98104091 A CN98104091 A CN 98104091A CN 1092362 C CN1092362 C CN 1092362C
Authority
CN
China
Prior art keywords
inquiry
comparer
string
row
character
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.)
Expired - Lifetime
Application number
CN98104091A
Other languages
Chinese (zh)
Other versions
CN1226025A (en
Inventor
廖福九
刘大力
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.)
Beijing Duosi Technical Services Co Ltd
Original Assignee
DUOSI SCIENCE AND TECHNOLOGY I
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 DUOSI SCIENCE AND TECHNOLOGY I filed Critical DUOSI SCIENCE AND TECHNOLOGY I
Priority to CN98104091A priority Critical patent/CN1092362C/en
Publication of CN1226025A publication Critical patent/CN1226025A/en
Application granted granted Critical
Publication of CN1092362C publication Critical patent/CN1092362C/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

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

Abstract

An array misalignment comparison device for performing a comparison of two sets of data strings by staggering one data in multiple rows at a time, comprising: m rows of comparators, n comparators in each row, thereby forming an nxm array of comparators, wherein each comparator has a first input, a second input, and an output, the first inputs of the comparators in each column being connected together; and each data of the first group of data strings is respectively connected with the first input end, and the second group of data strings is connected with the second input end in a mode of staggering one bit in each row. The device can be used for carrying out quick multi-character comparison and quickening the query operation of characters.

Description

Array dislocation comparing apparatus and being used for is realized the method for inquiring about
Technical field
The present invention relates to computer instruction system and encoded control field thereof, particularly the method for comparison logic design and character string inquiry.
Background technology
The character processing in computer utility is and is general, no matter is file processing, network processes, database processing etc., and character is handled and all occupied sizable ratio in these application software.No matter current popular computer system is CISC system or RISC system, does not all include in the instruction set and directly carries out the instruction that character is handled, and carries out will realizing by carrying out many instructions when character is handled, and causes processing speed to reduce.Fig. 1 is a process flow diagram of realizing inquiry in existing computing machine.As shown in Figure 1, need carry out repeatedly character and equate many instructions such as comparison, displacement, judgement, obvious institute's time spent is long, and programming is complicated.This is can once carry out the hardware circuit that multiword accords with instruction relatively and realizes this comparison order fast because lack among the existing CPU.
Summary of the invention
Therefore, primary and foremost purpose of the present invention is to provide one can carry out quick multiword symbol circuit relatively; Another object of the present invention is to increase a kind of query statement, utilize this instruction to programme, the design that can simplify procedures; Another object of the present invention is for realizing that query statement provides a character string inquiry unit, utilizing query statement and this device can accelerate the query manipulation of character.
In order to realize above purpose, the invention provides a kind of array dislocation comparing apparatus, be used for the comparison that the multirow of two groups of serial datas of disposable realization staggers data, this array dislocation comparing apparatus comprises:
The capable comparer of m has n comparer in every row, thereby has constituted the array comparer of n * m, wherein
Each comparer has a first input end, second input end and an output terminal, and the first input end of the comparer in every row links together; And each data of first group of serial data are connected on first input end respectively, and second group of serial data is connected on second input end in stagger one mode of every row.
In order to realize above purpose, the present invention also provides a kind of character string inquiry unit, be used in the monocycle from one include n character another includes the inquiry string of 1 to n character by the inquiry string retrieval, it is characterized in that comprising:
One according to array dislocation comparing apparatus of the present invention;
A partial results register is used for the part comparative result of above-mentioned array dislocation comparing apparatus is deposited;
A string comparative result arbiter is used for the result after the controller processing is handled, and the result is differentiated in final output; With
The control requirement of the control signal that provides according to instruction is provided a controller, gives the comparative result arbiter again after the output data of the comparative result of each comparer in the above-mentioned array dislocation comparing apparatus and partial results register is handled.
In order to realize above purpose, the present invention also provides a kind of method that is used for realizing inquiry in disposal system, it is characterized in that comprising step:
1) sends out a query statement;
2) check whether this inquiry is successful;
3) if this inquiry is unsuccessful, then revise in the query statement by the address of inquiry string, and repeating step 1; If this successful inquiring then arrives step 4;
4) get locating information CNO and LAST.
In order to realize above purpose, the present invention also provides a kind of query statement, comprising:
The control signal of character number (NUM) in the inquiry string,
Indication is the control signal (SIG) of monocycle or multicycle inquiry
By the inquiry string address,
The inquiry string address.
Array dislocation comparing apparatus of the present invention has the capable comparer of m, and the capable comparer of this m compares operation simultaneously, therefore can improve multiword symbol speed relatively greatly.
Therefore array format of the present invention is almost just corresponding in the active computer a function or subroutine have reduced the complexity of programming.
Character string routine device of the present invention one-period can be given in the Query Result of inquiry one character string in n the character string, and can the multicycle continuous-query, therefore, will improve the speed of character string inquiry greatly.
Description of drawings
In the accompanying drawing:
Fig. 1 is that prior art compares the process flow diagram of realizing inquiry with software;
Fig. 2 is an array dislocation comparing apparatus block diagram of the present invention;
Fig. 3 is a character string inquiry unit structured flowchart of the present invention;
Fig. 4 is the block diagram of partial results register of the present invention;
Fig. 5 is the block diagram of controller of the present invention;
Fig. 6 is the block diagram of string comparative result discriminating gear of the present invention.
Fig. 7 is a query statement of the present invention and to the block diagram of character inquiry unit effect.
Fig. 8 to Figure 16 is the figure in the routine 1---example 3 in the present disclosure 8.
Fig. 8 is the array comparator configuration form figure of example 1.
Fig. 9 is the device block diagram of example 2 implementation methods.
Figure 10 is the array comparator configuration form figure of example 2.
Figure 11 is the block diagram of example 3 character string continuous-query devices.
Figure 12 is array dislocation comparator arrangement mode figure in the example 3.
Figure 13 is array dislocation comparator configuration figure in the example 3.
Figure 14 is a part result register structural drawing in the example 3.
Figure 15 is example 3 middle controller block diagrams.
Figure 16 is a character string comparative result arbiter block diagram in the example 3.
Figure 17 is to use the program flow diagram of query statement of the present invention and the disposable inquiry of character string inquiry unit
Figure 18 is to use the program flow diagram of query statement of the present invention and character string inquiry unit continuous-query.
Below the embodiment apparatus structure of the present invention is described in detail.
Fig. 2 is that the every as shown in Figure 2 row of array dislocation comparer of the present invention (hereinafter to be referred as the array comparer) block diagram has n comparer, the capable formation of m m*n array format is arranged, the array comparer has two groups respectively to be the operand of n data by instruction indication, n data in first group of operand sequentially are added in the first input end of every capable n comparer, so, the first input end of the comparer of the same row of each row all connects the data in the same first operand; Identical with the first operand according to this order of n number among second group of Cao Zuoshuo $B is added in second input end of n the comparer of first row of array comparer, at the capable (i=2 of i, 3, ..., m) in, the order of n data in second group of operand after the order of connection on n the comparer is to make on the basis in the order of connection of first row n the data ring shift (i-1) of second group of operand inferior respectively is added in second input end of the capable n of an i comparer, therefore the data of a second operand form the arrangement of dislocation in adjacent row, this just can realize two serial datas finish once how group compares, and is as follows: as to establish
$B=B1B2B3 realizes that data are compared as follows:
Row 1234 ... m m+1 m+2 ... n
$A: A1 A2 A3 A4…Am Am+1 Am+2…An
Row 1 B1 B2 B3 B4 ... Bm Bm+1 Bm+2 ... Bn
Row 2 Bn B1 B2 B3 ... Bm-1 Bm Bm+1 ... Bn-1
Row 3 Bn-1 Bn B1 B2 ... Bm-2 Bm-1 Bm ... Bn-2
$B:
 
Row m Bn-m+2 Bn-m+3 Bn-m+4 Bn-m+5B1 B2 B3 ... Bn-m+1
Each comparer has its output signal indication of an output terminal to be connected on the comparative result of the data of two input ends of this comparer, when output signal is " 1 ", represents that two input data equate, when output signal is that two inputs of " 0 " expression data are unequal.The array comparison means has m*n output terminal, and the integral body output result of these output terminals indicates each data dislocation equal situation relatively in two groups of operands.
Data in two groups of operands can all be that character also can all be the coding (as the BCD coding) of other form, the long position appearance with data in the position of comparer etc.
When Zai $A comprises the data number greater than n, then realize continuously the comparison of $A total length and $B with the multicycle, weekly the phase in regular turn n character among the in regular turn $A be connected on the first input end of array comparer.
{CAT[R $A=A1A2A3......AnAn+1......A2nA2n+1...........
$B=B1B2B3......Bn
The realization data are compared as follows.
Figure C9810409100081
Concerning row i (i>1) in conjunction with the comparative result of adjacent periods (tiltedly between dotted line), also can Shi Xian $B total length with the dislocation of $A relatively, promptly this device can keep two groups of continuitys that the data dislocation is compared between the cycle of striding.
Fig. 3 is a character string inquiry unit structured flowchart of the present invention, it is by array dislocation character comparison means as shown in Figure 3, the partial results register, controller and string comparative result arbiter are formed, two data input ends of inquiry unit are accepted two groups of n operands by the instruction appointment respectively, first group is by Cha Xunzifuchuan $A, second group is Cha Xunzifuchuan $B, its length is n, device also has two control input ends, two control signals providing by instruction are provided respectively, it is the disposable inquiry or the multiply periodic continuous-query in this cycle that significant character number in one of them signal NUM given query character string, another signal SIG are specified this.
Device has two output terminals, one of them output terminal output Q, and it indicates this character string more whether to equate whether i.e. expression inquiry is successful; Another output terminal output CNO, its is indicated when appearance (row smaller in the corresponding array dislocation comparer) character string first time relatively equates in this inquiry, the position of the row of first character correspondence of inquiry string in array dislocation comparing apparatus.
Fig. 4 is a part comparative result register of the present invention, it is made up side by side by the multidigit register and constitutes as shown in Figure 4, the input of register is respectively the capable i of i the comparative result (i=2 to n comparer, 3, ..., m) value of the output number of part comparative result register and output and corresponding input is identical, and its effect is that the array dislocation comparing apparatus part comparative result with this work period is saved in next work period, that is:
CPn CPn+1
Input Output
Sij S`ij
ij=22-mn
Fig. 5 is the block diagram of controller of the present invention.Its first group of data input pin accepted array comparer output result as shown in Figure 5, and second group of data input pin receiving portion divided the relatively output result of result register; The signal NUM that the direct acceptance in a control input end of controller is provided by instruction, the significant character number that is comprised among the Di Ercaozuoshuo $B of this signal appointment as inquiry string, allow number of characters variable to n from 1, controller utilizes the NUM signal to the input data manipulation, the output that is provided makes the other parts in the inquiry unit not comprise the influence of number of characters changing factor among the Shou $B, promptly the other parts to device shield the variation that comprises number of characters among the $B, and are simple thereby the structure of making and operation become.Another signal SIG that the same directly acceptance in another control input end of controller is provided by instruction, it is the disposable inquiry or the multiply periodic continuous-query in this cycle that this signal is specified this, thus, controller is when handling the input data, and whether the output result of determining section result register is used in this work period query manipulation.
One group of output of controller is m * n output data P11-Pmn after shielding is selected to handle to input data process, and they will direct input data as string comparative result arbiter.
Control principle and the method for control signal NUM and SIG are as follows:
To be used for basic word length be 64 to inquiry unit for convenience of explanation, and the array comparer that is used in the system of suitable 8 characters is got m=n=8 and explained.
NUM is 3 codings, and comprising significant character (putting the left side) number N in the 000-111 indication inquiry string is 1-8.
SIG is 1 coding, and SIG=0 indicates disposable query manipulation; SIG=1, the operation of indication multicycle continuous-query.
(1) use the NUM coding and produce 8 bit mask sign indicating number M1, M2 ..., the M8 relation is as follows:
NUM N M1 M2 M3 M4 M5 M6 M7 M8
000 001 010 011 100 101 110 111 1 2 3 4 5 6 7 8 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
Character string comparable situation when (2) changing for investigation N=1-8 detects the comparative result in each row of array comparer.
Row 1 detects S11-S18 when N=1-8;
Row 2 detects S22-S28 when N=1-7,
When N=8 when continuous-query is operated, detect S21 and S ` 22-S ` 28;
Row 3 detects S33-S38 when N=1-6,
When N=7-8 when continuous-query is operated, detect S31-S32 and S ` 33-S ` 38;  
Row 8 detects S88 when N=1,
When N=2-8 when continuous-query is operated, detect S81-S87 and S ` 88.N=1-7. discerns with M7=1 with M8=1 identification, N=1-6. in above-mentioned, and the rest may be inferred,
N=1 discerns with M2=1.(3) use M1-M8 to Sij (ij=11-88) and the output of part comparative result register
S ` ij (ij=22-88) carries out masking operation.
Row 1 P11=S11+M1
P12=S12+M2
P18=S18+M8
Go up various in when N=1, P11=S11 only, P12-P18 equals 1, N=2
The time P11=S11, P12-S12, P13-P18 equal 1, the rest may be inferred,
When N=8, P11-P18 equals S11-S18 respectively.
Row 2 P21=S21+M8
P22=(M8·S22+ M8·S`22)+M1
P28=(M8·S28+ M8·S`28)+M7
When N=1, except that P22, all the other formulas all equal 1, N=2 in upward various
The time except that P22, P23 all the other formulas all equal 1, the rest may be inferred.
Row 3 P31=S31+M7
P32=S32+M8
P33=(M7·S33+ M7·S`33)+M1
P38=(M7·S38+ M7·S`38)+M6
When N=1, except that P33, all the other formulas all equal 1 in upward various; N=2
The time, except that P33, P34, all the other formulas all equal 1, and the rest may be inferred.
Row 8 P81=S81+M2
P82=S82+M3
P87=S87+M8
P88=(M2·S88+ M2·S`88)+M1
Going up various middle Sij (ij=11-88) is the output of partial results register, is that Sij result of last one-period is saved in this cycle, and Pij (ij=11-88) is that controller is considered the processing output that the control of NUM requires.
Go up in each expression formula, when Pij=0 represents that the character that compares the position is unequal in the comparer of the capable j row of array comparer i, idle character participates in comparer output relatively among the Dui $B, since with one equal 1 mask off code M and do the logical OR operation, its corresponding Pij must wait 1, when the differentiation character string equates, can not play inhibition after making, thereby reach the purpose of shielding.
(4) control with the SIG control signal
Control signal SIG is continuous-query operation requirement when equaling 1, and controller output P11-P88 has considered this situation in last page or leaf (3);
When equaling 0, this moment is owing to be the comparative result S ` ij that the disposable inquiry of this cycle can not be used the cycle, at this moment, the retrieval of making N=8 can only be expert at and 1 just may, be expert at and 2 make N=8, be expert at and 3 make N=7-8......, 8 retrievals of making N=2-8 of being expert at are impossible, therefore the 2-that goes in this case should provide the unequal result of string search capable 8 this moments, be that corresponding Pij should make and equals ' 0 ', consider the control requirement of SIG for this reason, do the logical and operation with SIG and S ` ij item in the Pij output expression formula of capable 2-capable 8 in (3), the output result of controlled device is as follows:
Row 1 P11=S11+M1
P12=S12+M2
P18=S18+M8
Row 2 P21=S21+M8
P22=(M8·S22+ M8·S`22·SIG)+M1
P28=(M8·S28+ M8·S`28·SIG)+M7
Row 3 P31=S31+M7
P32=S32+M8
P33=(M7·S33+ M7·S`33·SIG)+M1
P38=(M7·S38+ M7·S`38·SIG)+M6
Row 8 P81=S81+M2
P87=S87+M8
P88=(M2·S88+ M2·S`88·SIG)+M1
In the above-mentioned expression formula when SIG=0, S ` igSIG=0, this moment corresponding expression formula left side Pij=0, thereby realized the control requirement of SIG.
Fig. 6 is the block diagram of string comparative result arbiter of the present invention, and its input comes from controller m*n output data P11-Pmn as shown in Figure 6, an output terminal Q, and it provides the result of character string inquiry; When Q is true, represent successful inquiring; When Q is false, represent that inquiry is unsuccessful.Another output terminal CNO is given in this inquiry for the first time (in the corresponding array dislocation comparer less row number) position of the row of first character correspondence in the array comparer of inquiry string when character string relatively equates, thereby has also determined the position of the data among the corresponding Zai $A.Another output terminal LAST was given in position that continuous-query when success CNO given refer to this cycle still row number in the cycle of going up, and LAST is very, refers to one-period; LAST is false, refers to this cycle.
The principle of work and the method for string comparative result arbiter are as follows:
Because string comparative result arbiter is connected mutually with controller, for convenience of description, gets m=n=8 equally and make example.
The output P11-P88 that is input as controller of string comparative result arbiter, they are to obtain after the processing of array comparer output S11-S88 via controller control signal is handled, Pjj is corresponding with Sjj (i=1-8).
(1) the detection character string is more equal
There is the Pij (j=1-8) of the i of delegation all to equal 1 as long as be expert among the 1-8, then represents two character strings more equal at this journey i, that is successful inquiring, Q=1 represents by the successful inquiring sign.
Each row the relatively more equal signal of character string occurs and is designated as LEi (i=1-8), LEi=1, and character string is more equal among the i that represents to be expert at; LEi=0 represents unequal.
LEi=Pi1·Pi2·Pi3·Pi4·Pi5·Pi6·Pi7·Pi8 (i=1-8)
Q=LE1+LE2+LE3+LE4+LE5+L6+LE7+LE8
(2) location during successful inquiring
The inquiry string correspondence is being an anchor point by the position on the inquiry string during with successful inquiring, because the position on the array comparer is determined by inquiry string and inquiry string, therefore can be when comparative result equates with the position of inquiry string in the array comparer as the actual location point, the situation that the character string comparative result equates may appear in multirow, must find out when string relatively equates for the first time in this inquiry, when the promptly corresponding less row number last string that occurs relatively equates, the row of first character correspondence in the array comparer number of keeping left of inquiry string, this promptly should reflect in logic when multirow character string occurs and relatively equates, row is number little has precedence over row number bigger being retrieved.Row in last one-period during continuous-query should preferentially sub row in this cycle.
The character string comparative result output signal of i during as minimum row of being expert at is designated as CLEi (i=1-8), and CLEi=1 represents as character string among the capable i of minimum row number more equal; CLEi=0, the expression string is more unequal, and CNO can indicate row j (j=1-8), corresponding relation such as following table with 3:
Respective column j CNEi CNO
1 2 3 4 5 6 7 8 CLE1 CLE2 CLE3 CLE4 CLE5 CLE6 CLE7 CLE8 000 001 010 011 100 101 110 111
Illustrate: in three of CNO the right be the 1st left side be the 3rd respectively note do CNO<1, CNO<2 and CNO<3
Each row satisfies the logical expression of the condition that is positioned at this row:
(a) under disposable request for information, promptly during SIG=0:
Because inquiry string is the arrangement of dislocation in each row, the 1st character of inquiry string 1 correspondence of being expert at is row 1, and 2 correspondences of being expert at are row 2 ..., being expert at 8 corresponds to row 8.Therefore character string equates just to indicate the 1st character respective column j=i. of inquiry string among the row i
Under disposable request for information, be positioned at the conditional logic expression formula SGLj of row j (j=1-8)
(j=1-8) be:
SGL1=LE1
SGL2= LE1·LE2
SGL3=LE1·LE2·LE3
SGL4= LE1·............· LE3·LE4
SGL5= LE1·............· LE4·LE5
SGL6= LE1·............· LE5·LE6
SGL7= LE1·............· LE6·LE7
SGL8= LE1·............· LE7·LE8
(b) under the continuous-query situation, promptly during SIG=1
Determine to be positioned at j row (for row 3).At this moment, relatively equate except string appears in the i that is expert at (i=j), row i (i<j) go up string more unequal, owing to be to step up one-period to compare together, under the long situation of different inquiry strings, (on the i>j) the equal situation of character string may appear also at other capable i.As inquiry string length is 5, and at this moment, the condition that be positioned at row j=3 is except requiring LE1=LE2=0 and LE3=1 (this be with SIG=0 time identical), also require to be expert at 5,6,7,8 do not occur the string more equal, promptly want LE5=LE6=LE7=LE8=0, if occur equaling 1 situation among the LE5-LE8, then this moment, corresponding location row number should be row 5 in last one-period, 6,7,8, they more lead over the row 3 in this cycle.And for example inquiry string length is 8, the condition that will be positioned at j=3 this moment is LE2=0 and LE3=1, the row 3 of this moment are the row 3 when operating the one-period of lasting, what pay special attention to is that present location is relevant with the length of inquiry string, so, the expression formula of the condition C ON3 of location row 3 under the continuous-query situation: CON3=(N=1) LE1 LE2LE3+ (N=2) LE1 LE2LE3 LE8+ (N=3) LE1 LE2LE3 LE7 LE8+ (N=4) LE1 LE2LE3 LE6 LE7LE8+ (N=5) LE1 LE2LE3 LE5 LE6 LE7 LE8+ (N=6) LE1 LE2LE3 LE4 LE5 LE6 LE7 LE8+ (N=7) LE3+ (N=8) LE2LE3
So, can determine to be positioned at the logical expression of other each condition C ONj (j=1-8) that is listed as with same analysis ratiocination.Row localization and expression formula when comprehensive SIG=0 and SIG=1 can obtain going here and there the logical expression of row location condition CLEj (j=1-8) of comparative result arbiter:
CLEj=SIG·CONj+ SIG·SGLj (j=1-8)
CNO<3>=CLE5+CLE6+CLE7+CLE8
CNO<2>=CLE3+CLE4+CLE7+CLE8
CNO<1>=CLE2+CLE4+CLE6+CLE8
Last surface analysis finds out that when continuous-query the location may corresponding a certain listing also in this cycle may list the same of last one-period, and in order to distinguish, other adds an output signal LAST, works as LAST=0, and expression is positioned at listing of this cycle; Work as LAST=1, expression is positioned at listing of one-period, and the LAST signal is only just meaningful under continuous-query operation and successful inquiring situation.
LAST=(N=2)LE8+(N=3)(LE7+LE8)+(N=4)(LE6+LE7+LE8)+(N=5)
(LE5+LE6+LE7+LE8)+(N=6)(LE4+LE5+LE6+LE7+LE8)+(N
=7)(LE3+LE4+LE5+LE6+LE7+LE8)+(N=8)(LE2+LE3+LE4+
LE5+LE6+LE7+LE8)
The method that other can also be arranged except implementation method described above, for example, row and the same numbering of the row in this cycle of last one-period can be write out respectively then and be positioned at the expression formula that respectively lists, CNO just increases a coding with regard to not needing the LAST signal like this.
Fig. 7 is a query statement provided by the invention and to the block diagram of character string inquiry unit effect.
Comprise the address of depositing in this instruction, also comprise by inquiry string and inquiry string
Two control codes, this control code can directly also can be connected to word after decoder for decoding
On the symbol string inquiry unit.
This instruction can be an independent instruction, also can be in the long instruction
Ingredient is as the coding of a feature operation in this instruction multioperation or the macro operation.
Below to the embodiments of the present invention description of giving an example.
Example 1 array dislocation comparator device realizes that service data string data number is fixing feelings
The comparative approach of condition
If 8 data of A2 A3 A4 A5 A6 A7 A8
$B=B1 B2 B3 is fixed as 3 data
It is as follows that comparator operations is counted pair relationhip:
Row 12345678
$A: A1 A2 A3 A4 A5 A6 A7 A8
Row 1 B1 B2 B3
2 B1 B2 B3
3 B1 B2 B3
$B:4 B1 B2 B3
5 B1 B2 B3
6 B1 B2 B3
This moment, array comparator configuration form was seen accompanying drawing 8, because the data number of two groups of serial datas equals n or less than n,
M=6 in the accompanying drawing 8, in the n=8 array comparer, some comparers can be omitted, the parallel operation generation comparative result S11-S63 that compares of each comparer
Sij=1 is more equal; Sij=0, more unequal (i=1,2 ..., 6; J=1,2,3)
Bao Han $B among the , $A when satisfying Si1=Si2=Si3=1 among the i of delegation in office.
Data among the Shuo Juchuan $A , $B can all be characters, also can all be binary-coded decimal or
It all is the sign indicating number of certain other form.
Example 2 array dislocation comparator devices realize that a service data string data number is can
The comparative approach of change situation.
[U $A=A1 A2 A3 A4 A5 A6 A7 A8
$B=B1 B2 B3 B4 B5 B6 B7 B8
Control signal NUM specifies the number of valid data among the $B, can only be 1 of B1, or
Be 2 of B1 B2, or 3 of B1B2B3 ..., or
8 of B1B2B3B4B5B6B7B8.
This moment implementation method the device block diagram see accompanying drawing 9, it comprise array dislocation comparing apparatus and
Controller.
Each operand pair relationhip is as follows in the array dislocation comparing apparatus:
Row 12345678
$A: A1 A2 A3 A4 A5 A6 A7 A8
Row 1 B1 B2 B3 B4 B5 B6 B7 B8
2 B1 B2 B3 B4 B5 B6 B7
3 B1 B2 B3 B4 B5 B6
$B:4 B1 B2 B3 B4 B5
5 B1 B2 B3 B4
6 B1 B2 B3
7 B1 B2
8 B1
This moment, array comparator configuration form was seen accompanying drawing 10, because the data number of $A is not more than n,
M=8 in the accompanying drawing 10 in the array comparer of n=8, has the some parts comparer to omit,
The compare operation that walks abreast of each comparer produces comparative result S11-S18, S21-S27 ...,
S81
Sij=1 is then more equal; Sij=0, then more unequal (i=1,2 ..., 8; J=1-8)
Whole comparative results that comparer produces are connected to the input end of controller.
Controller carries out masking operation to Sij,
Output Pij=Sij (significant character in this comparer B end input data datas $B)
(i=1,2,....,8;j=1-8)
Pij=1 (idle character in this comparer B end input data datas $B)
In the arbitrary capable i that comprises the whole significant characters of $B in each comparer input, satisfy this row
In each comparer comparative result all equal Bao Han $B among 1 o'clock , $A.
Example 3 is used array dislocation comparing apparatus and is realized the character string continuous-query
By inquiry string is character file, its length>n; The character number of inquiry string
It can be any positive integer of 1 to n.
Control signal NUM points out the significant character number of inquiry string, the inquiry word of operation
Symbol string $B character number also is n, and wherein except effective character, all the other are not for having
The character of imitating.
The block diagram of character string continuous-query device is seen accompanying drawing 11.
Because comparing unit limited length, to in long character string file, retrieve 1 inquiry string, just can only intercept in regular turn be equivalent in the character file comparer length have n number of characters by Cha Xunzifuchuan $A, be taken into and equate in the array dislocation comparer relatively.
In the array dislocation comparer in accompanying drawing 11, row, column comparator arrangement mode is seen accompanying drawing 12.
Example n=8 m=4
By inquiry string is $A=A1A2......A16A17......
Inquiry string inquiry string $B=B1B2B3B4B5B6B7B8 (significant character keep left side)
The array dislocation matching ratio is, and is as follows:
First pass
May produce only some row of coupling in the period 1, in remaining row, because it is more imperfect that inquiry string is participated in, can not produce complete coupling, but can produce part matching ratio result, therefore the comparative result of dotted line right side part generation will be preserved in this cycle, in second round, may produce complete coupling except part row, also may in remaining row, a part (dotted line left side) carry out complete coupling differentiation with the result who is saved in the 1st cycle, also produce result's (same section when dotted line right side and period 1) and being preserved of part matching ratio simultaneously, do complete string matching together for following one-period and differentiate, mate differentiation with same rule so always and finish up to the file intercepting.In first pass,, then also need carry out second time matching ratio if fail to realize match query.
Be the corresponding individual character position of the m that moves to right (being 4 in the example) during by the position relative first pass of inquiry string of inquiry string with the first pass difference second time.The part matching result that each cycle is saved is less relatively.
Each cycle is all heavily covered same operation in the first, two time, all can carry out m complete character string coupling and differentiate, and has realized the query manipulation that the multicycle is continuous like this.
In general the pass that will carry out be n/m (decimal is taken into) when m=n, only need just can finish the match query comparison of part in full 1 time.
If m=n=8, it is as follows that mate comparable situation this moment:
By inquiry string inquiry string $A:A1 A2......A16 A17......
Inquiry string inquiry string $B:B1 B2......B7B8
Figure C9810409100191
Dotted portion is differentiated for striding the cycle coupling, and the comparative result that the dotted line right side branch in the 1st cycle is illustrated in the comparer must be preserved; The dotted line left part polling character in the 2nd cycle must carry out the differentiation of complete character string coupling with the part comparative result that the 1st cycle preserved at the comparative result of comparer, and dotted line right side branch relatively result must be preserved.
The 1st cycle of $A character string intercepting A1, the comparison (seeing accompanying drawing 13) that misplaces of A2......A8 and $B character string, the 2nd Zhou Qi $A intercepts A9, the A1 of A10......A16 replacement period 1, the comparison that misplaces of A2......A8 and $B character string.
CPR is the character comparer in accompanying drawing 12, the accompanying drawing 13
S11~S88 represents that for the comparative result Sij=1 of each character comparer character is more equal, and Sjj=0 represents that character is more unequal.
The part comparative result in each cycle needs to preserve (seeing accompanying drawing 14)
REG-n is n bit register (n=1-7) among the figure
Output signal and input signal relation are as follows in the accompanying drawing 14:
CPn CPn+1
Input Output
Sij S`ij
ij=22-88
The output S11-S88 of array comparer is with the output S ` 22-S ` 88 of the partial results register input data as controller.Control signal NUM and the SIG that instruction provides accepted in two other control input end of controller, and the shielding of input data process controller selects to handle back generation 8 * 8 data P11-P88 (seeing accompanying drawing 15).
Output signal and input signal logical relation are as follows in the accompanying drawing 15:
Row 1 P11=S11+M1
P12=S12+M2
P18=S18+M8
Row 2 P21=S21+M8
P22=(M8·S22+ M8·S`22·SIG)+M1
P28=(M8·S28+ M8·S`28·SIG)+M7
Row 3 P31=S31+M7
P32=S32+M8
P33=(M7·S33+ M7·S`33·SIG)+M1
P38=(M7·S38+ M7·S`38·SIG)+M6
Row 8 P81=S81+M2
P87=S87+M8
P88=(M2·S88+ M2·S`88·SIG)+M1
M1---M8 and control signal NUM relation is as follows in the following formula, wherein the number of significant character in the N wherein $B character string.
NUM N M1 M2 M3 M4 M5 M6 M7 M8
000 001 010 011 100 101 110 111 1 2 3 4 5 6 7 8 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
P11-P88 produces output Q as a result after character string comparative result arbiter is handled, when Q is true, indicate this successful inquiring; When Q is false, indicate this inquiry unsuccessful.Another output result who produces be CNO, and it is indicated when this successful inquiring, and the position of the row of the 1st character correspondence in the array comparer of inquiry string indicates correspondence by the character position in the inquiry string with this.Another output result be LAST, and its indication is in continuous-query when success, and the position of CNO refers to that this cycle still goes up the row number of one-period, and LAST is very, refers to one-period; LAST is false, refers to this cycle.(seeing accompanying drawing 16).
Output signal and input signal logical relation are as follows in the accompanying drawing 16:
Q=LE1+LE2+LE3+LE4+LE5+L6+LE7+LE8
CNO<3>=CLE5+CLE6+CLE7+CLE8
CNO<2>=CLE3+CLE4+CLE7+CLE8
CNO<1>=CLE2+CLE4+CLE6+CLE8
In 3 of CNO the right be the 1st left side be the 3rd respectively note do CNO<1, CNO<2 and CNO<3.
LAST=(N=2)LE8+(N=3)(LE7+LE8)+(N=4)(LE6+LE7+LE8)+(N=5)
(IE5+LE6+LE7+LE8)+(N=6)(LE4+LE5+LE6+LE7+LB8)+(N
=7)(LE3+LE4+LE5+LE6+LE7+LE8)+(N=8)(LE2+LE3+LE4+
LE5+LE6+LE7+LE8)
In the following formula
LEi=Pi1·Pi2·Pi3·Pi4·Pi5·Pi6·Pi7·Pi8 (i=1-8)
CLEj=SIG·CONj+ SIG·SGLj (j=1-8)
SGL1=LE1
SGL2= LE1·LE2
SGL3= LE1· LE2·LE3
SGL4= LE1·...........· LE3·LE4
SGL5= LE1·...........· LE4·LE5
SGL6= LE1·...........· LE5·LE6
SGL7= LE1·...........· LE6·LE7
SGL8= LE1·...........· LE7·LE8
CON1=(N=1)·LE1+(N=2)·LE1· LE8+(N=3)·LE1· LE7· LE8+(N=4)·
LE1· LE6· LE7· LE8+(N=5)·LE1· LE5· LE6· LE7· LE8+(N=6
)·LE1· LE4· LE5· LE6· LE7· LE8+(N=7)·LE1· LE3· LE4·
LE5· LE6· LE7· LE8+(N=8)·LE1· LE2· LE3· LE4· LE5· LE6
· LE7· LE8
CON2=(N=1)· LE1·LE2+(N=2)· LE1·LE2· LE8+(N=3)· LE1·LE2·
LE7· LE8+(N=4)· LE1·LE2· LE6· LE7· LE8+(N=5)· LE1·LE2
· LE5· LE6· LE7· LE8+(N=6)· LE1·LE2· LE4· LE5· LE6· LE7
· LE8+(N=7)· LE1·LE2· LE3· LE4· LE5· LE6· LE7· LE8+(N=
8)·LE2
CON3=(N=1)· LE1· LE2·LE3+(N=2)· LE1· LE2·LE3· LE8+(N=3)·
LE1· LE2·LE3· LE7· LE8+(N=4)· LE1· LE2·LE3· LE6· LE7·
LE8+(N=5)· LE1· LE2·LE3· LE5· LE6· LE7· LE8+(N=6)· LE1
· LE2·LE3· LE4· LE5· LE6· LE7· LE8+(N=7)·LE3+(N=8)·
LE2·LE3
CON8=(N=1)· LE1· LE2· LE3· LE4· LE5· LE6· LE7·LE8+(N=2)·LE
8+(N=3)· LE7·LE8+(N=4)· LE6· LE7·LE8+(N=5)· LE5· LE6
· LE7·LE8+(N=6)· LE4· LE5· LE6· LE7·LE8+(N=7)· LE3·
LE4· LE5· LE6· LE7·LE8+(N=8)· LE2· LE3· LE4· LE5· LE6
· LE7·LE8
Those skilled in the art is easy to derive the logical expression of CON4-CON7 according to this principle of device and method.
Use the program circuit of character string inquiry unit:
Divide disposable inquiry and multicycle continuous-query, their application flows is seen accompanying drawing 17 and accompanying drawing 18 respectively.
As shown in figure 17, at first comprise a query statement in program, comprise control information NUM, SIG in the instruction, by inquiry string address and inquiry string address, owing to be disposable inquiry, SIG should equal ' 0 '.System carries out this query statement then, obtain one as a result Q indicate whether success of this inquiry, if Q=1 represents successful inquiring, at this moment can also obtain the information of another one CNO indication as a result location, this is that disposable successful inquiring finishes; As if Q=0, the expression inquiry is unsuccessful, and this is the unsuccessful end of disposable inquiry, and query statement is finished.
As shown in figure 18, at first in program, comprise a query statement, comprise control information NUM, SIG in the instruction, by inquiry string address and inquiry string address, owing to be that multicycle continuous-query SIG should equal ' 1 ' (SIG-0 in the query statement for the first time), system carries out this query statement then, obtain one as a result Q indicate whether success of this inquiry, if Q=1, the expression successful inquiring, can also obtain the information of two other location of CNO and LAST indication as a result this moment, this is that continuous-query operate successfully end; If Q=0, represent that this inquiry is unsuccessful, then answer in the modify instruction by inquiry string address (actual should be the address n that adds deduct last time), and then carry out this new query statement, circulation repetitiousness like this, until Q=1 as a result occurring, continuous-query successfully finishes; Or amended inquiry string address exceeds the storage space of inquiry string, and this kind situation is unsuccessful for the inquiry of inquiry string total length, and the continuous-query operation is unsuccessful to be finished.

Claims (11)

1, a kind of array dislocation comparing apparatus is used for the comparison that the multirow of two groups of serial datas of disposable realization staggers data, and this array dislocation comparing apparatus comprises:
The capable comparer of m has n comparer in every row, thereby has constituted the array comparer of n * m, wherein
Each comparer has a first input end, second input end and an output terminal, and the first input end of the comparer in every row links together; And each data of first group of serial data are connected on first input end respectively, and second group of serial data is connected on second input end in stagger one mode of every row.
2, array dislocation comparing apparatus as claimed in claim 1 is characterized in that described n=8, described m=8.
3, array dislocation comparing apparatus as claimed in claim 1 is characterized in that described comparer is the ASCII character comparer.
4, array dislocation comparing apparatus as claimed in claim 1 is characterized in that described comparer is the binary-coded decimal comparer.
5, a kind of character string inquiry unit, be used in the monocycle from one include n character another includes the inquiry string of 1 to n character by the inquiry string retrieval, it is characterized in that comprising:
An array dislocation comparing apparatus as claimed in claim 1;
A partial results register is used for the part comparative result of above-mentioned array dislocation comparing apparatus is deposited;
A string comparative result arbiter is used for the result after the controller processing is handled, and the result is differentiated in final output; With
The control requirement of the control signal that provides according to instruction is provided a controller, gives the comparative result arbiter again after the output data of the comparative result of each comparer in the above-mentioned array dislocation comparing apparatus and partial results register is handled.
6, device as claimed in claim 5 is characterized in that when by not enough n of polling character, and it is individual to complement to n with null character (NUL).
7,, it is characterized in that described control signal comprises the indication (NUM) of character number in the described inquiry string of indication as the device of claim 5 or 6.
8, want 7 device as right, it is characterized in that described control signal comprises that also one shows that the operation of this cycle is the control signal (SIG) of disposable inquiry or multicycle continuous-query.
9, device as claimed in claim 5, the locating information when the differentiation result who it is characterized in that described final output comprises indication that inquiry is whether successful and successful inquiring.
10, a kind of device with claim 5 comes the method for realization inquiry in disposal system, it is characterized in that comprising step:
1) sends out a query statement;
2) check whether this inquiry is successful;
3) if this inquiry is unsuccessful, then revise in the query statement by the address of inquiry string, and repeating step 1; If this successful inquiring then arrives step 4;
4) get locating information, described locating information comprise the expression row of inquiry string in the array comparer the position information (CNO) and represent that described position refers to this cycle and still goes up the information (LAST) of the row number of one-period.
11,, comprise in the wherein said query statement form as the method for claim 10:
The control signal of character number (NUM) in the inquiry string,
Indication is the control signal (SIG) of monocycle or multicycle inquiry,
By the inquiry string address,
The inquiry string address.
CN98104091A 1998-02-10 1998-02-10 Array dislocation comparison device and method for realizing query Expired - Lifetime CN1092362C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN98104091A CN1092362C (en) 1998-02-10 1998-02-10 Array dislocation comparison device and method for realizing query

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN98104091A CN1092362C (en) 1998-02-10 1998-02-10 Array dislocation comparison device and method for realizing query

Publications (2)

Publication Number Publication Date
CN1226025A CN1226025A (en) 1999-08-18
CN1092362C true CN1092362C (en) 2002-10-09

Family

ID=5218164

Family Applications (1)

Application Number Title Priority Date Filing Date
CN98104091A Expired - Lifetime CN1092362C (en) 1998-02-10 1998-02-10 Array dislocation comparison device and method for realizing query

Country Status (1)

Country Link
CN (1) CN1092362C (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107220028B (en) * 2017-05-24 2020-05-29 上海兆芯集成电路有限公司 Accelerated compression method and apparatus using the same

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5073864A (en) * 1987-02-10 1991-12-17 Davin Computer Corporation Parallel string processor and method for a minicomputer
US5377349A (en) * 1988-10-25 1994-12-27 Nec Corporation String collating system for searching for character string of arbitrary length within a given distance from reference string
JPH0892477A (en) * 1994-09-22 1996-04-09 Du Pont Kk Crystalline aromatic polyamide resin composition
US5511189A (en) * 1991-04-04 1996-04-23 Mitsubishi Denki Kabushiki Kaisha Data sorting apparatus capable of detecting completion of data sorting early and sorting method therefor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5073864A (en) * 1987-02-10 1991-12-17 Davin Computer Corporation Parallel string processor and method for a minicomputer
US5377349A (en) * 1988-10-25 1994-12-27 Nec Corporation String collating system for searching for character string of arbitrary length within a given distance from reference string
US5511189A (en) * 1991-04-04 1996-04-23 Mitsubishi Denki Kabushiki Kaisha Data sorting apparatus capable of detecting completion of data sorting early and sorting method therefor
JPH0892477A (en) * 1994-09-22 1996-04-09 Du Pont Kk Crystalline aromatic polyamide resin composition

Also Published As

Publication number Publication date
CN1226025A (en) 1999-08-18

Similar Documents

Publication Publication Date Title
CN1120425C (en) Memory controller and memory control system
CN1320769C (en) Coder, decoder and data transfer systems
CN1091906C (en) Pattern recognizing method and system and pattern data processing system
CN1221909C (en) Method for assigning job in parallel processing method and parallel processing method
CN1126053C (en) Documents retrieval method and system
CN1862522A (en) Data checking apparatus and checking method
CN1801183A (en) Information processing apparatus and method, and program
CN1228866A (en) Speech-processing system and method
CN1201519C (en) Data consistance checking device and data sorting device
CN1447261A (en) Specific factor, generation of alphabetic string and device and method of similarity calculation
CN1776621A (en) Program converting method
CN1092362C (en) Array dislocation comparison device and method for realizing query
CN100347668C (en) Instruction mapping device
CN1348559A (en) Portable character input device
CN1093965C (en) On-line character recognition method and apparatus thereof
CN1912830A (en) Method of operating interface of definition to object mould
CN1160635C (en) Flag-controlled arbitration of reguesting agents
CN1251075C (en) Programe generating device
CN1198214C (en) Method of access arbitrary bit range data between different platforms
CN1303211C (en) Oligonucleotide series for calculation of DNA chip
CN1068127C (en) Text data processing method and device
CN1658229A (en) Optical sensing apparatus to navigate position and a navigation method thereof
CN1296207A (en) Simple five-stroke Chinese coding method and keyboard thereof
CN1862463A (en) Ten stroke head and tail element code input method
CN1691745A (en) Data match detecting apparatus, data match judging apparatus and data selecting apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
REG Reference to a national code

Ref country code: HK

Ref legal event code: GR

Ref document number: 1051314

Country of ref document: HK

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20100205

Address after: No. three, 189 floor, new complex building, maintenance group 3, red pass, Beijing, Haidian District: 100091

Co-patentee after: Beijing Duosi Technology Development Co., Ltd.

Patentee after: Limited by Share Ltd, Beijing tech Industrial Park, Limited by Share Ltd

Co-patentee after: Beijing tianhongyi Network Technology Co., Ltd.

Address before: No. 1905, box 313, Beijing, building 3, post code: 100091

Patentee before: Duosi Science & Technology Industry Field Co., Ltd., Beijing

PP01 Preservation of patent right

Effective date of registration: 20121018

Granted publication date: 20021009

RINS Preservation of patent right or utility model and its discharge
PD01 Discharge of preservation of patent

Date of cancellation: 20130418

Granted publication date: 20021009

RINS Preservation of patent right or utility model and its discharge
PP01 Preservation of patent right

Effective date of registration: 20130530

Granted publication date: 20021009

RINS Preservation of patent right or utility model and its discharge
PD01 Discharge of preservation of patent

Date of cancellation: 20131130

Granted publication date: 20021009

RINS Preservation of patent right or utility model and its discharge
ASS Succession or assignment of patent right

Owner name: DUOSI SCIENCE + TECHNOLOGY INDUSTRY FIELD CO., LTD

Free format text: FORMER OWNER: BEIJING WISDOM TECHNOLOGY DEVELOPMENT CO., LTD. BEIJING T-MACRO NETWORK TECHNOLOGY CO., LTD.

Effective date: 20141010

Owner name: NANSI SCIENCE AND TECHNOLOGY DEVELOPMENT CO LTD, B

Free format text: FORMER OWNER: DUOSI SCIENCE + TECHNOLOGY INDUSTRY FIELD CO., LTD., BEIJING

Effective date: 20141010

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20141010

Address after: 100091, Beijing Haidian District red mountain Yamaguchi 3 maintenance group new building 189, a layer

Patentee after: Nansi Science and Technology Development Co., Ltd., Beijing

Patentee after: Duosi Science & Technology Industry Field Co., Ltd., Beijing

Patentee after: Beijing tianhongyi Network Technology Co., Ltd.

Address before: 100091, No. three, building 189, new complex building, maintenance group 3, red pass, Haidian District, Beijing

Patentee before: Duosi Science & Technology Industry Field Co., Ltd., Beijing

Patentee before: Beijing Duosi Technology Development Co., Ltd.

Patentee before: Beijing tianhongyi Network Technology Co., Ltd.

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160225

Address after: 100095, room 108, building G, quiet core garden, No. 25, North Hollywood Road, Beijing, Haidian District

Patentee after: Beijing Duosi security chip technology Co. Ltd.

Address before: 100091, Beijing Haidian District red mountain Yamaguchi 3 maintenance group new building 189, a layer

Patentee before: Nansi Science and Technology Development Co., Ltd., Beijing

Patentee before: Duosi Science & Technology Industry Field Co., Ltd., Beijing

Patentee before: Beijing tianhongyi Network Technology Co., Ltd.

DD01 Delivery of document by public notice

Addressee: Zhou Yan

Document name: Notification of Passing Examination on Formalities

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160713

Address after: 100091, Beijing Haidian District red mountain Yamaguchi 3 maintenance group new building 189, a layer

Patentee after: Nansi Science and Technology Development Co., Ltd., Beijing

Address before: 100195, room 108, building G, quiet core garden, No. 25, North Hollywood Road, Beijing, Haidian District

Patentee before: Beijing Duosi security chip technology Co. Ltd.

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160720

Address after: 100195, room 109, block G, Beijing quiet garden, 25 North Road, North Hollywood village, Beijing, Haidian District

Patentee after: Beijing Duosi technical services Co. Ltd.

Address before: 100091, Beijing Haidian District red mountain Yamaguchi 3 maintenance group new building 189, a layer

Patentee before: Nansi Science and Technology Development Co., Ltd., Beijing

CX01 Expiry of patent term
CX01 Expiry of patent term

Granted publication date: 20021009