Summary of the invention
In view of this, main purpose of the present invention is to provide a kind of peak value searching method and device, requirement that can adaptive vector processor high-throughput.
For achieving the above object, technical scheme of the present invention is achieved in that
The invention provides a kind of peak value searching method, described method comprises:
Obtain a plurality of energy datums, first group of comparison circuit and second group of comparison circuit screen a plurality of energy datums of being obtained jointly, after finishing all and need searching for obtaining of energy datum and screen, first group of comparison circuit obtains main peak value candidate, and second group of comparison circuit obtains the minor peaks candidate;
The minor peaks candidate that all main peak value candidates that described first group of comparison circuit obtained and described second group of comparison circuit obtain screens, and obtains peak value.
In such scheme, described first group of comparison circuit comprises a plurality of adders, a plurality of data register, and second group of comparison circuit comprises a plurality of adders, a plurality of data register;
Described first comparison circuit and second group of comparison circuit screen a plurality of energy datums of being obtained jointly, comprise, each non-energy datum of obtaining is first carried out following processing:
The address of non-k the energy datum of being obtained first, and described first group of comparison circuit in when difference is greater than default zero clearing threshold value between the energy datum address of k the current preservation of first address register, wherein, k is used to represent the sequence number of the energy datum of obtaining, for being not less than zero integer;
K the energy datum of being obtained is input to k first adder in first group of comparison circuit, and the data of k energy datum that described k first adder will be imported and described k the current preservation of first data register compare:
When described k energy datum during greater than the energy datum of described k the current preservation of first data register, the main peak value candidate of described k the current preservation of first data register is input to k second data register in described second group of comparison circuit, described k the current minor peaks candidate of second data register is updated to the main peak value candidate of described k the current preservation of first data register, and main peak value candidate that will the individual current preservation of first data register of described k is updated to described k energy datum;
When described k energy datum is not more than the main peak value candidate of described k the current preservation of first data register, described k energy datum is input to k second adder of described second comparison circuit, described k second adder compares the minor peaks candidate of described k energy datum and described k the current preservation of second data register, in described k energy datum during, the minor peaks candidate of described k the current preservation of second data register is updated to described k energy datum greater than the minor peaks candidate of described k the current preservation of second data register.
In such scheme, described first comparison circuit and second group of comparison circuit screen a plurality of energy datums of being obtained jointly, comprise, each non-energy datum of obtaining is first carried out following processing:
The address of non-k the energy datum of obtaining first, and described first group of comparison circuit in when difference is not more than default zero clearing threshold value between the energy datum address of k the current preservation of first address register,
K the energy datum of being obtained is input to described k first adder, and the main peak value candidate of k energy datum that described k first adder will be imported and described k the current preservation of first data register compares:
When described k energy datum during, the main peak value candidate of described k the current preservation of first data register is updated to described k energy datum greater than the main peak value candidate of described k the current preservation of first data register;
When described k energy datum is not more than the main peak value candidate of described k the current preservation of first data register, do not upgrade described k first data register and k second data register.
In such scheme, described first group of comparison circuit also comprises a plurality of first address registers, and described second group of comparison circuit also comprises a plurality of second address registers;
Described method also comprises: when upgrading first data register of described first group of comparison circuit, upgrade the main peak value candidate address that first address register is preserved in described first group of comparison circuit accordingly; When upgrading second data register of described second group of comparison circuit, upgrade the minor peaks candidate address that second address register is preserved in described second group of comparison circuit accordingly.
In such scheme, during first data register of the described first group of comparison circuit of described renewal, the corresponding main peak value candidate address of upgrading first address register preservation in described first group of comparison circuit, comprise each non-energy datum of obtaining is first carried out following processing: when being updated to described k energy datum, also the data address of the individual current preservation of first address register of described k is updated to the address of described k energy datum for minor peaks candidate in k the current preservation of first data register;
During second data register of the described second group of comparison circuit of described renewal, the corresponding minor peaks candidate address of upgrading second address register preservation in described second group of comparison circuit, comprise each non-energy datum of obtaining is first carried out following processing: when the minor peaks candidate of described k the current preservation of second data register is updated to described k energy datum, also the data address of the individual current preservation of second address register of k is updated to the address of described k energy datum;
And/or, when the minor peaks candidate of described k the current preservation of second data register is updated to the main peak value candidate of described k the current preservation of first data register, also the data address of k the current preservation of second address register is updated to the address of described k the current preservation of first address register.
In such scheme, described obtain a plurality of energy datums before, described method also comprises:
The sampled data of obtaining is carried out that related operation is handled, after filtration operation handles, carried out modulo operation again and handle, from the result that modulo operation is handled, extract real part, obtain described energy datum and be saved in the memory.
In such scheme, the every row of described memory stores a plurality of energy datums;
Describedly obtain a plurality of energy datums, for: from described memory, read delegation's amount data.
In such scheme, described before obtaining a plurality of energy datums, described method also comprises:
With a default zero clearing threshold value data of resulting main peak value candidate, minor peaks candidate, main peak value candidate the right and left and default zero clearing threshold value data zero clearing from described all energy datums that need search for of minor peaks candidate the right and left.
In such scheme, the minor peaks candidate that described all main peak value candidates that described first group of comparison circuit obtained and described second group of comparison circuit obtain screens, and obtains peak value, comprising:
The maximum ranking circuit obtains main peak value candidate from described first group of comparison circuit, get access to the minor peaks candidate from described second group of comparison circuit, and respectively accessed main peak value candidate, minor peaks candidate are sorted, reject false peaks and relatively wait processing, obtain a plurality of peak values.
In such scheme, after obtaining peak value, described method also comprises:
Whether the number of verifying resultant peak value reaches default peak value number threshold value, if not, then the one or more data with resulting peak value and described peak value the right and left after the zero clearing, repeat peak value searching from described all energy datums that need search for; Otherwise, finish current peak value searching.
The present invention also provides a kind of peak value searching device, and described device comprises: first group of comparison circuit, second group of comparison circuit and maximum ranking circuit, wherein,
First group of comparison circuit is used to obtain a plurality of energy datums, and jointly a plurality of energy datums of being obtained screened with described second group of comparison circuit, obtains main peak value candidate;
Second group of comparison circuit is used to obtain a plurality of energy datums, and jointly a plurality of energy datums of being obtained screened with described first group of comparison circuit, obtains main peak value candidate;
The maximum ranking circuit is used for the minor peaks candidate that all main peak value candidates that described first group of comparison circuit obtained and described second group of comparison circuit obtain and screens, and obtains peak value.
In such scheme, described device also comprises: memory and vector processor, wherein,
Memory is used to preserve the energy datum that all need be searched for;
Vector processor is used for the sampled data of obtaining is carried out that related operation is handled, after filtration operation handles, carried out modulo operation again and handle, and extracts real part from the result that modulo operation is handled, and obtains described energy datum and is saved in the memory.
In such scheme, described memory also is used for a plurality of energy datums of every row storage;
Described first group of comparison circuit and second group of comparison circuit also are used for reading delegation's energy datum from described memory at every turn.
In such scheme, described first group of comparison circuit comprises a plurality of first adders and a plurality of first data register, and the connection corresponding one by one with described first data register of described first adder;
Described first adder is used to obtain a plurality of energy datums, and a plurality of energy datums of being obtained are screened, and obtains main peak value candidate, and the main peak value candidate who obtains is saved in described first data register;
Described first data register is used to preserve described main peak value candidate.
In such scheme, described first group of comparison circuit also comprises a plurality of first address registers, is used to preserve described main peak value candidate's address;
Described first adder also is used for resultant main peak value candidate's address is saved in described first address register;
Wherein, described first address register is corresponding one by one with described first adder and connect and connection corresponding one by one with described first data register.
In such scheme, described second group of comparison circuit comprises a plurality of second adders and a plurality of second data register, and the connection corresponding one by one with described first data register of described first adder;
Described second adder is used to obtain a plurality of energy datums, and a plurality of energy datums of being obtained are screened, and obtains the minor peaks candidate, and the minor peaks candidate who obtains is saved in described second data register;
Described second data register is used to preserve described minor peaks candidate.
In such scheme, described second group of comparison circuit also comprises a plurality of second address registers, is used to preserve described minor peaks candidate's address;
Described second adder also is used for resultant minor peaks candidate's address is saved in described second address register;
Described second address register is corresponding one by one with described second adder and connect and connection corresponding one by one with described second data register.
In such scheme, described device also comprises: circulating controling circuit and zero clearing control circuit, wherein, circulating controling circuit, be used to verify whether the number of described second group of resultant peak value of comparison circuit reaches default peak value number threshold value, if not, then notify described zero clearing control circuit to carry out zero clearing, and start described first group of comparison circuit, second group of comparison circuit and maximum ranking circuit, repeat peak value searching; Otherwise, finish current peak value searching;
The zero clearing control circuit, be used for when receiving the notice of described circulating controling circuit the peak value that described second group of comparison circuit obtained and one or more energy datums zero clearing from store all memories that need search for energy datum of described peak value the right and left.
In such scheme, described zero clearing control circuit, also be used for default zero clearing threshold value energy datum of main peak value candidate that described first group of comparison circuit obtained and described main peak value candidate the right and left and minor peaks candidate that second group of comparison circuit obtains and a default zero clearing threshold value energy datum of minor peaks candidate the right and left, zero clearing from store all memories that need search for energy datum.
Peak value searching method provided by the present invention and device, each clock cycle is read a plurality of energy datums, and with a plurality of energy datums that read carry out twice parallel relatively, after all energy datums being walked abreast relatively, obtain main peak value candidate and minor peaks candidate, from resulting main peak value candidate and minor peaks candidate, filter out peak value again, in the process of scan-data, a plurality of data are by row, compare concurrently, and read data and comparing data can carry out by streamline, do not stop in the centre, and speed is fast, can realize the requirement of vector processor high-throughput, and every wheel scan can access two peak values at least, can reduce the read operation to memory, saves power consumption, and take into account the speed and the hardware logic resource of peak value searching, as area of chip; In addition, the core of peak value searching device of the present invention only needs a series of adders and register to realize, is simple and easy to realize that area is little, and cost is low.
Embodiment
Basic thought of the present invention is: obtain a plurality of energy datums at every turn, and compare by a plurality of adders, upgrade the energy datum of being preserved according to comparative result again; After all energy datums that need search for are all obtained and are compared, each energy datum of being preserved is compared again, obtain peak value, so, a plurality of energy datums are parallel to be compared, and speed is fast, peak value searching efficient height, requirement that can adaptive vector processor high-throughput.
Peak value searching method of the present invention with reference to shown in Figure 1, mainly may further comprise the steps:
Step 101: obtain a plurality of energy datums, first group of comparison circuit and second group of comparison circuit screen a plurality of energy datums of being obtained jointly, after finishing all and need searching for obtaining of energy datum and screen, first group of comparison circuit obtains main peak value candidate, and second group of comparison circuit obtains the minor peaks candidate;
Step 102: the minor peaks candidate that all main peak value candidates that described first group of comparison circuit obtained and described second group of comparison circuit obtain screens, and obtains peak value.
Wherein, first group of comparison circuit comprises a plurality of first adders, a plurality of first data register, and second group of comparison circuit comprises a plurality of second adders, a plurality of second data register.Wherein, described first adder is corresponding one by one with described first data register and connect and the connection corresponding one by one with described second data register of described second adder.
Particularly, in step 101, each non-energy datum of obtaining is first carried out following processing, realize the screening of energy datum: the address of non-k the energy datum of being obtained first, with described first group of comparison circuit in when difference is greater than the zero clearing threshold value preset between the energy datum address of the individual current preservation of first address register of k, wherein, k is used to represent the sequence number of the energy datum of obtaining, be not little zero integer, if the current individual energy datum of p (p for greater than 1 integer) that gets access to altogether, the value of k can be 0,1,2,3 ..., p-1;
K the energy datum of being obtained is input to k first adder in first group of comparison circuit, and the data of k energy datum that described k first adder will be imported and described k the current preservation of first data register compare;
When described k energy datum during greater than the energy datum of described k the current preservation of first data register, the main peak value candidate of described k the current preservation of first data register is input to k second data register in described second group of comparison circuit, described k the current minor peaks candidate of second data register is updated to the main peak value candidate of described k the current preservation of first data register, and main peak value candidate that will the individual current preservation of first data register of described k is updated to described k energy datum;
When described k energy datum is not more than the main peak value candidate of described k the current preservation of first data register, described k energy datum is input to k second adder of described second comparison circuit, described k second adder compares the minor peaks candidate of described k energy datum and described k the current preservation of second data register, in described k energy datum during, the minor peaks candidate of described k the current preservation of second data register is updated to described k energy datum greater than the minor peaks candidate of described k the current preservation of second data register.
Here, described zero clearing threshold value is represented the data number that main peak value or minor peaks the right and left need be removed/shield.
Here, in step 101, above-mentioned each non-energy datum of obtaining is first carried out handled, the process that realizes the energy datum screening can also comprise: the address of non-k the energy datum of obtaining first, and described first group of comparison circuit in when difference is not more than default zero clearing threshold value between the energy datum address of the individual current preservation of first address register of k
K the energy datum of being obtained is input to described k first adder, and the main peak value candidate of k energy datum that described k first adder will be imported and described k the current preservation of first data register compares;
When described k energy datum during, the main peak value candidate of described k the current preservation of first data register is updated to described k energy datum greater than the main peak value candidate of described k the current preservation of first data register;
When described k energy datum is not more than the main peak value candidate of described k the current preservation of first data register, do not upgrade described k first data register and k second data register.
Here, described first group of comparison circuit also comprises a plurality of first address registers, described second group of comparison circuit also comprises a plurality of second address registers, wherein, and the connection corresponding one by one of described first address register with described first adder, also connect with described first data register is corresponding one by one, described second address register and described second adder are corresponding one by one and connect and connection corresponding one by one with described second data register.
In above-mentioned screening process, when upgrading first data register of described first group of comparison circuit, upgrade the main peak value candidate address that first address register is preserved in described first group of comparison circuit accordingly; When upgrading second data register of described second group of comparison circuit, upgrade the minor peaks candidate address that second address register is preserved in described second group of comparison circuit accordingly.
Particularly, when the minor peaks candidate of k the current preservation of first data register is updated to described k energy datum, also the data address of the individual current preservation of first address register of described k is updated to the address of described k energy datum; When the minor peaks candidate of described k the current preservation of second data register is updated to described k energy datum, also the data address of the individual current preservation of second address register of k is updated to the address of described k energy datum; When the minor peaks candidate of described k the current preservation of second data register is updated to the main peak value candidate of described k the current preservation of first data register, also the data address of k the current preservation of second address register is updated to the address of described k the current preservation of first address register.
Before obtaining a plurality of energy datums, described method also comprises: with each first data register and/or the first address register zero clearing in described first group of comparison circuit.
Obtain energy datum first, when going forward side by side row filter, described method also comprises: the energy datum that will obtain first is input to respectively preserving in first data register in first group of comparison circuit respectively, and to each the second data register zero clearing in described second group of comparison circuit.
Simultaneously, the address of the energy datum obtained first can also be input in each first address register in first group of comparison circuit and preserve, and to each the second address register zero clearing in described second group of comparison circuit.
Here, before obtaining a plurality of energy datums, described method can also comprise: with default zero clearing threshold value energy datum zero clearing from described all energy datums that need search for about a default zero clearing threshold value energy datum and minor peaks candidate about resulting main peak value candidate, minor peaks candidate, main peak value candidate.If screen first, then need before obtaining energy datum, not carry out above-mentioned clear operation.
In the practical application, after one wheel scan finished, if find i peak value, and i was less than the peak value number n of need search, so before carrying out next round scanning, must be earlier with each peak value and the default zero clearing threshold value energy datum zero clearing of each peak value the right and left found.
Described obtain a plurality of energy datums before, described method can also comprise: after the sampled data of obtaining is carried out related operation processing, filtration operation processing, carrying out modulo operation again handles, from the result that modulo operation is handled, extract real part, obtain described energy datum and be saved in the memory.
Wherein, the every row of described memory stores a plurality of energy datums; Describedly obtain a plurality of energy datums, for: from described memory, read delegation's energy datum.
Wherein, the minor peaks candidate that all main peak value candidates that described first group of comparison circuit obtained and described second group of comparison circuit obtain screens, obtain peak value, can comprise: maximum ranking circuit (max_sort circuit) obtains main peak value candidate from described first group of comparison circuit, get access to the minor peaks candidate from described second group of comparison circuit, and respectively accessed main peak value candidate, minor peaks candidate are sorted, reject false peaks and relatively wait processing, obtain a plurality of peak values.
Particularly, the max_sort circuit respectively to main peak value candidate and minor peaks candidate according to sorting from big to small, and reject false peaks and handle; Minor peaks candidate and each main peak value candidate with maximum compares again, if the minor peaks candidate of described maximum is less than the main peak value candidate of minimum, then determine all main peak value candidates and the artificial peak value of all minor peaks candidates, otherwise, will be defined as peak value greater than described maximum minor peaks candidate's each main peak value candidate and described maximum minor peaks candidate.
Wherein, after obtaining peak value, described method can also comprise: whether the number of verifying resultant peak value reaches default peak value number threshold value, if not, then with one or more data zero clearing from described all energy datums that need search for of resulting peak value and described peak value the right and left, and repeat above-mentioned peak value searching; Otherwise, finish current peak value searching.
Accordingly, the present invention also provides a kind of peak value searching device, described device comprises: first group of comparison circuit, second group of comparison circuit and maximum ranking circuit, wherein, first group of comparison circuit, be used to obtain a plurality of energy datums, and jointly a plurality of energy datums of being obtained screened, obtain main peak value candidate with described second group of comparison circuit; Second group of comparison circuit is used to obtain a plurality of energy datums, and jointly a plurality of energy datums of being obtained screened with described first group of comparison circuit, obtains main peak value candidate; The maximum ranking circuit is used for the minor peaks candidate that all main peak value candidates that described first group of comparison circuit obtained and described second group of comparison circuit obtain and screens, and obtains peak value.
Particularly, described first group of comparison circuit comprises a plurality of first adders and a plurality of first data register, and the connection corresponding one by one with described first data register of described first adder; Described first adder is used to obtain a plurality of energy datums, and a plurality of energy datums of being obtained are screened, and obtains main peak value candidate, and the main peak value candidate who obtains is saved in described first data register; Described first data register is used to preserve described main peak value candidate.
Wherein, described first group of comparison circuit also comprises a plurality of first address registers, is used to preserve described main peak value candidate's address; Described first adder also is used for resultant main peak value candidate's address is saved in described first address register; Wherein, described first address register is corresponding one by one with described first adder and connect and connection corresponding one by one with described first data register.
Particularly, described second group of comparison circuit comprises a plurality of second adders and a plurality of second data register, and the connection corresponding one by one with described first data register of described first adder.Described second adder is used to obtain a plurality of energy datums, and a plurality of energy datums of being obtained are screened, and obtains the minor peaks candidate, and the minor peaks candidate who obtains is saved in described second data register; Described second data register is used to preserve described minor peaks candidate.
Wherein, described second group of comparison circuit also comprises a plurality of second address registers, is used to preserve described minor peaks candidate's address; Described second adder also is used for resultant minor peaks candidate's address is saved in described second address register; Described second address register is corresponding one by one with described second adder and connect and connection corresponding one by one with described second data register.
Wherein, described device also comprises: memory and vector processor, and wherein, memory is used to preserve all energy datums; Vector processor is used for the sampled data of obtaining is carried out that related operation is handled, after filtration operation handles, carried out modulo operation again and handle, and extracts real part from the result that modulo operation is handled, and obtains described energy datum and is saved in the memory;
Here, described memory also is used for a plurality of energy datums of every row storage; Described first group of comparison circuit and second group of comparison circuit also are used for reading delegation's energy datum from described memory at every turn.
Described device also comprises: circulating controling circuit and zero clearing control circuit, wherein, circulating controling circuit, be used to verify whether the number of described second group of resultant peak value of comparison circuit has reached default peak value number threshold value, if not, then notify described zero clearing control circuit to carry out zero clearing, and start described first group of comparison circuit, second group of comparison circuit and maximum ranking circuit, repeat peak value searching; Otherwise, do not notify described zero clearing control circuit, finish current peak value searching;
The zero clearing control circuit, be used for when receiving the notice of described circulating controling circuit the peak value that described second group of comparison circuit obtained and one or more energy datums zero clearing from store all memories that need search for energy datum of described peak value the right and left.
Here, described zero clearing control circuit, can also be used for default zero clearing threshold value energy datum of main peak value candidate that described first group of comparison circuit obtained and described main peak value candidate the right and left and minor peaks candidate that second group of comparison circuit obtains and a default zero clearing threshold value energy datum of minor peaks candidate the right and left, zero clearing from store all memories that need search for energy datum.
Embodiment one
In the practical application, the calculation task before the peak value searching is finished by vector processor, and the process of peak value searching can be realized by hardware accelerator.
As shown in Figure 2, the peak value searching device can comprise: Receiver Module, data storage, vector processor and peak value searching module, wherein, Receiver Module, be used to receive the data of ADC sampling, and resulting employing storage is arrived data storage; Vector processor is used for reading sampled data from described data storage, after the sampled data that is read is handled, obtains energy datum, and resulting energy datum is saved in data storage; The peak value searching module is used for reading energy datum from data storage, carries out peak value searching and handles, and finds the peak value that needs, and the peak value that is found is preserved, and returned to described vector processor.
Particularly, Receiver Module is by receiving the data of ADC sampling, and store sampled data into data storage, vector processor reads sampled data from described data storage, and sampled data carried out after related operation, filtration operation, modulo operation handle, extract real part, obtain energy datum, resulting energy datum is saved in the described data storage again; The peak value searching module is carried out after parameter is provided with at vector processor, the peak value searching module reads energy datum from data storage, carry out peak value searching and handle, and finds peak value, and returns to vector processor.
In the practical application, the process that vector processor is handled sampled data can comprise: vector processor reads sampled data in the mode of streamline from data storage, carry out computings such as descending sampled data and filtering relevant again with main synchronizing sequence (PSS), resulting operation result (is comprised the relevant of I passage, filtered result is relevant with the Q passage, filtered result) stores in the data storage, when carrying out the modulo operation processing, from data storage, read again above-mentioned relevant and filter after the result carry out modulo operation and handle, afterwards, from the result that modulo operation is handled, extract real part again, obtain energy datum, more resulting energy datum is written in the data storage.
Wherein, after vector processor carried out the modulo operation processing according to formula (1), resultant result's real part was an energy datum, is stored in low 16 bits of data storage, and the imaginary part among the resultant result is 0, is stored in high 16 bits of data storage.
Wherein,
Represent a complex signal, Re is
Real part, Im is
Imaginary part.P/2 data of original each bank storage, after carrying out the compression processing of extracting real part, the room of data imaginary part is removed, then data storage bank has just stored p energy datum, so, not only compressed/saved the memory space of data storage, and, follow-up when carrying out peak value searching, the institutional framework of data storage has determined the peak value searching module can once read a plurality of energy datums, read corresponding the doubling of efficient meeting of energy datum, the throughput of parallel search also can double.In the practical application, vector processor can carry out the processing of above-mentioned extraction real part by an instruction of extracting real part.
Particularly, for the throughput of adaptive vector processor, described data storage has following architectural feature: data memory format is plural energy
Store a plural energy datum with the unit of 32 bits, wherein low 16 bits are real part, and high 16 bits are imaginary part; As shown in Figure 3, memory width (width) is 16*P*4 bit (P is the even number greater than 0), is divided into 4 bank, and each bank has the memory cell of P/2 32 bits, and vector processor can once read a columns certificate of memory, i.e. P*2 energy datum.If vector processor only carries out related operation, after the operation such as filtering operation, do not extract the operation of real part, then the result is write back in the memory, so, its result still is that one of memory is shown P*2 energy datum, but the memory cell of each 32 bit will deposited the mould value of plural energy, its high 16 bits are 0, low 16 bits are real part (not being 0), and in fact, comprise the operation of extracting real part in the peak value searching, promptly at related operation, behind the filtering operation, and then the operation of extracting real part with the instruction of extracting real part, then the result is write back in the memory, one of memory row are deposited (16*P*4)/16=P*4 energy datum so, and promptly two energy datums are being deposited in the unit of one 32 bit, a bank can deposit P energy datum, as shown in Figure 4.
The same columns certificate of 4 bank of a reference to storage of vector processor energy has been described in the front, the peak value searching module then at every turn can reference to storage the delegation of some bank, be the data of 16*P bit, also be P energy datum (if vector processor did not carry out extracting the operation of real part, read-write is P/2 data so at every turn).
In the practical application, described data storage can be synchronous static memory (ssram).
Wherein, vector processor also is used for described peak value searching module is carried out the parameter setting.The peak value searching module is carried out peak value searching to the energy datum that reads and is handled according to the parameter setting of described vector processor.
Wherein, the peak value searching module can be realized by hardware accelerator, can accesses data memory, each energy datum of from data storage, reading the 16*p bit, promptly read p energy datum, and in the mode of streamline, the energy datum that at every turn reads is compared at twice, the energy datum that soon at every turn reads is delivered to first group of comparison circuit and second group of comparison circuit simultaneously and is compared, all energy datums all read and relatively after, result to described comparison screens, and finds peak value searching, and every wheel scan can find a plurality of peak values.
The peak value searching module mainly can comprise two groups of comparison circuits and a max_sort circuit, wherein, by two groups of comparison circuits the data memory is scanned line by line, obtain energy datum, simultaneously, the every capable energy datum that gets access to compared screening after, obtain the peak value candidate, by the max_sort circuit peak value candidate who obtains is screened again, obtain peak value.Wherein, two groups of comparison circuit structural similarities, first group of comparison circuit obtains main peak value candidate from obtaining energy datum, second group of comparison circuit obtains the minor peaks candidate from obtaining energy datum, after finishing all energy datums that need search for and all reading screening, the max_sort circuit obtains main peak value candidate from first group of comparison circuit, get access to the minor peaks candidate from second group of comparison circuit, respectively accessed main peak value candidate, minor peaks candidate are sorted, reject false peaks and relatively wait processing, obtain a plurality of peak values.So, one take turns search after, can search 2 to 2p peak value, p is the number of every capable energy datum that reads.If the peak value number that at this moment finds also less than default peak value number threshold value n, is then proceeded next round scanning, till the peak value number that finds reaches default peak value number threshold value n.
As shown in Figure 4, comprise p first adder in first group of comparison circuit, p first data register max_vec0[], p first address register addr_vec0[], wherein, each first adder in first group of comparison circuit is used for obtaining the maximum of institute's read data row, promptly be used to obtain main peak value candidate, the first data register max_vec0[] be used to store main peak value candidate, for example, the max_vec0[p that the with dashed lines collimation mark is shown among Fig. 5] be used to store p main peak value candidate, the first address register addr_vec0[] be used to store main peak value candidate's address; Second group of comparison circuit comprises p second adder, p second a data register max_vec1[] and p the second address register addr_vec1[].Wherein, each second adder in second group of comparison circuit is used to obtain the second largest value of institute's read data row, promptly be used to obtain the minor peaks candidate, the second data register max_vec1[] be used to store minor peaks candidate, the second address register addr_vec1[] be used to store minor peaks candidate's address.As shown in Figure 5, the max_sort circuit comprises p comparing unit, and each comparing unit comprises an adder, a data register and an address register.
In the practical application, if a bank has stored p energy datum in the data storage, wherein, p is the integer greater than 0, once read in p energy datum to first group of comparison circuit, relatively parallel for realizing, need to comprise p adder in first group of comparison circuit, second group of comparison circuit also needs to comprise p adder.The also quantity of the energy datum of parallel processing is according to actual needs adjusted the quantity of adder in first group of comparison circuit.
Particularly, the peak value searching module is carried out the process that peak value searching is handled, and idiographic flow is as follows:
Step 0: vector processor writes the peak value searching parameter that will dispose in the peak value searching module, is peak value searching block configuration peak value searching parameter;
Particularly, the peak value searching parameter that vector processor disposed can comprise: the source data address src_data_addr that indicates to read the energy datum address, read the data length data_len of energy datum, peak value number threshold value n, the data number that main peak value candidate or minor peaks candidate the right and left need be removed/shield is zero clearing threshold value m, the address addr_vec0 of main peak value, the address addr_vec1 of minor peaks, be used to deposit the address D est_add of peak value in the data storage, being used to represent to be stored in register still is parameter d est_se1 of data storage etc.
In the practical application, the data number m that peak value the right and left need be removed/shield is an empirical parameter, if the signal to noise ratio height of good wave filtering effect or radiofrequency signal can be provided with less numerical value.
Step 1: in the startup, the zero clearing control circuit is with p data register and p address register zero clearing in first group of comparison circuit.
Step 2: the p that reads in a first energy datum directly is stored in the first data register max_vec0[], and with the second data register max_vec1[] zero clearing.
Here, per clock cycle can be read into p energy datum, and p is the integer greater than 0, and is relevant with the institutional framework of the data storage of preserving energy datum, is specifically as follows the energy datum number that the every row of data storage is preserved.
Step 3: verify whether the energy datum that does not read is in addition arranged in the described data storage, if, then from the data storage of preserving energy datum, read p energy datum, and continue step 4, otherwise, step 6 continued;
Step 4: respectively each energy datum in p the data that read is carried out following processing procedure, find main peak value candidate and minor peaks candidate, continue step 5:
Steps A, obtain the current address addr_cur that reads in k energy datum, and first group of comparison circuit in k the first address register addr_vec0[k] difference addr_gap between the main peak value candidate address addr_pre of current preservation, judge that whether the difference addr_gap that obtains is greater than zero clearing threshold value m, if then continue step B; Otherwise, continue step F;
Step B, with k energy datum k reading into k first adder to first group of comparison circuit, k the energy datum that k first adder will be imported, with k the first data register max_vec0[k] the main peak value candidate of current preservation compares, if k energy datum is greater than k the first data register max_vec0[k] the main peak value candidate of current preservation, then continue step C; Otherwise, continue step D;
Step C, to k the first data register max_vec0[k] and k the second data register max_vec1[k] upgrade, k second adder is with k the first data register max_vec0[k] current value of preserving main peak value candidate is input to the individual second data register max_vec1[k of k], k the second data register max_vec1[k] self current value of preserving the minor peaks candidate is revised as the individual first data register max_vec0[k of described k] the main peak value candidate's of current preservation value, and, k the energy datum that k first adder will read in is input to k the first data register max_vec0[k], k the first data register max_vec0[k] self current value of preserving main peak value candidate is revised as described k energy datum;
Simultaneously, k second adder is with k the first address register addr_vec0[k] the main peak value candidate's of current preservation address is input to k the second address register addr_vec1[k], k the second address register addr_vec1[k] described k the first address register addr_vec0[k is revised as in self current preservation minor peaks candidate's address] the main peak value candidate address of current preservation; And, the address of k the energy datum that k first adder will read in is input to k the first address register addr_vec1[k], k the first address register addr_vec1[k] address that described k energy datum is revised as in the main peak value candidate address of self current preservation;
Step D, the energy datum k that reads into is input to k second adder of second group of comparison circuit, k the energy datum that k second adder will be imported, with k the second data register max_vec1[k] the minor peaks candidate of current preservation compares, if k energy datum is greater than k the second data register max_vec1[k] the minor peaks candidate of current preservation, then continue step e; Otherwise, finish current flow process;
Step e, k second adder is to k the second data register max_vec1[k] upgrade, k the energy datum of reading in is input to k the second data register max_vec1[k] in, k the second data register max_vec1[k] self current preservation minor peaks candidate's value is revised as described k energy datum;
Simultaneously, the address of k the energy datum that k second adder will read in is input to k the second address register addr_vec1[k], k the second address register addr_vec1[k] with the address that described k energy datum is revised as in the minor peaks candidate address of self current preservation, finish current flow process.
Step F, k the energy datum k that reads into is input to k first adder, k the energy datum that k first adder will be imported, with k the first data register max_vec0[k] the main peak value candidate of current preservation compares, if k energy datum is greater than k the first data register max_vec0[k] the main peak value candidate of current preservation, then continue step G; Otherwise, finish current flow process;
Step G, to k the first data register max_vec0[k] upgrade, k the energy datum that k first adder will read in is input to k the first data register max_vec0[k], k the first data register max_vec0[k] the main peak value candidate's of self current preservation value is revised as described k energy datum, finish current flow process.
Simultaneously, the address of k the energy datum that k first adder will read in is input to k the first address register addr_vec0[k], k the first address register addr_vec0[k] with the address that described k energy datum is revised as in the main peak value candidate address of self current preservation, finish current flow process.
Step 5:, and return step 3 with m data of zero clearing threshold value of resulting main peak value candidate, minor peaks candidate, main peak value candidate the right and left and m data of zero clearing threshold value zero clearing/shielding from data storage of minor peaks candidate the right and left;
In the practical application, need behind each scanning peak value, carry out zero clearing/masking operation.
So, data_len/p all after date, after all energy datums run through, the first data register max_vec0[] p main peak value candidate of preservation, the second data register max_vec1[] p minor peaks candidate of preservation.
The minor peaks candidate that each data register is preserved in the main peak value candidate that step 6:max_sort circuit is preserved each data register in described first group of comparison circuit and the second group of comparison circuit screens, find two or more peak values, idiographic flow is as follows:
Step a:max_sort circuit each data register from first group of comparison circuit obtain main peak value candidate and from second group of comparison circuit each data register obtain the minor peaks candidate, respectively to obtaining main peak value candidate and minor peaks candidate according to sorting from big to small, and reject false peaks and handle;
Step b:max_sort circuit is with minor peaks candidate maximum among the described minor peaks candidate, compare with each main peak value candidate, if the minor peaks candidate of described maximum is less than main peak value candidate minimum among the described main peak value candidate, then determine the peak value that all main peak value candidates and all minor peaks candidates artificially will search for, otherwise, will be defined as peak value greater than described maximum minor peaks candidate's each the main peak value candidate and the minor peaks candidate of described maximum.
For avoiding searching false peaks, when each main peak value candidate and minor peaks candidate are sorted, also need to reject the false peaks among each main peak value candidate and the minor peaks candidate.
Here, described false peaks is meant the peak value into any one energy datum in described main peak value candidate and/or the minor peaks candidate the right and left zero clearing threshold value energy datum.
In the practical application, main peak value candidate is sorted and the process of rejecting false peaks can be:
Step c, the max_sort circuit is from first data register max_vec0[] read in main peak value candidate first, simultaneously, from first address register addr_vec0[] read this main peak value candidate's address, and with this main peak value candidate save as max0, with max_1, max_2 ..., the max_p-1 zero clearing, this main peak value candidate's address is saved as addr_0, with addr_1 ..., the addr_p-1 zero clearing;
Steps d, whether the max_sort Circuit verification has read p main peak value candidate, if, then continue h, otherwise, step e continued;
Step e, the max_sort circuit continues from first data register max_vec0[] read in main peak value candidate, simultaneously, from first address register addr_vec0[] read this main peak value candidate's address;
Step f, the max_sort circuit choose after with the main peak value of being read in max_0, max_1 ..., max_p-1 compares, simultaneously, with the address of choosing after the reading in main peak value and addr_0, addr_1 ..., difference and zero clearing threshold value m between the addr_p-1 compare;
Step g, according to the comparative result of step f, the max_sort circuit with this main peak value candidate of reading in save as max_k (k is 0,1,2 ..., p-1), and this main peak value candidate's address saved as corresponding addr_k;
Operation in this step involves max_0, max_1 ..., copy between the max_p-1 and shifting function.
For example, if the main peak value candidate of being read in is less than the data among the max_1 and greater than max_2, and main peak value candidate's address addr_in and the difference of address addr_1 greater than the difference of zero clearing threshold value m, main peak value candidate's address addr_in and address addr_2 greater than zero clearing threshold value m, then max_2 is saved as max_3, the main peak value candidate of being read in is saved as max_2; If the main peak value candidate of being read in is less than max_1 and greater than max_2, and main peak value candidate's address addr_in and the difference of address addr_1 are not more than zero clearing threshold value m greater than zero clearing threshold value m, main peak value candidate's address addr_in and the difference of address addr_2, then max_2 is a false peaks, be invalid, at this moment, max_1 need only be saved as max_2, so analogize.
Step h, max_sort circuit finish the ordering from big to small to p main peak value candidate, obtain main peak value candidate sequence (max_0, max_1 ..., max_p-1) and corresponding main peak value candidate address sequence (addr_0, addr_1 ..., addr_p-1);
In like manner, the max_sort circuit can be to the second data register max_vec1[] in p minor peaks candidate sort from big to small, simultaneously, wherein false peaks is weeded out, obtain minor peaks candidate sequence (smax_0, smax_1, ..., smax_p-1) with corresponding minor peaks candidate's address sequence (saddr_0, saddr_1, ..., saddr_p-1).
At last, the max_sort circuit with the maximum smax_0 in the minor peaks candidate sequence respectively with main peak value candidate sequence (max_0, max_1, ..., max_p-1) each the main peak value candidate in compares, if max_k-1<smax_0<max_k, k=0,1 ..., p-1, then, with max_0, max_1, ..., the maximum smax_0 in the k among the max_k main peak value candidate and the minor peaks candidate sequence is defined as peak value, finally searches k peak value; If smax_0 is less than the minimum value max_p-1 among the main peak value candidate, then with minor peaks candidate sequence (smax_0, smax_1, ..., p smax_p-1) minor peaks candidate and main peak value candidate sequence (max_0, max_1 ..., max_p-1) p in main peak value candidate is defined as peak value, finally searches 2*p maximum.
In the practical application, under the situation that bigger data in energy datum are relatively disperseed, the first data register max_vec0[] in p main peak value candidate's difference in address greater than m, the second data register max_vec1[] in p minor peaks candidate's difference in address also greater than m, find peak value purpose probability as shown in table 1 below, wherein, x depends on the peak value number that second group of comparison circuit filters out.
Table 1
Find the mean number (weighted average) of peak value to be according to the method described above: (2+3+4+5+...+p+2p)/p, to be example, whenever to take turns search and can find the mean number of peak value to be about 6 with p=8.
Here, every take turns search after, the max_sort circuit can also be according to the setting of parameter d est_sel, and resulting peak value is saved in the address D est_addr place of data storage, perhaps, is saved in the register of being convenient to visit.
Step 7: judge whether the peak value number that is searched has reached pre-configured " peak value number threshold value n ", if, then finish current flow process, otherwise return step 1, repeat above-mentioned peak value searching process, carry out the next round peak value searching, so circulation reaches pre-configured " peak value number threshold value n " up to the peak value number that searches.
Above-mentioned peak value searching processing procedure has following characteristics:
At first, adopt two groups of comparison circuits, search procedure is that each row are searched for concurrently, according to each row parallel search, can reduce the read operation to memory, saves power consumption, and takes into account the speed and the hardware logic resource of peak value searching, as area of chip.
Secondly, adopt two groups of comparison circuits, make each take turns scanned after, have only the probability of 1/p to obtain 2 maximums, obtaining 3 peaked probability is 1/p ...., can access 2p maximum at most, input and output are higher than very.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.