Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
The look-up method look-up table used providing in the embodiment of the present invention is that two-dimensional look-up table splits and forms according to (even, even), (even, strange), (strange, even) and (strange, strange) according to the parity of 2-d index.4 described look-up tables that fractionation forms are stored in respectively in 4 RAM, the address addr that stores data in the look-up table of described 4 RAM meets following formula: addr=((a > > 1) * k+b > > 1), wherein (a, b) be described 2-d index, a > > 1 and b > > 1 represent that a and b move to right 1, and k is the half of described two look-up table width values.
Suppose to have 6*6 two-dimensional look-up table table 1, as follows:
(a,b) |
|
|
|
|
|
|
|
0,0 |
0,1 |
0,2 |
0,3 |
0,4 |
0,5 |
|
1,0 |
1,1 |
1,2 |
1,3 |
1,4 |
1,5 |
|
2,0 |
2,1 |
2,2 |
2,3 |
2,4 |
2,5 |
|
3,0 |
3,1 |
3,2 |
3,3 |
3,4 |
3,5 |
|
4,0 |
4,1 |
4,2 |
4,3 |
4,4 |
4,5 |
|
5,0 |
5,1 |
5,2 |
5,3 |
5,4 |
5,5 |
The 2-d index that wherein (a, b) is two-dimensional look-up table, according to existing two-dimensional seek method, (a of input, b) in this two-dimensional look-up table, search, can find the data in the address that in described look-up table, (a, b) is corresponding.
By above-mentioned two-dimensional look-up table, according to a, the parity of b splits, and as shown in Figure 1 by a, b is that i.e. (a, the b) of even number is that (even, even) is divided into a look-up table, is stored in RAM00.Be that (even, strange), (strange, even) and being divided in respectively in different look-up tables and according to its parity of (strange, strange) are stored in respectively in RAM01, RAM10 and RAM11 equally to (a, b).So far, two-dimensional look-up table has been split into the one dimension table shown in 4 Fig. 1, be stored in 4 different RAM.The address addr that stores data in the look-up table of described 4 RAM meets following formula: addr=((a > > 1) * k+b > > 1), wherein (a, b) be described 2-d index, a > > 1 and b > > 1 represent that a and b move to right 1, and k is that described two-dimensional look-up table is wide
half.The bivariate table that here bivariate table shown in table 1 is 6*6, the width value of this bivariate table is 6, therefore k=0.5*6=3.Suppose (a, b)=(2,4), (2,4) corresponding data are stored in the look-up table in RAM00, address addr=((a > > 1) * k+b > > 1)=((2 > > 1) * 3+4 > > 1)=1*3+2=5.Be that index is that (2,4) corresponding data are stored in the address 5 of RAM00.
From the above mentioned, the look-up table of using in the embodiment of the present invention has been formed and stored in RAM.According to this look-up table, the embodiment of the present invention provides a kind of look-up method, as shown in Figure 2, said method comprising the steps of:
201, input index is carried out to add-one operation and obtain adding 1 input index.
User is carrying out one dimension while searching, and the numeral that user need to search by terminal input is correspondingly equivalent to input one dimension index S_i at table look-up device.Now, the b in the index (a, b) of the look-up table of table look-up device shown in can Fig. 2 is set to 0, only index of reference a, now a=S_i.After described table look-up device acquisition input index S_i, can carry out add-one operation to described input index S_i and obtain adding 1 input index S_i_1.
If user will carry out two-dimensional seek, two numerals that user need to search by terminal input, correspondence is equivalent to user at table look-up device and in table look-up device, inputs 2-d index (i, j).After described table look-up device acquisition input index (i, j), can carry out add-one operation to described input index (i, j) and obtain adding 1 input index (i, j+1), (i+1, j) and (i+1, j+1).
202, according to described input index with add 1 input index selection and obtain the index address in corresponding RAM.
Optionally, described table look-up device can and add 1 input index selection according to described input index and obtains corresponding virtual address after obtaining the input index of one dimension and adding 1 input index; Then, calculate the index address in RAM corresponding to described virtual address according to described virtual address.
Obtaining the input index of one dimension and adding after 1 input index S_i and S_i_1, table look-up device can, according to described S_i and S_i_1, select to obtain described S_i and virtual address corresponding to S_i_1.Obtaining after the virtual address that one dimension index is corresponding, described table look-up device can calculate the index address in RAM corresponding to described virtual address by described virtual address according to flat address computing formula; Wherein, the described virtual address that S_i or S_i_1 are corresponding is xxh, xx represents corresponding RAM, described flat address computing formula is: addr1=h > > 1, addr1 is S_i or index address corresponding to S_i_1, and h > > 1 represents that h moves to right one.
Optionally, as shown in Figure 3, for the system of selection of a kind of one dimension virtual address, S_i[0 in figure] represent the minimum bit value of S_i, S_i_1[0] the minimum bit value of expression S_i_1, if S_i is even number, S_i[0]=0, the virtual address that selection obtains is 00S_i and 01S_i, S_i_1[0]=1, selecting the virtual address obtaining is 10S_i_1 and 11S_i_1.In like manner, if S_i is odd number, S_i[0]=1, selecting the virtual address obtaining is 00S_i_1 and 01S_i_1, S_i_1[0]=0, selecting the virtual address obtaining is 10S_i, and 11S_i.Selection here obtains S_i and described virtual address xxh corresponding to S_i_1 is 00S_i and 01S_i and 10S_i_1 and 11S_i_1.Wherein the front two xx of xxh represents corresponding RAM, i.e. address in the corresponding RAM00 of 00S_i, the address in 01S_i, 10S_i_1 and 11S_i_1 difference corresponding RAM01, RAM10 and RAM11.Can calculate the index address addr1=h > > 1=S_i > > 1 in RAM00 by 00S_i, in like manner, can calculate the index address addr1=h > > 1=S_i > > 1 in RAM01 by 01S_i, calculate the index address addr1=h > > 1=S_i 1 > > 1 in RAM10 by 10S_i_1, calculate the index address addr1=h > > 1=S_i_1 > > 1 in RAM011 by 11S_i_1.
Obtaining two-dimentional input index and adding 1 input index (i, j), (i, j+1), (i+1, j) and (i+1, j+1) after, table look-up device can be according to described (i, j), (i, j+1), (i+1, j) and (i+1, j+1) selects to obtain corresponding virtual address.Obtaining after the virtual address that 2-d index is corresponding, described table look-up device calculates the index address in RAM corresponding to described virtual address according to two-dimensional address computing formula by described virtual address, wherein, (i, j), (i, j+1), (i+1, or (i+1 j), j+1) corresponding described virtual address is (xxm, xxn), xx represents corresponding RAM, described two-dimensional address computing formula is: addr2=((m > > 1) * k+n > > 1), wherein addr2 is described (i, j), (i, j+1), (i+1, or (i+1 j), j+1) corresponding index address, m > > 1 and n > > 1 represent that m and n move to right 1, k is the half of described two-dimensional look-up table width value.
Optionally, as shown in Figure 4, be a kind of two-dimensional virtual address selection method, the X[0 shown in figure] represent the minimum bit value of X, X_1 represents that X adds 1, if i and j are odd number, (i[0], j[0])=(1,1) choose (i_1 by selector switch, j_1) virtual address, obtaining is (00i_1,00j_1).In like manner, and (i[0], j_1[0])=(1,0) virtual address that selection obtains is (01i_1,01j), and (i_1[0], j[0])=(0,1) virtual address that selection obtains is (10i, 10j_1), and (i_1[0], j_1[0])=(0,0) virtual address that selection obtains is (111,11j).Certainly, i and j are that even number or one also can choose virtual address by the selector switch described in Fig. 4 for one of odd number for even number, here no longer describe in detail.Table look-up device is selecting to obtain (i, j), (i, j+1), (i+1, j) with (i+1, j+1) virtual address (xxm, xxn) is (00i_1,00j_1), (01i_1,01j), (10i_1,10j_1) with (111,11j), wherein (xxm, xxn) xx in represents corresponding RAM, i.e. (00i_1,00j_1), (01i_1,01j), (10i, address 10j_1) and in (111,11j) difference corresponding RAM00, RAM01, RAM10 and RAM11.Can be by virtual address (00i_1,00j_1) calculate index address addr2=((m > > 1) * k+n > > 1)=((i_1 > > 1) the * k+j_1 > > 1) in RAM00, in like manner, can be by (01i_1,01j) calculate index address addr2=((m > > 1) * k+n > > 1)=((i_1 > > 1) the * k+j > > 1) in RAM01, by (101,10j_1) calculate index address addr2=((m > > 1) * k+n > > 1)=((i > > 1) the * k+j_1 > > 1) in RAM10, by (111,11j) calculate index address addr2=((m > > 1) * k+n > > 1)=((i > > 1) the * k+j > > 1) in RAM011.
203, search according to described index address the look-up table of storing in the RAM of described correspondence, export the data in index address described in the look-up table of RAM of described correspondence.
Look-up table described here is to be split and formed by two-dimensional look-up table.In step 203, calculate after described index address, table look-up device can be searched the look-up table of storing in described corresponding RAM according to the index address addr1 of described correspondence, exports the data in index address described in the look-up table of described corresponding RAM; Or search the look-up table of storing in described corresponding RAM according to the index address addr2 of described correspondence, export the data in index address described in the look-up table of described corresponding RAM.
204, according to described input index and add the order of the data of exporting in corresponding RAM described in 1 input index selection.
Carrying out one dimension while searching, carrying out when searching, described table look-up device has been exported the data in index address in each RAM in step 204, obtaining after these data, table look-up device can be according to the order of the data of exporting in the table number of input and described S_i and the described corresponding RAM of S_i_1 selection; Wherein, select corresponding RAM according to the table number of described input, the order of the data of exporting in RAM corresponding to described S_i is the first, and the order of the data of exporting in RAM corresponding to described S_i_1 is second.
Optionally, as shown in Figure 5, a kind of one dimension output data selecting method, still suppose that S_i is even number here, the data of output have the data of address S_i > > 1 in RAM00 and RAM01, and the data of address S_i_1 > > 1 in RAM10 and RAM11, search device here and can input a table number, the data of exporting in each RAM are carried out to a selection, optionally, if being 0, described table number selects the data of exporting in RAM00 and RAM10, if being 1, described table number selects the data of exporting in RAM01 and RAM11.Suppose that table number is 0 here, because S_i is even number, S_i[0]=0, the order of the data of exporting in its corresponding RAM-RAM00 is the first, described S_i_1[0] order of the data exported in=1 RAM10 is second.If certainly S_i is odd number, S_i[0]=1, the order of the data of exporting in RAM10 is the first, S_i_1[0]=0, RAM, the order of the data of output is second in 00.
In the time carrying out two-dimensional seek, described table look-up device has been exported the data in index address in each RAM in step 204, obtaining after these data, table look-up device is according to described (i, j), (i, j+1), (i+1, j) and (i+1, j+1) selects the order of the data of exporting in described corresponding RAM; Wherein, described (i, the order of the data of j) exporting in corresponding RAM is first, described (i, the order of the data of j+1) exporting in corresponding RAM is the second, and the order of the data of exporting in the RAM of (i+1, j) correspondence is the 3rd, the order of the data of exporting in the RAM of described (i+1, j+1) correspondence is the 4th.
Optionally, as shown in Figure 6, be a kind of two dimension output data selecting method, still suppose that i and j are odd number here, (i[0], j[0])=(1,1) choose RAM11 by selector switch, the order of the data of exporting in RAM11 is first.In like manner, and (i[0], j_1[0])=(1,0) choose RAM10 by selector switch, the order of the data of exporting in RAM10 is the second, and (i_1[0], j[0])=(0,1) choose RAM01 by selector switch, the order of the data of exporting in RAM01 is the 3rd, and (i_1[0], j_1[0])=(0,0) choose RAM00 by selector switch, the order of the data of exporting in RAM00 is the 4th.Certainly, to be all even number or one also can select by the selector switch described in Fig. 6 the output order of a RAM for one of odd number for even number for i and j, here no longer describes in detail.
205, the data of exporting in corresponding RAM are carried out to interpolation according to described order and obtain final output valve.
The data of exporting in corresponding RAM are carried out to two-dimensional interpolation according to described order and obtain final output valve.If suppose, S_i is even number, and table look-up device carries out one dimension interpolation by the data of exporting in RAM00 and RAM10 successively and obtains final output valve.
The data of exporting in corresponding RAM are carried out to two-dimensional interpolation according to described order and obtain final output valve.If still suppose, i and j are odd number, and table look-up device carries out two-dimensional interpolation by the data of exporting in RAM11, RAM10, RAM01 and RAM00 successively and obtains final output valve.
Concrete, according to said method, if will carrying out one dimension, user searches, input one dimension index S_i=2, add 1 calculating, add 1 input index S_i_1=3, by the virtual address system of selection shown in Fig. 3, selecting the virtual address obtaining is 002,012,103,113.Then calculate the index address of corresponding RAM, the index address addr1=S_i > > 1=2 > > 1=1 of 002 corresponding RAM00, the in like manner index address addr1=S_i > > 1=2 > > 1=1 of 012 corresponding RAM01, the index address addr1=S_i_1 > > 1=3 > > 1=1 of 103 corresponding RAM10, the index address addr1=S_i_1 > > 1=3 > > 1=1 of 113 corresponding RAM11.Then search the data of address 1 in output RAM00, the data of address 1 in RAM01, the data of address 1 in RAM10, the data of address 1 in RAM11.According to the output data selecting method shown in Fig. 5, if table number is 0 data of selecting RAM00 and RAM10 output, and taking the data exported in RAM00 as first data, the data of exporting in RAM10 are the final output valve that arrives that second data carried out one dimension interpolation.
If carry out two-dimensional seek according to said method, user inputs two dimension input index (i, j)=(1,3), add 1 calculating to adding 1 input index (Isosorbide-5-Nitrae), (2,3), (2,4).By the virtual address system of selection described in Fig. 4, selecting the virtual address obtaining is (002,004), (012,013), (101,104) and (111,113).Then calculate the index address in the corresponding RAM of virtual address according to formula, (002,004) the index address addr2=in corresponding RAM00 ((2 > > 1) * 3+4 > > 1)=5, (012,013) index address 4 in corresponding RAM01, (101,104) index address 1 in index address 2 and (111,113) the corresponding RAM 11 in corresponding RAM10.Then search the data in address 5 in output RAM00, the data in RAM01 in address 4, the data in RAM10 in address 2, the data in RAM11 in address 1.Be finally first data by the output data selecting method shown in Fig. 6 according to the data of exporting in RAM11, in RAM 10, the data of output are second data, the data of exporting in RAM01 are the 3rd data, and the data of exporting in RAM00 are the final output valve that arrives that the 4th data are carried out two-dimensional interpolation.
It should be noted that, the interpolation algorithm of applying while carrying out one dimension interpolation and two-dimensional interpolation in the present invention is existing interpolation algorithm, as gets the interpolation algorithms such as arithmetic mean value.Application said method, carrying out one dimension while tabling look-up, by two output data finding carry out interpolation to final output valve; Carrying out two dimension while tabling look-up, by four output data finding carry out interpolation to final output valve; Like this can be more accurate than prior art.Here we can illustrate, what suppose look-up table storage is the data of searching of cosine-algorithm, user wants to search the value of cos0.5, therefore user inputs 0.5 and searches, if apply existing one dimension look-up method, it is input index 0 in look-up table time that user inputs 0.5 correspondence, and final is cos0=1 to output valve; If apply look-up method provided by the invention, it is input index 0 in look-up table time that user inputs 0.5 correspondence, and final is cos0+cos1=(1+cos 1)/2 to output valve; More accurate than existing lookup method.
Above-mentioned look-up method can be applied in the place that the arbitrary needs in communication system are tabled look-up, can a compatible peacekeeping two dimension search.For example, can be applied in digital pre-distortion system, in prior art, digital pre-distortion system in legacy network for be single signal frequency range, can apply (the Digital Pre-Distortion based on DPD, digital pre-distortion) the one dimension look-up table of algorithm carries out digital pre-distortion processing to one-segment signal, and along with the development of the communication technology, existing TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, TD SDMA) and LTE (Long Term Evolution, Long Term Evolution) normal employing two-band transmission in network, the digital pre-distortion system is here applied based on DPD (Digital Pre-Distortion, digital pre-distortion) the one dimension look-up table of algorithm carries out digital pre-distortion processing to one-segment signal.If the look-up method that provides of the application embodiment of the present invention here both can meet the application demand of two-band, application that again can compatible with single frequency range.
The embodiment of the present invention also provides a kind of table look-up device, for completing above-mentioned look-up method, as shown in Figure 7, described table look-up device comprises: add 1 computing unit 701, acquisition unit, address 702, searches output unit 703, order selected cell 704, interpolation computing unit 705.
Add 1 computing unit 701, obtain adding 1 input index for input index being carried out to add-one operation.
Carry out one dimension while searching when user inputs index S_i, described in add 1 computing unit 701, obtain adding 1 input index S_i_1 specifically for input index S_i being carried out to add-one operation.In the time that user inputs index (i, j) and carries out two-dimensional seek, described in add 1 computing unit 701, carry out add-one operation and obtain adding 1 input index (i, j+1), (i+1 specifically for inputting index (i, j), j) with (i+1, j+1).
Acquisition unit, address 702, for according to described input index with add 1 input index selection and obtain the index address of corresponding RAM.
Search output unit 703, search for the described index address calculating according to described address calculation 703 look-up table that the RAM of described correspondence stores, export the data in index address described in the look-up table of RAM of described correspondence.
Carrying out one dimension while searching, described in search output unit 703, specifically for search the look-up table of storing in described corresponding RAM according to the index address addr1 of described correspondence, export the data in index address addr1 described in the look-up table of described corresponding RAM; In the time carrying out two-dimensional seek, described in search output unit 704, specifically for search the look-up table of storing in described corresponding RAM according to the index address addr2 of described correspondence, export the data in index address addr2 described in the look-up table of described corresponding RAM.
Order selected cell 704, for adding the order of the data that corresponding RAM exports described in 1 input index and described input index selection described in adding described in basis that 1 computing unit 701 obtains.
Carrying out one dimension while searching, described order selected cell 704, specifically for selecting the order of the data of exporting in described corresponding RAM according to described S_i and S_i_1; Wherein, the order of the data of exporting in RAM corresponding to described S_i is the first, and the order of the data of exporting in RAM corresponding to described S_i_1 is second; In the time carrying out two-dimensional seek, described order selected cell 705, specifically for selecting the order of the data of exporting in described corresponding RAM according to described (i, j), (i, j+1), (i+1, j) and (i+1, j+1); Wherein, described (i, the order of the data of j) exporting in corresponding RAM is first, described (i, the order of the data of j+1) exporting in corresponding RAM is the second, and the order of the data of exporting in the RAM of (i+1, j) correspondence is the 3rd, the order of the data of exporting in the RAM of described (i+1, j+1) correspondence is the 4th.
Interpolation computing unit 705, the order of selecting according to described order selected cell 704 for the data that the described described corresponding RAM that searches output unit 703 is exported carries out interpolation and obtains final output valve.
Carrying out one dimension while searching, described interpolation computing unit 705, obtains final output valve specifically for the data of exporting in described corresponding RAM are carried out to one dimension interpolation according to described order.In the time carrying out two-dimensional seek, described interpolation computing unit 705, carries out two-dimensional interpolation by the data of exporting in corresponding RAM according to described order and obtains final output valve specifically for described.
Further, as shown in Figure 8, acquisition unit, described address 702 specifically comprises: address selection unit 7021, address calculation 7022.
Address selection unit 7021, for according to described input index with add 1 input index selection and obtain corresponding virtual address; Address calculation 7022, address calculation 7022, calculates the index address of RAM corresponding to described virtual address for the described virtual address of choosing according to described address selection unit 7021.
Carrying out one dimension while searching, described address selection unit 7021, specifically for selecting to obtain described S_i and virtual address corresponding to S_i_1 according to the parity of described S_i and S_i_1 and described S_i and S_i_1; Described address calculation 7022, specifically for calculating S_i described in RAM corresponding to described virtual address and index address corresponding to S_i_1 difference according to flat address computing formula by described virtual address; Wherein, the described virtual address that described S_i or described S_i_1 are corresponding is xxh, xx represents corresponding RAM, described flat address computing formula is: addr1=h > > 1, addr1 is the index address that described virtual address xxh is corresponding, and h > > 1 represents that h moves to right one.
In the time carrying out two-dimensional seek, described address selection unit 7021, specifically for according to described (i, j), (i, j+1), (i+1, j) and (i+1, j+1) select to obtain corresponding virtual address, in the time carrying out two-dimensional seek, described address calculation 7022, specifically for calculating the index address in RAM corresponding to described virtual address according to two-dimensional address computing formula by described virtual address, wherein, (i, j), (i, j+1), (i+1, or (i+1 j), j+1) corresponding described virtual address is (xxm, xxn), xx represents corresponding RAM, described two-dimensional address computing formula is: addr2=((m > > 1) * k+n > > 1), wherein addr2 is described virtual address (xxm, xxn) corresponding index address, m > > 1 and n > > 1 represent that m and n move to right 1, k is the half of described two-dimensional look-up table width value.
The device of searching of mentioning in the embodiment of the present invention is mainly integrated in FPGA (Field-Programmable Gate Array, be field programmable gate array) or ASIC (Application Specific Integrated Circuit, special IC) in.
The embodiment of the present invention provides a kind of look-up method and device, obtain adding 1 input index by input index being carried out to add-one operation, and according to described input index with add 1 input index selection and obtain the index address in corresponding RAM, and search the look-up table of storing in the RAM of described correspondence according to described index address, export the data in index address described in the look-up table of RAM of described correspondence; Then according to the order of the data of exporting in the described corresponding RAM selecting, the data of exporting in corresponding RAM are carried out to interpolation and obtain final output valve, according to above-mentioned look-up method, can input one dimension index carries out one dimension and searches, also can input 2-d index and carry out two dimension and table look-up, compatibility realizes that one dimension is searched and two-dimensional seek.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can complete by the relevant hardware of programmed instruction, aforesaid program can be stored in a computer read/write memory medium, this program, in the time carrying out, is carried out the step that comprises said method embodiment; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CDs.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, any be familiar with those skilled in the art the present invention disclose technical scope in; the variation that can expect easily or replacement, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.