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.
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
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.