A Fourier transform data processing method and microprocessor chip
By using hardware circuits to calculate data address information in FFT calculation, the problem of low FFT calculation efficiency in the prior art is solved, and more efficient calculation speed and power consumption are achieved.
Patent Information
- Application Number
- CN202411638807.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-04-08
AI Technical Summary
In the prior art, FFT computing efficiency is low, resulting in slow processing speed and large power consumption.
Through a Fourier transform data processing method, the input data group is obtained, the number of calculation stages of butterfly calculations and the number of calculations in each stage are determined, butterfly calculations are performed and the output data group is generated, and the data address information is calculated using hardware circuits to reduce software algorithm calculations.
It improves the speed and efficiency of FFT calculation, reduces the time-consuming and power consumption of butterfly calculation.
Smart Images

Figure CN119781952A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing, and in particular to a Fourier transform data processing method and a microprocessor chip. Background Art
[0002] FFT (Fast Fourier Transform) is an efficient algorithm of DFT (Discrete Fourier Transform), which is widely used in digital signal processing, digital communication, audio and video multimedia processing and other fields.
[0003] The basic idea of FFT is to decompose the original N-point sequence into a series of short sequences in turn. The symmetry and periodicity of the exponential factors in the DFT calculation formula are fully utilized to calculate the corresponding DFT of these short sequences and make appropriate combinations to achieve the purpose of deleting repeated calculations, reducing multiplication calculations and simplifying the structure.
[0004] In some technologies, software can be used to perform FFT calculations. However, this method requires a large number of operations such as shifting, addition and subtraction, and bit operations, resulting in a large number of instruction cycles, which makes the processing speed slow. In addition, this method requires frequent memory reading, resulting in high power consumption, making the FFT calculation less efficient. Summary of the invention
[0005] In view of this, the present application provides a Fourier transform data processing method and a microprocessor chip to help solve the problem of low FFT calculation efficiency in the prior art.
[0006] In a first aspect, an embodiment of the present application provides a Fourier transform data processing method, comprising: acquiring a first data group; the first data group comprising a plurality of input data; determining the number of calculation stages included in the butterfly calculation and the number of butterfly calculations included in each calculation stage based on the number of input data included in the first data group; performing butterfly calculation on the first data group to generate a second data group; wherein, when performing butterfly calculation on the first data group, based on the number of calculation stages and the number of butterfly calculations included in each calculation stage, determining the address information of the data for each butterfly calculation; the second data group comprising a plurality of output data; reversing the index identifiers of the output data included in the second data group to obtain a target data group.
[0007] In a possible implementation of the first aspect, performing butterfly calculation on the first data group to generate the second data group includes: for each calculation stage during the butterfly calculation, when performing the i-th butterfly calculation, obtaining the butterfly index identifier corresponding to the i-th butterfly calculation; wherein i is an integer greater than 0; determining the initial data index identifier of the first data and the initial data index identifier of the second data based on the butterfly index identifier; adjusting the data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data respectively to obtain the target data index identifier of the first data and the target data index identifier of the second data; determining the address information of the first data and the address information of the second data based on the target data index identifier of the first data and the target data index identifier of the second data; performing the butterfly calculation based on the address information of the first data and the address information of the second data to obtain the first result and the second result, and storing the first result based on the address information of the first data, and storing the second result based on the address information of the second data.
[0008] In a possible implementation of the first aspect, the data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted respectively to obtain the target data index identifier of the first data and the target data index identifier of the second data, including: the input data in the first data group is time domain data, and for each calculation stage between the first calculation stage to the mth calculation stage, the stage identifier of the calculation stage is determined; m is the number of calculation stages; in the initial data index identifier, in order of data bits from low to high, the first data bit in the initial data index identifier of the first data and the initial data index identifier of the second data are determined as the first data part, the second data bit to the j+1th data bit are determined as the second data part, and the j+2th data bit to the mth data bit are determined as the third data part; wherein j is the stage identifier of the calculation stage; the first data part, the second data part and the third data part are arranged in a first preset order to obtain the target data index identifier of the first data and the target data index identifier of the second data, respectively.
[0009] In a possible implementation of the first aspect, the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted respectively to obtain the target data index identifier of the first data and the target data index identifier of the second data, including: the input data in the first data group is time domain data, and for the first calculation stage, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively processed in reverse order to obtain the target data index identifier of the first data and the target data index identifier of the second data.
[0010] In a possible implementation of the first aspect, the data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted respectively to obtain the target data index identifier of the first data and the target data index identifier of the second data, including: the input data in the first data group is time domain data, and for the mth calculation stage, in the initial data index identifier, in the order of data bits from low to high, the first data bit in the initial data index identifier of the first data and the initial data index identifier of the second data are respectively determined as the fourth data part, and the second data bit to the mth data bit are determined as the fifth data part; the fourth data part and the fifth data part are arranged according to a second preset order to obtain the target data index identifier of the first data and the target data index identifier of the second data, respectively.
[0011] In a possible implementation of the first aspect, it also includes: determining a first shift number based on the number of calculation stages, performing a first shift processing on the preset first reference data based on the first shift number to obtain a first target reference data; for each calculation stage between the first calculation stage to the mth calculation stage, determining a stage identifier of the calculation stage; for each butterfly calculation in the calculation stage, determining a second shift number according to the stage identifier of the calculation stage and the number of calculation stages; performing a second shift processing on the butterfly index identifier of the butterfly calculation according to the second shift number to obtain a first value; determining the address information of the rotation factor corresponding to the butterfly calculation according to the first value and the first target reference data; performing the butterfly calculation corresponding to the butterfly index identifier based on the address information of the first data and the address information of the second data to obtain the first result and the second result includes: obtaining the first data, the second data and the rotation factor corresponding to the butterfly index identifier based on the address information of the first data, the address information of the second data and the address information of the rotation factor corresponding to the butterfly index identifier; performing butterfly calculation according to the first data, the second data and the rotation factor to obtain the first result and the second result.
[0012] In a possible implementation of the first aspect, the data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted respectively to obtain the target data index identifier of the first data and the target data index identifier of the second data, including: the input data in the first data group is frequency domain data, and the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are determined according to the number of calculation stages and in the order of the data bits of the initial data index identifier from low to high; the number of adjustments k is determined according to the stage identifier of the calculation stage, and the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted k times according to preset rules to obtain the target data index identifier of the first data and the target data index identifier of the second data.
[0013] In a possible implementation manner of the first aspect, it also includes: for each calculation stage, determining the stage identifier of the calculation stage; determining the third shift number of the calculation stage based on the stage identifier of the calculation stage; performing a third shift processing on the preset second reference data according to the third shift number to obtain second target reference data; for each butterfly calculation in the calculation stage, determining the address information of the rotation factor of the butterfly calculation according to the butterfly index identifier and the second target reference data; performing the butterfly calculation based on the address information of the first data and the address information of the second data to obtain the first result and the second result includes: obtaining the first data, the second data and the rotation factor corresponding to the butterfly calculation based on the address information of the first data, the address information of the second data and the address information of the rotation factor; performing the butterfly calculation according to the first data, the second data and the rotation factor to obtain the first result and the second result, using the special distribution of the rotation factor, the first stage of the DIT algorithm and the last stage of the DIF algorithm, the rotation factor is 1, at this time, there is no need to obtain the rotation factor, nor to calculate the complex multiplication, and these two special stages can be processed separately to improve the overall calculation efficiency.
[0014] In a possible implementation manner of the first aspect, the acquiring the butterfly index identifier corresponding to the i-th butterfly calculation includes: acquiring the butterfly index identifier corresponding to the i-th butterfly calculation from one of a first storage module and a second storage module; wherein, when i is greater than 2, the butterfly index identifier corresponding to the i-th butterfly calculation is acquired based on the butterfly index identifier corresponding to the i-1-th butterfly calculation, and the butterfly index identifier corresponding to the i-1-th butterfly calculation is stored in the other of the first storage module and the second storage module;
[0015] The butterfly index identifier stored in the other one is updated according to the butterfly index identifier corresponding to the i-th butterfly calculation; wherein the updated butterfly index identifier in the other one is the butterfly index identifier corresponding to the i+1-th butterfly calculation.
[0016] In a possible implementation of the first aspect, the first storage module pre-stores a butterfly index identifier corresponding to the first butterfly calculation, and the second storage module pre-stores a butterfly index identifier corresponding to the second butterfly calculation; obtaining the butterfly index identifier corresponding to the i-th butterfly calculation also includes: when i is 1, obtaining the butterfly index identifier corresponding to the first butterfly calculation from the first storage module; when i is 2, obtaining the butterfly index identifier corresponding to the second butterfly calculation from the second storage module; updating the butterfly index identifier stored in the first storage module according to the butterfly index identifier corresponding to the second butterfly calculation, and using the above storage method to maintain the counter, thereby reducing the number of instructions in the loop.
[0017] In a possible implementation of the first aspect, for each calculation stage, the butterfly index identifier corresponding to the first butterfly calculation is the maximum value among the butterfly index identifiers corresponding to the butterfly calculations contained in the calculation stage; the butterfly index identifier corresponding to the second butterfly calculation is the second largest value among the butterfly index identifiers corresponding to the butterfly calculations contained in the calculation stage, and the loop in the assembly uses a counting method from the maximum index value to 0, so that comparison instructions are no longer required in the loop, which also reduces the number of instructions in the loop.
[0018] In a second aspect, an embodiment of the present application provides a microprocessor chip, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of the first aspects above is implemented.
[0019] Adopt the scheme provided by the embodiment of the present application, obtain a first data group, the first data group includes a plurality of input data; determine the number of calculation stages included in the butterfly calculation and the number of butterfly calculations included in each calculation stage based on the number of input data included in the first data group; perform butterfly calculation on the first data group to generate a second data group; wherein, when performing butterfly calculation on the first data group, determine the address information of the data for each butterfly calculation based on the number of calculation stages and the number of butterfly calculations included in each calculation stage; perform reverse processing on the output data included in the second data group to obtain the target data group. In this way, in the embodiment of the present application, when performing butterfly calculation, the address information of the data required for each butterfly calculation can be directly calculated according to the number of calculation stages and the number of butterfly calculations included in each calculation stage, and then the data for butterfly calculation can be obtained according to the address information, so as to perform butterfly calculation. The above process does not need to use software algorithm to calculate the address information, which greatly reduces the time consumption of butterfly calculation, improves the calculation speed of butterfly calculation, and thus improves the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0021] Figure 1 A flowchart of a Fourier transform data processing method provided in an embodiment of the present application;
[0022] Figure 2 A schematic diagram of a scenario of a Fourier transform data processing method provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of another scenario of a Fourier transform data processing method provided in an embodiment of the present application;
[0024] Figure 4 A schematic diagram of another scenario of a Fourier transform data processing method provided in an embodiment of the present application;
[0025] Figure 5 A schematic diagram of the structure of a microprocessor chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0027] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0028] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0029] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0030] FFT is an efficient algorithm of DFT, which is widely used in digital signal processing, digital communication, audio and video multimedia processing and other fields. In order to better process data, it is usually necessary to perform FFT transformation on the data to obtain the required frequency domain data. In the related art, software can be used for FFT calculation. However, this method requires a large number of operations such as shifting, addition and subtraction, and bit operations, resulting in a large number of instruction cycles, which makes the processing speed slower. In addition, this method requires frequent reading of memory, resulting in high power consumption, which makes the efficiency of FFT calculation low.
[0031] The embodiment of the present application provides a Fourier transform data processing method and chip, the method specifically comprises: obtaining a first data group, the first data group includes a plurality of input data; determining the number of calculation stages included in the butterfly calculation and the number of butterfly calculations included in each calculation stage based on the number of input data included in the first data group; performing butterfly calculation on the first data group to generate a second data group; wherein, when performing butterfly calculation on the first data group, based on the number of calculation stages and the number of butterfly calculations included in each calculation stage, determining the address information of the data for each butterfly calculation; performing reverse processing on the output data included in the second data group to obtain a target data group. In this way, in the embodiment of the present application, when performing butterfly calculation, the address information of the data required for each butterfly calculation can be directly calculated according to the number of calculation stages and the number of butterfly calculations included in each calculation stage, and then the data for butterfly calculation can be obtained according to the address information, so as to perform butterfly calculation. In the above process, the calculation of the address information of the data for butterfly calculation can be realized by hardware circuit, without using software algorithm to calculate the address information, which greatly reduces the time consumption of butterfly calculation, improves the calculation speed of butterfly calculation, and thus improves the calculation efficiency. The details are described below.
[0032] See also Figure 1 , is a flow chart of a Fourier transform data processing method provided in an embodiment of the present application. Figure 1 As shown, the method includes:
[0033] Step S101: Acquire a first data group.
[0034] The first data group includes a plurality of input data.
[0035] In an embodiment of the present application, it is necessary to first obtain input data for Fourier transform. The user can pre-set the data that needs to be Fourier transformed, and use the data pre-set by the user as input data, and multiple input data constitute a first data group. In some embodiments, the first data group can be obtained by data acquisition. For example, the signal or data to be processed can be collected to obtain a first data group. In some embodiments, time domain data can be collected to obtain a first data group. In other embodiments, frequency domain data can be collected to obtain a first data group. That is, the input data in the first data group can be time domain data or frequency domain data, which can be obtained according to the actual needs of the user.
[0036] In some embodiments, the first data set includes 2 ainput data. Wherein, a is an integer greater than 1. For example, if a is 3, the first data group includes 8 input data, or if a is 4, 16 input data, or if a is 5, 32 input data. Of course, a can also be other data, and the embodiment of the present application does not limit this.
[0037] In some embodiments, the acquired first data group may be cached in a third storage module. Different input data in the first data group may have different storage locations in the third storage module.
[0038] Step S102: determining the number of calculation stages included in the butterfly calculation and the number of butterfly calculations included in each calculation stage based on the number of input data included in the first data group.
[0039] In an embodiment of the present application, after obtaining the first data group, the first data group contains multiple input data, and it is necessary to perform Fourier transform on the input data. In order to reduce the computational complexity of Fourier transform in an embodiment of the present application, Fourier transform can be performed on the input data by butterfly calculation. When performing butterfly calculation, the number of calculation stages (stages) of butterfly calculation and the number of butterfly calculations contained in each calculation stage can be determined according to the number of input data contained in the first data group.
[0040] In some embodiments, the number of calculation stages of the butterfly calculation can be determined based on the number of input data included in the first data group according to the formula b=log2N, where b is the number of calculation stages and N is the number of input data included in the first data group.
[0041] In some embodiments, the number of butterfly calculations to be calculated in each calculation stage can be determined based on the number of input data included in the first data group according to the formula c=N / 2, where c is the number of butterfly calculations included in each calculation stage.
[0042] For example, when the first data group includes 8 input data, according to the formula b=log28, the number of calculation stages in the butterfly calculation can be calculated to be 3; according to the formula c=8 / 2, the number of butterfly calculations included in each calculation stage can be calculated to be 4. That is, when the first data group includes 8 input data, 3 calculation stages are required when performing butterfly calculation on the 8 input data, and each calculation stage includes 4 butterfly calculations.
[0043] Step S103: Perform butterfly calculation on the first data set to generate a second data set.
[0044] When the butterfly calculation is performed on the first data group, the address information of the data for each butterfly calculation is determined based on the number of calculation stages and the number of butterfly calculations included in each calculation stage. The second data group includes a plurality of output data.
[0045] In an embodiment of the present application, after obtaining the first data group, a butterfly calculation can be performed on the input data in the first data group to generate a second data group. When the butterfly calculation is performed on the input data in the first data group, different data needs to be obtained in different butterfly calculations. Therefore, each time the butterfly calculation is performed, the address information of the data for butterfly calculation needs to be determined to obtain the data for butterfly calculation. In an embodiment of the present application, the address information of the data for butterfly calculation each time can be determined based on the number of calculation stages obtained in the above steps and the number of butterfly calculations contained in each calculation stage.
[0046] In the embodiment of the present application, the address information of the data for each butterfly calculation can be determined by the hardware circuit according to the number of calculation stages and the number of butterfly calculations included in each calculation stage. For example, the hardware circuit includes a plurality of logic gates, and the address information of the data for each butterfly calculation can be determined according to the number of calculation stages and the number of butterfly calculations included in each calculation stage through the operation of the logic gates.
[0047] In some embodiments, performing butterfly calculation on the first data set to generate the second data set includes:
[0048] For each calculation stage during butterfly calculation, when performing the i-th butterfly calculation, a butterfly index identifier corresponding to the i-th butterfly calculation is obtained, where i is an integer greater than 0.
[0049] Based on the butterfly index identifier, an initial data index identifier of the first data and an initial data index identifier of the second data are determined.
[0050] The data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data are respectively adjusted to obtain the target data index identifier of the first data and the target data index identifier of the second data.
[0051] The address information of the first data and the address information of the second data are determined based on the target data index identifier of the first data and the target data index identifier of the second data.
[0052] A butterfly calculation corresponding to the butterfly index identifier is performed based on the address information of the first data and the address information of the second data to obtain a first result and a second result, and the first result is stored based on the address information of the first data, and the second result is stored based on the address information of the second data.
[0053] In an embodiment of the present application, when butterfly calculation is performed on the first data group, it is usually divided into b calculation stages. Each calculation stage needs to perform c butterfly calculations. Each time the butterfly calculation is continued, the address information of the data to be butterfly calculated must be determined first. At this time, for each calculation stage during the butterfly calculation, when the i-th butterfly calculation of the calculation stage is required, the butterfly index identifier corresponding to the i-th butterfly calculation can be first obtained. In some embodiments, the butterfly index identifier corresponding to the i-th butterfly calculation can usually be set to i-1. Of course, the butterfly index identifier corresponding to the i-th butterfly calculation can be set to other identifiers, and the embodiment of the present application does not limit this. In an embodiment of the present application, the butterfly index identifier corresponding to the i-th butterfly calculation is set to i-1 as an example for explanation. After obtaining the butterfly index identifier of the i-th butterfly calculation, the initial data index identifier of the first data and the initial data index identifier of the second data can be calculated according to the butterfly index identifier of the i-th butterfly calculation. In some embodiments, the initial data index identifier of the first data can be twice the butterfly index identifier. The initial data index identifier of the second data is the sum of the initial data index identifier of the first data and the first preset value. For example, the first preset value is 1, and at this time, the initial data index identifier of the second data is the sum of the initial data index identifier of the first data and 1. Of course, the preset data value can also be other values, such as 2, 3 or other values, which is not limited in the embodiment of the present application.
[0054] It should be noted that the method of determining the initial data index identifier of the first data and the initial data index identifier of the second data according to the butterfly index identifier may also be other methods. For example, a value 3 times or 4 times the butterfly index identifier may be used as the initial data index identifier of the first data, and the sum of the value 3 times or 4 times the butterfly index identifier and the first preset value may be used as the initial data index identifier of the second data. Of course, other methods may also be used, and the embodiments of the present application are not limited to this.
[0055] After determining the initial data index identifier of the first data and the initial data index identifier of the second data, the data sequence of the initial data index identifier of the first data can be adjusted, and the data sequence of the initial data index identifier of the second data can be adjusted, wherein the data sequence adjustment method can be preset. In this way, the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data can be adjusted according to the preset data sequence adjustment method. The identifiers after the data sequence adjustment are used as the target data index identifier of the first data and the target data index identifier of the second data.
[0056] It should be understood that data bit sequence adjustment is to adjust each data bit of the index identifier. In some embodiments, in order to facilitate data bit sequence adjustment, the index identifier can be converted into a binary number, and the data bit sequence adjustment is performed on the binary index identifier.
[0057] After obtaining the target data index identifier of the first data and the target data index identifier of the second data, the address information of the first data and the address information of the second data can be calculated according to the target data index identifier of the first data and the target data index identifier of the second data, so that the first data and the second data can be obtained according to the address information of the first data and the address information of the second data, and the first data and the second data can be butterfly calculated to obtain the first result and the second result. The first result can be stored according to the address information of the first data, and the second result can be stored according to the address information of the second data, so that the first result and the second result can be obtained when the butterfly calculation in the next calculation stage is performed.
[0058] In some embodiments, after obtaining the first data group and caching the first data group, base address information corresponds to its cache location, so that after calculating the target data index identifier of the first data and the target data index identifier of the second data, the address information of the first data and the address information of the second data can be calculated based on the target data index identifier of the first data and the target data index identifier of the second data and the base address information.
[0059] It should be noted that when performing butterfly calculation, when the number of input data in the first data group is determined, the data index identifier for each butterfly calculation performed in each calculation stage can also be determined.
[0060] The following description is made by taking the first data group containing 8 input data as an example. Assume that the data index identifiers of the 8 input data are 0, 1, 2, 3, 4, 5, 6, and 7 respectively; when the first data group is cached, the storage address of each input data is usually determined based on the base address at the cache location and the data index identifier of the input data, and the data is stored.
[0061] When the input data included in the first data group is time domain data, during the butterfly calculation, the data index identifiers corresponding to different butterfly calculations in each calculation stage are as shown in Table 1 and Figure 2 shown.
[0062]
[0063] Table 1
[0064] When the input data included in the first data group is frequency domain data, during the butterfly calculation, the data index identifiers corresponding to different butterfly calculations in each calculation stage are as shown in Table 2 and Figure 3 shown.
[0065]
[0066] Table 2
[0067] In order to more clearly introduce the butterfly calculation, the first butterfly calculation in the first calculation stage of Table 1 is used as an example for explanation. When performing the first butterfly calculation in Stage0, according to Table 1, in the first butterfly calculation process, the data with data index identifiers of 0 and 4 are subjected to butterfly calculation. Because in the embodiment of the present application, the initial data index identifier of the first data and the initial data index identifier of the second data are determined according to the butterfly index identifier. The determined initial data index identifier of the first data and the initial data index identifier of the second data are not correct. For example, in this example, the initial data index identifier of the first data is twice the butterfly index identifier, and the initial data index identifier of the second data is the sum of the initial data index identifier of the first data and 1. At this time, the initial data index identifier of the first data is 0, and the initial data index identifier of the second data is 1. The initial data index identifier of the first data and the initial data index identifier of the second data are not the same as the data index identifiers 0 and 4 that need to perform the first butterfly calculation. Therefore, the initial data index identifier of the first data and the initial data index identifier of the second data are not correct. The data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data can be adjusted to obtain the correct data index identifier. For example, the bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data can be reversed, the initial data index identifier of the first data is 0, and it is still 0 after the reverse processing, and the value of the initial data index identifier of the first data after the reverse processing is used as the target data index identifier of the first data. The initial data index identifier of the second data is 1, and it is 4 after the reverse processing, and the value of the initial data index identifier of the second data after the reverse processing is used as the target data index identifier of the second data, so that the target data index identifier of the first data is 0, and the target data index identifier of the second data is 4, which is the data index identifier of the first butterfly calculation. At this time, the address information of the first data and the address information of the second data can be calculated according to the base address, the target data index identifier of the first data, and the target data index identifier of the second data. For example, the sum of the base address and the target data index identifier of the first data can be used as the address information of the first data, and the sum of the base address and the target data index identifier of the second data can be used as the address information of the second data. According to the address information of the first data and the address information of the second data, the first data and the second data are obtained, and the first data and the second data are subjected to butterfly calculation to obtain the first result and the second result, and the first result is stored in the storage location indicated by the address information of the first data, and the second result is stored in the storage location indicated by the address information of the second data. In other words, during the butterfly calculation process, the calculated result can be stored correspondingly to the storage location when the data is read.
[0068] It should be understood that the butterfly calculation process corresponding to Table 2 can refer to the above process, which will not be repeated here.
[0069] It should be noted that the order of butterfly calculations in each calculation stage is not limited to the order shown in Tables 1 and 2, and can be adjusted according to actual needs. For example, in Table 1, the first butterfly calculation may not be data with data index identifiers of 0 and 4, but data with data index identifiers of 1 and 5. Of course, it can also be data with other data index identifiers, and the embodiments of the present application do not limit this.
[0070] In order to more accurately calculate the index identifier of the data to be butterfly-calculated in different calculation stages, different data bit sequence adjustment methods can be set for different calculation stages. As a possible method, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively adjusted in data sequence to obtain the target data index identifier of the first data and the target data index identifier of the second data, including:
[0071] The input data in the first data group is time domain data, and for each calculation stage between the first calculation stage and the mth calculation stage, a stage identifier of the calculation stage is determined, where m is the number of calculation stages.
[0072] In the initial data index identifier, according to the order of data bits from low to high, the first data bit in the initial data index identifier of the first data and the initial data index identifier of the second data is determined as the first data part, the second data to the j+1th data bit is determined as the second data part, and the j+2th data bit to the mth data bit is determined as the third data part. Wherein, j is the stage identifier of the calculation stage.
[0073] The first data portion, the second data portion and the third data portion are arranged according to a first preset order to obtain a target data index identifier for the first data and a target data index identifier for the second data respectively.
[0074] In an embodiment of the present application, the input data in the first data group can be time domain data or frequency domain data, and the methods for adjusting the data sequence for frequency domain data and time domain data are also different. When the input data in the first data group is time domain data, for each calculation stage between the first calculation stage and the mth calculation stage, the stage identifier of the calculation stage is determined. In some embodiments, the stage identifier of the j+1th calculation stage can usually be set to j. Wherein, j is an integer greater than 0 and less than m-1. Of course, the stage identifier of the jth calculation stage can also be set to other identifiers, and the embodiment of the present application does not limit this. In an embodiment of the present application, the stage identifier of the j+1th calculation stage is set to j as an example for explanation.
[0075] In the initial data index identifier, according to the order of data bits from low to high, the first data bit in the initial data index identifier of the first data is determined as the first data part, the second data bit to the j+1th data bit in the initial data index identifier of the first data is determined as the second data part, and the j+2th data bit to the mth data bit in the initial data index identifier of the first data is determined as the third data part. For example, the first data group contains 16 input data, and the number of stages of the determined calculation stage is 4, that is, the value of m is 4. Assuming that the initial data index identifier of the first data is 0101, and j is 2, then according to the order of data bits from low to high, the first data bit in the initial data index identifier of the first data, that is, the lowest bit 1, is determined as the first data part, and the second data bit to the j+1th data bit in the initial data index identifier of the first data, that is, 0,1, is determined as the second data part. The j+2th data bit to the mth data bit in the initial data index identifier of the first data is determined as the third data part. Since the j+2th data bit is the mth data bit, that is, the most significant data bit 0 is determined as the third data part.
[0076] Similarly, the first data bit in the initial data index identifier of the second data is determined as the first data part, the second data bit to the j+1th data bit in the initial data index identifier of the second data is determined as the second data part, and the j+2th data bit to the mth data bit in the initial data index identifier of the second data is determined as the third data part.
[0077] Arrange the first data part, the second data part and the third data part determined in the first data according to the first preset order to obtain the target data index mark of the first data. Arrange the first data part, the second data part and the third data part determined in the second data according to the first preset order to obtain the target data index mark of the second data. In some embodiments, the above-mentioned first preset order can be the order of the second data part, the first data part and the third data part. That is, sort the first data part, the second data part and the third data part determined in the first data according to the order of the second data part, the first data part and the third data part to obtain the target data index mark of the first data. Sort the first data part, the second data part and the third data part determined in the second data according to the order of the second data part, the first data part and the third data part to obtain the target data index mark of the second data. In other words, the initial data index mark of the first data can be adjusted in the above manner to obtain the target data index mark of the first data, and the initial data index mark of the second data can be adjusted in the above manner to obtain the target data index mark of the second data.
[0078] As shown in the above example, after determining that the first data part of the initial data index identifier of the first data is 1, the second data part is 0,1, and the third data part is 0, the first data part, the second data part, and the third data part can be sorted in the order of the second data part, the first data part, and the third data part, and the target data index identifier of the first data is 0110, which is a binary number and can be converted into a decimal number of 6.
[0079] It should be understood that when adjusting the data bit sequence of the initial data index identifier, for the convenience of implementation, the initial data index identifier can be converted into a binary number before the data bit sequence adjustment is performed.
[0080] It should be noted that the first pre-order is an arrangement method for adjusting the data bit sequence of the first data part, the second data part and the third data part pre-set by the user according to actual needs, and the embodiment of the present application does not limit this.
[0081] Other data bit sequence adjustment methods may be used for other calculation stages. As a possible implementation method, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively adjusted to obtain the target data index identifier of the first data and the target data index identifier of the second data, including:
[0082] The input data in the first data group is time domain data. For the first calculation stage, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively processed in reverse order to obtain the target data index identifier of the first data and the target data index identifier of the second data.
[0083] In an embodiment of the present application, when the input data in the first data group is time domain data, for the first calculation stage, the initial data index identifier of the first data and the initial data index identifier of the second data can be respectively processed in reverse order, and the data after the initial data index identifier of the first data is processed in reverse order is used as the target data index identifier of the first data, and the data after the initial data index identifier of the second data is processed in reverse order is used as the target data index identifier of the second data. As described in the above example, the first data group contains 16 input data. Assuming that the initial data index identifier of the first data in the first calculation stage is 0, it is converted to a binary number of 0000, and the initial data index identifier of the second data is 1, which is converted to a binary number of 0001. The initial data index identifier of the first data is processed in reverse order, and the data index identifier after the inversion is still 0000. The initial data index identifier of the second data is processed in reverse order, and the data index identifier after the inversion is 1000. It can be determined that the target data index identifier of the first data is 0000, which is converted to decimal as 0, and the target data index identifier of the second data is 1000, which is converted to decimal as 8.
[0084] It should be noted that when performing binary number conversion, the number of valid bits of the binary number is the same as the number of stages in the calculation stage. For example, when the first data group contains 8 input data, the number of stages in the calculation stage is 3. At this time, the initial data index identifier of the first data and the initial data index identifier of the second data are both converted into binary numbers with 3 valid data bits. When the first data group contains 16 input data, the number of stages in the calculation stage is 4. At this time, the initial data index identifier of the first data and the initial data index identifier of the second data are both converted into binary numbers with 4 valid data bits.
[0085] Other data bit sequence adjustment methods may be used for other calculation stages. As a possible implementation method, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively adjusted to obtain the target data index identifier of the first data and the target data index identifier of the second data, including:
[0086] The input data in the first data group is time domain data. For the mth calculation stage, in the initial data index identifier, in the order of data bits from low to high, the first data bit in the initial data index identifier of the first data and the initial data index identifier of the second data are respectively determined as the fourth data part, and the second data bit to the mth data bit are determined as the fifth data part.
[0087] The fourth data portion and the fifth data portion are arranged according to a second preset sequence to obtain a target data index identifier of the first data and a target data index identifier of the second data, respectively.
[0088] In an embodiment of the present application, when the input data in the first data group is time domain data, for the mth calculation stage, that is, the last calculation stage, the first data bit in the initial data index identifier of the first data can be determined as the fourth data part in the order of data bits from low to high in the initial data index identifier, and the second data bit to the mth data bit in the initial data index identifier of the first data can be determined as the fifth data part. For example, the first data group contains 16 input data, and the number of stages of the determined calculation stage is 4, that is, the value of m is 4. For the fourth calculation stage, assuming that the initial data index identifier of the first data is 1001, and then in the order of data bits from low to high, the first data bit in the initial data index identifier of the first data, that is, the lowest bit 1, is determined as the fourth data part, and the second data bit to the mth data bit in the initial data index identifier of the first data, that is, 001, is determined as the fifth data part.
[0089] Similarly, the first data bit in the initial data index identifier of the second data is determined as the fourth data portion, and the second data bit to the mth data bit in the initial data index identifier of the second data is determined as the fifth data portion.
[0090] Arrange the fourth data part and the fifth data part determined by the first data according to the second preset order to obtain the target data index identifier of the first data. Arrange the fourth data part and the fifth data part determined by the second data according to the second preset order to obtain the target data index identifier of the second data. In some embodiments, the above-mentioned second preset order can be the order of the fifth data part and the fourth data part. That is, sort the fourth data part and the fifth data part determined in the first data according to the order of the fifth data part and the fourth data part to obtain the target data index identifier of the first data. Sort the fourth data part and the fifth data part determined in the second data according to the order of the fifth data part and the fourth data part to obtain the target data index identifier of the second data. In other words, the target data index identifier of the first data can be obtained by adjusting the data bit sequence of the initial data index identifier of the first data in the above manner, and the target data index identifier of the second data can be obtained by adjusting the data bit sequence of the initial data index identifier of the second data in the above manner.
[0091] As shown in the above example, after determining that the fourth data part of the initial data index identifier of the first data is 1 and the fifth data part is 001, the fourth data part and the fifth data part can be sorted in the order of the fifth data part and the fourth data part, and the target data index identifier of the first data is 0011. This value is a binary number and can be converted into a decimal number of 3.
[0092] It should be noted that the second pre-order is an arrangement method for adjusting the data bit sequence of the fourth data part and the fifth data part pre-set by the user according to actual needs, and the embodiment of the present application does not limit this.
[0093] When the input data in the first data group is time domain data, the data bit sequence adjustment of the initial data index identifier of the first data and the initial data index identifier of the second data can be illustrated by the following Table 3. In Table 3, the target data index identifier of the first data is represented by α, and the target data index identifier of the second data is represented by β.
[0094]
[0095] Table 3
[0096] For a clearer explanation, the following is an example of the first data group containing 8 input data. The 8 input data contained in the first data group are all time domain data. At this time, the first data group needs to perform 3 calculation stages, and each calculation stage contains 4 butterflies. Assume that the butterfly index identifiers of the 4 butterflies contained in each calculation stage are 0, 1, 2, and 3 respectively. In this way, the data initial index identifier of the first data and the data initial index identifier of the second data can be calculated according to Norm0=Btf I dx*2 and Norm1=Btf I dx*2+1 respectively. Among them, Norm0 represents the initial data index identifier of the first data; Norm1 represents the initial data index identifier of the second data; Btf I dx represents the butterfly index identifier. Norm0Rev represents Norm0 after reverse processing, and Norm1Rev represents Norm1 after reverse processing, as shown in Table 4.
[0097]
[0098]
[0099] Table 4
[0100] For the butterfly calculation of the first calculation stage, for the first butterfly calculation, its butterfly index identifier is 0. At this time, it can be calculated that Norm0=0 and Norm1=1, and Norm0 and Norm1 can be converted into binary numbers 000 and 001. The data bits of Norm0 and Norm1 are processed in reverse order, and the target data index identifier of the first data is 000 and the target data identifier of the second data is 100, that is, the target data index identifier of the first data is 0 and the target data identifier of the second data is 4. For the second butterfly calculation, its butterfly index identifier is 1. At this time, it can be calculated that Norm0=2 and Norm1=3. Norm0 and Norm1 can be converted into binary numbers 010 and 011. The data bits of Norm0 and Norm1 are processed in reverse order, and the target data index identifier of the first data is 010 and the target data identifier of the second data is 110, that is, the target data index identifier of the first data is 2 and the target data identifier of the second data is 6. For the third butterfly calculation, its butterfly index is 2. At this time, it can be calculated that Norm0=4 and Norm1=5. Norm0 and Norm1 can be converted into binary numbers 100 and 101. The data bits of Norm0 and Norm1 are processed in reverse order, and the target data index of the first data is 001 and the target data of the second data is 101, that is, the target data index of the first data is 1 and the target data of the second data is 5. For the fourth butterfly calculation, its butterfly index is 3. At this time, it can be calculated that Norm0=6 and Norm1=7. Norm0 and Norm1 can be converted into binary numbers 110 and 111. The data bits of Norm0 and Norm1 are processed in reverse order, and the target data index of the first data is 011 and the target data of the second data is 111, that is, the target data index of the first data is 3 and the target data of the second data is 7.
[0101] For the butterfly calculation in the second calculation stage, for the first butterfly calculation, its butterfly index is 0. At this time, it can be calculated that Norm0=0, Norm1=1, Norm0 and Norm1 can be converted into binary numbers 000 and 001, and the data bit sequence of Norm0 and Norm1 is reversed. The index identifiers of the data after the reverse processing are respectively represented by Norm0Rev and Norm1Rev, that is, Norm0Rev is 0 and Norm1Rev is 4. The data bits of Norm0 and Norm1 are arranged in order from low to high, and the first data bit is determined as the first data part, the second data bit is determined as the second data part, and the third data bit is determined as the third data part. The first data part of Norm0 is 0, the second data part is 0, and the third data part is 0. The first data part of Norm1 is 1, the second data part is 0, and the third data part is 0. The first data part, the second data part, and the third data part are sorted in the order of the second data part, the first data part, and the third data part, so that the target data index of the first data after the bit sequence is adjusted is 000 and the target data index of the second data is 010, that is, the target data index of the first data is 0 and the target data index of the second data is 2. For the second butterfly calculation, its butterfly index is 1. At this time, it can be calculated that Norm0=2, Norm1=3, Norm0 and Norm1 can be converted into binary numbers 010 and 011, and the data bits of Norm0 and Norm1 are reversed to obtain Norm0Rev as 2 and Norm1Rev as 6. The data bits of Norm0 and Norm1 are arranged in order from low to high, and the first data bit is determined as the first data part, the second data bit is determined as the second data part, and the third data bit is determined as the third data part. The first data part of Norm0 is 0, the second data part is 1, and the third data part is 0. The first data part of Norm1 is 1, the second data part is 1, and the third data part is 0. The first data part, the second data part, and the third data part are sorted in the order of the second data part, the first data part, and the third data part, so that the target data index of the first data after the bit sequence is adjusted is 100 and the target data index of the second data is 110, that is, the target data index of the first data is 4 and the target data index of the second data is 6. For the third butterfly calculation, its butterfly index is 2. At this time, it can be calculated that Norm0=4, Norm1=5, Norm0 and Norm1 can be converted into binary numbers 100 and 101, and the data bits of Norm0 and Norm1 are reversed to obtain Norm0Rev as 1 and Norm1Rev as 5.The data bits of Norm0 and Norm1 are respectively arranged in order from low to high, and the first data bit is determined as the first data part, the second data bit is determined as the second data part, and the third data bit is determined as the third data part. The first data part of Norm0 is 0, the second data part is 0, and the third data part is 1; the first data part of Norm1 is 1, the second data part is 0, and the third data part is 1. The first data part, the second data part, and the third data part are sorted in the order of the second data part, the first data part, and the third data part, so that the target data index identifier of the first data after the bit sequence is adjusted is 001 and the target data identifier of the second data is 011, that is, the target data index identifier of the first data is 1 and the target data identifier of the second data is 3. For the fourth butterfly calculation, its butterfly index is 3. At this time, it can be calculated that Norm0=6, Norm1=7, Norm0 and Norm1 can be converted into binary numbers 110 and 111, and the data bits of Norm0 and Norm1 are reversed to obtain Norm0Rev 3 and Norm1 7. The data bits of Norm0 and Norm1 are respectively arranged in order from low to high, and the first data bit is determined as the first data part, the second data bit is determined as the second data part, and the third data bit is determined as the third data part. The first data part of Norm0 is 0, the second data part is 1, and the third data part is 1. The first data part of Norm1 is 1, the second data part is 1, and the third data part is 1. The first data part, the second data part, and the third data part are sorted in the order of the second data part, the first data part, and the third data part. Therefore, the target data index identifier of the first data after the bit sequence is adjusted is 101 and the target data identifier of the second data is 111, that is, the target data index identifier of the first data is 5 and the target data identifier of the second data is 7.
[0102] For the butterfly calculation in the third calculation stage, for the first butterfly calculation, its butterfly index is 0. At this time, it can be calculated that Norm0=0, Norm1=1, Norm0 and Norm1 can be converted into binary numbers 000 and 001, and the data bit sequence of Norm0 and Norm1 is reversed. The index identifiers of the data after the reverse processing are respectively represented by Norm0Rev and Norm1Rev, that is, Norm0Rev is 0 and Norm1Rev is 4. The data bits of Norm0 and Norm1 are respectively arranged in order from low to high, and the first data bit is determined as the fourth data part, and the second data bit and the third data bit are determined as the fifth data part. The first data part of Norm0 is 0, the second data part is 00, the fourth data part of Norm1 is 1, and the fifth data part is 00. The fourth data part and the fifth data part are sorted in the order of the fifth data part and the fourth data part, so that the target data index mark of the first data after the bit sequence adjustment is 000 and the target data mark of the second data is 001, that is, the target data index mark of the first data is 0 and the target data mark of the second data is 1. For the second butterfly calculation, its butterfly index mark is 1. At this time, it can be calculated that Norm0=2, Norm1=3, and Norm0 and Norm1 can be converted into binary numbers 010 and 011. The data bits of Norm0 and Norm1 are reversed, and Norm0Rev is 2 and Norm1Rev is 6. The data bits of Norm0 and Norm1 are respectively arranged in order from low to high, and the first data bit is determined as the fourth data part, and the second data bit and the third data bit are determined as the fifth data part. The fourth data part of Norm0 is 0, and the fifth data part is 10, and the fourth data part of Norm1 is 1, and the fifth data part is 10. The fourth data part and the fifth data part are sorted in the order of the fifth data part and the fourth data part, so that the target data index mark of the first data after the bit sequence adjustment is 100 and the target data mark of the second data is 101, that is, the target data index mark of the first data is 4 and the target data mark of the second data is 5. For the third butterfly calculation, its butterfly index mark is 2. At this time, it can be calculated that Norm0=4, Norm1=5, and Norm0 and Norm1 can be converted into binary numbers 100 and 101. The data bits of Norm0 and Norm1 are reversed, and Norm0Rev is 1 and Norm1Rev is 5.The data bits of Norm0 and Norm1 are respectively arranged in order from low to high, and the first data bit is determined as the fourth data part, and the second data bit and the third data bit are determined as the fifth data part. The fourth data part of Norm0 is 0, and the fifth data part is 01, and the fourth data part of Norm1 is 1, and the fifth data part is 01. The fourth data part and the fifth data part are sorted in the order of the fifth data part and the fourth data part, so that the target data index identifier of the first data after the bit sequence adjustment is 010 and the target data identifier of the second data is 011, that is, the target data index identifier of the first data is 2 and the target data identifier of the second data is 3. For the fourth butterfly calculation, its butterfly index identifier is 3. At this time, it can be calculated that Norm0=6 and Norm1=7. Norm0 and Norm1 can be converted into binary numbers 110 and 111. The data bits of Norm0 and Norm1 are processed in reverse order, and Norm0Rev is 3 and Norm1 is 7. The data bits of Norm0 and Norm1 are respectively arranged in order from low to high, and the first data bit is determined as the fourth data part, and the second data bit and the third data bit are determined as the fifth data part. The fourth data part of Norm0 is 0, and the fifth data part is 11. The fourth data part of Norm1 is 1, and the fifth data part is 11. The fourth data part and the fifth data part are sorted in the order of the fifth data part and the fourth data part, so that the target data index identifier of the first data after the bit sequence is adjusted is 110 and the target data identifier of the second data is 111, that is, the target data index identifier of the first data is 6 and the target data identifier of the second data is 7.
[0103] When performing butterfly calculation, it is necessary not only to obtain the data of butterfly calculation, but also to obtain the rotation factor. The rotation factors required for different butterfly calculations are not exactly the same. When performing butterfly calculation on time domain data, the value of the rotation factor used for the butterfly calculation in the first calculation stage is 0, and in the butterfly calculation in the mth calculation stage, the rotation factor of the jth butterfly calculation is the same as the butterfly index identifier of the jth butterfly calculation. Therefore, the rotation factor can be calculated only for each calculation stage between the first calculation stage to the mth calculation stage. Based on this, the above method also includes:
[0104] Determine a first shift number based on the number of calculation stages, and perform a first shift process on the preset first reference data according to the first shift number to obtain the first target reference data. For each calculation stage between the first calculation stage to the mth calculation stage, determine the stage identifier of the calculation stage. For each butterfly index identifier in the calculation stage, determine a second shift number according to the stage identifier of the calculation stage and the number of calculation stages; perform a second shift process on the butterfly index identifier according to the second shift number to obtain a first value; determine the address information of the rotation factor corresponding to the butterfly index identifier according to the first value and the first target reference data.
[0105] In an embodiment of the present application, a pre-set first reference data can be obtained, the first reference data is first adjusted, and then the butterfly index identifier is adjusted using the adjusted first reference data, so as to determine the address information of the rotation factor. Since the number of bits of the rotation factor is different from the number of bits of the initial data index identifier, in order to determine the number of bits of the rotation factor, it is necessary to use the adjusted first reference data for determination. In order to adjust the preset first reference data, it is necessary to obtain the first shift number. In some embodiments, the number of calculation stages can be determined as the first shift number. Of course, the first shift number can also be determined by other methods, for example, it can be pre-set by the user according to actual needs, or determined by other methods, and the embodiment of the present application does not limit this.
[0106] Based on the first shift number, the first shift number is determined, so that the preset first reference data can be subjected to a first shift process according to the first shift number to obtain the first target reference data. In some embodiments, the preset first reference data can be subjected to a right shift process based on the first shift number to obtain the first target reference data. In some embodiments, the preset first reference data can be 0xFFFF. Of course, the first reference data can also be other values, which can be pre-set according to actual needs, and the embodiments of the present application are not limited to this. In some embodiments, the first shift number can be obtained based on the first shift number according to the formula t=17-stage_num. Wherein, stage_num represents the number of calculation stages. Of course, the first shift number can also be determined by other means, and the embodiments of the present application are not limited to this. Assume that the first data group contains 32 input data and the first shift number is 5. At this time, it can be determined that the first shift number is 12, so that the first reference data 0xFFFF can be shifted 12 bits to the right to obtain the first target reference data 0x000F. In this way, for the first data group of 32 input data, the effective data bits of the rotation factor are 4 bits.
[0107] After determining the first target reference data, for each calculation stage between the first calculation stage and the mth calculation stage, for the convenience of explanation, the rotation factor of the wth calculation stage can be obtained as an example for explanation. Wherein, w is an integer greater than 1 and less than m. When calculating the rotation factor of the wth calculation stage, the stage identifier of the wth calculation stage can be determined. For example, the stage identifier of the wth calculation stage can be w-1. After determining the stage identifier of the calculation stage, the rotation factor of the butterfly calculation can be obtained for each butterfly calculation in the calculation stage. The second shift number is determined according to the stage identifier of the calculation stage and the number of calculation stages. In some embodiments, the difference between the number of calculation stages and the stage identifier of the calculation stage and 1 can be used as the second shift number. For example, it is necessary to obtain the rotation factor of the qth butterfly calculation of the wth calculation stage. At this time, the second shift number of the qth butterfly calculation can be determined according to the stage identifier of the wth calculation stage and the number of calculation stages. As described in the above example, when the first data group includes 32 input data, the number of calculation stages is 5. Assume that when calculating the rotation factor of the second calculation stage, the second shift number can be calculated to be 5-2-1, that is, the second shift number is 2. When calculating the rotation factor of the third calculation stage, the second shift number can be calculated to be 5-3-1, that is, the second shift number is 1.
[0108] After determining the second shift number, the butterfly index identifier of the butterfly calculation can be subjected to a second shift process according to the second shift number. In some embodiments, the second shift process can be a left shift. That is, after determining the second shift number, the butterfly index identifier of the butterfly calculation can be shifted to the left by the second shift number to obtain a first value. The first value can be subjected to a first logical operation with the first target reference data to obtain an index identifier of the rotation factor corresponding to the butterfly calculation; the address information of the rotation factor can be determined based on the index identifier of the rotation factor and the base address information.
[0109] In some embodiments, the first logic operation may be an AND operation, that is, the first value and the first target reference data may be ANDed to obtain an index identifier of the rotation factor corresponding to the butterfly calculation.
[0110] In some embodiments, the sum of the index identifier of the rotation factor and the base address information may be used as the address information of the rotation factor.
[0111] As shown in the above example, when the first data group contains 32 input data and the input data are all time domain data, 16 butterfly calculations are required in each calculation stage. When performing the butterfly calculation in the second calculation stage, the address information of the rotation factor is determined according to the index identifier and base address information of the rotation factor. The base address information can be pre-set, so for different butterfly calculations, it is only necessary to calculate the index identifier of the rotation factor. When obtaining the rotation factor of the first butterfly calculation in the second calculation stage, the butterfly index identifier of the first butterfly calculation is 0, which is converted to binary as 0000. The butterfly index identifier 0000 can be shifted two places to the left to obtain a first value of 0000. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 0000, which is converted to a decimal number of 0. When obtaining the rotation factor of the second butterfly calculation of the second calculation stage, the butterfly index identifier of the second butterfly calculation is 1, which is converted to binary as 0001. The butterfly index identifier 0001 can be shifted left by two bits to obtain a first value of 0100. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 0100, which is converted to a decimal number of 4. When obtaining the rotation factor of the third butterfly calculation of the second calculation stage, the butterfly index identifier of the third butterfly calculation is 2, which is converted to binary as 0010. The butterfly index identifier 0010 can be shifted left by two bits to obtain a first value of 1000. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 1000, which is converted to a decimal number of 8. When obtaining the rotation factor of the 4th butterfly calculation in the 2nd calculation stage, the butterfly index identifier of the 4th butterfly calculation is 3, which is converted to binary as 0011. The butterfly index identifier 0011 can be shifted two bits to the left to obtain a first value of 1100. The first value and the first target reference data 0x000F are ANDed to obtain an index identifier of the rotation factor of 1100, which is converted to a decimal number of 12. Similarly, the index identifier of the index factor of the 5th butterfly calculation in the 2nd calculation stage to the index identifier of the 16th butterfly calculation can be calculated. For details, please refer to the process of calculating the index identifier of the index factor of the 1st butterfly calculation in the 2nd calculation stage to the index identifier of the 4th butterfly calculation, which will not be repeated here. Among them, the index identifiers of the rotation factors of the 16 butterfly calculations in the 2nd calculation stage are shown in Table 5 below. In Table 5, Btf_idx represents the butterfly index identifier, and l represents the index identifier of the rotation factor.
[0112] Btf_idx l Btf_idx l Btf_idx l Btf_idx l 0 / 0000 0 / 0000 4 / 0100 0 / 0000 8 / 1000 0 / 0000 12 / 1100 0 / 0000 1 / 0001 4 / 0100 5 / 0101 4 / 0100 9 / 1001 4 / 0100 13 / 1101 4 / 0100 2 / 0010 8 / 1000 6 / 0110 8 / 1000 10 / 1010 8 / 1000 14 / 1110 8 / 1000 3 / 0011 12 / 1100 7 / 0111 12 / 1100 11 / 1011 12 / 1100 15 / 1111 12 / 1100
[0113] Table 5
[0114] Similarly, when obtaining the rotation factor of the first butterfly calculation in the third calculation stage, the butterfly index identifier of the first butterfly calculation is 0, which is converted to binary as 0000. The butterfly index identifier 0000 can be shifted one position to the left to obtain a first value of 0000. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 0000, which is converted to a decimal number of 0. When obtaining the rotation factor of the second butterfly calculation in the third calculation stage, the butterfly index identifier of the second butterfly calculation is 1, which is converted to binary as 0001. The butterfly index identifier 0001 can be shifted one position to the left to obtain a first value of 0010. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 0010, which is converted to a decimal number of 2. When obtaining the rotation factor of the third butterfly calculation of the third calculation stage, the butterfly index identifier of the third butterfly calculation is 2, which is converted to binary as 0010. The butterfly index identifier 0010 can be shifted left by one position to obtain a first value of 0100. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 0100, which is converted to a decimal number of 4. When obtaining the rotation factor of the fourth butterfly calculation of the third calculation stage, the butterfly index identifier of the fourth butterfly calculation is 3, which is converted to binary as 0011. The butterfly index identifier 0011 can be shifted left by one position to obtain a first value of 0110. The first value is ANDed with the first target reference data 0x000F to obtain an index identifier of the rotation factor of 0110, which is converted to a decimal number of 6. Similarly, the index identifier of the index factor of the fifth butterfly calculation in the third calculation stage to the index identifier of the index factor of the sixteenth butterfly calculation can be calculated. For details, please refer to the process of calculating the index identifier of the index factor of the first butterfly calculation in the third calculation stage to the index identifier of the index factor of the fourth butterfly calculation, which will not be repeated here. Among them, the index identifiers of the rotation factors of the 16 butterfly calculations in the third calculation stage are shown in Table 6 below.
[0115] Btf_idx l Btf_idx l Btf_idx l Btf_idx l 0 / 0000 0 / 0000 4 / 0100 8 / 1000 8 / 1000 0 / 0000 12 / 1100 8 / 1000 1 / 0001 2 / 0010 5 / 0101 10 / 1010 9 / 1001 2 / 0010 13 / 1101 10 / 1010 2 / 0010 4 / 0100 6 / 0110 12 / 1100 10 / 1010 4 / 0100 14 / 1110 12 / 1100 3 / 0011 6 / 0110 7 / 0111 14 / 1110 11 / 1011 6 / 0110 15 / 1111 14 / 1110
[0116] Table 6
[0117] Of course, the calculation method of the index identifier of each rotation factor in the butterfly calculation of the fourth calculation stage can refer to the above process, which will not be repeated here.
[0118] In this way, when performing butterfly calculation on the first data group, the index identifier of the rotation factor in each butterfly calculation in each calculation stage can be determined, so that the address information of each rotation factor can be determined according to the base address information and the index identifier of the rotation factor.
[0119] It should be noted that the above is explained by taking the index identifiers of the rotation factors in each butterfly calculation in the w-th calculation stage as an example. When calculating the index identifiers of the rotation factors in each butterfly calculation in other calculation stages, the process of calculating the index identifiers of the rotation factors in the w-th calculation stage can be referred to, which will not be repeated here.
[0120] At this time, butterfly calculation is performed based on the address information of the first data and the address information of the second data to obtain the first result and the second result including:
[0121] Based on the address information of the first data, the address information of the second data and the address information of the rotation factor corresponding to the butterfly calculation, the first data, the second data and the rotation factor corresponding to the butterfly calculation are obtained; the butterfly calculation is performed according to the first data, the second data and the rotation factor to obtain the first result and the second result.
[0122] That is, each time a butterfly calculation is performed, the address information of the first data, the address information of the second data and the address information of the rotation factor can be obtained, so that the first data can be obtained according to the address information of the first data, the second data can be obtained according to the address information of the second data, and the rotation factor can be obtained according to the address information of the rotation factor, and the first data and the second data can be butterfly calculated using the rotation factor to obtain the first result and the second result.
[0123] Since the input data in the first data group is divided into frequency domain data and time domain data, each time the butterfly calculation is performed, the methods of determining the target data index identifier for the time domain data and the frequency domain data may be different. As a possible implementation method, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively adjusted in data bit sequence to obtain the target data index identifier of the first data and the target data index identifier of the second data, including:
[0124] The input data in the first data group is frequency domain data, and the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are determined according to the number of calculation stages in the order from the low bit to the high bit of the data bit of the initial data index identifier. The number of adjustments k is determined according to the stage identifier of the calculation stage, and the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted k times according to the preset rules to obtain the target data index identifier of the first data and the target data index identifier of the second data.
[0125] When the input data in the first data group is frequency domain data, when the data bit sequence of the initial data index identifier of the first data and the initial data index identifier of the second data is adjusted, only the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted. Therefore, the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data can be determined according to the number of calculation stages in the order of the data bits of the initial data index identifier from low to high. In some embodiments, the value of the number of calculation stages is the number of bits of the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data. For example, if the first data group contains 8 input data, the number of calculation stages is 3, and the number of bits of the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data is 3. At this time, the lower three data bits in the initial data index identifier of the first data and the initial data index identifier of the second data can be determined as valid data bits according to the order of the data bits of the initial data index identifier from low to high. The number of adjustment times k is determined according to the stage identifier of the calculation stage, that is, the number of times the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data need to be adjusted. In some embodiments, the sum of the stage identifier of the calculation stage and the second preset value can be used as the adjustment number k. In some embodiments, the second preset data value is 1. Of course, the second preset data value can also be other values, for example, 2, 3, or other values, which is not limited in the embodiments of the present application.
[0126] After determining the number of adjustments k, the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data can be adjusted k times in order according to preset rules, in the order of the data bits of the initial data index identifier from low to high, and the adjusted value of the initial data index identifier of the first data is used as the target data index identifier of the first data, and the adjusted value of the initial data index identifier of the second data is used as the target data index identifier of the second data.
[0127] In some embodiments, the preset rule may be a rightward circular shift. Thus, after determining the adjustment times k, the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted k times according to the rightward circular shift rule to obtain the target data index identifier of the first data and the target data index identifier of the second data.
[0128] As shown in the above example, the first data group contains 8 input data, and the input data are all frequency domain data. At this time, the number of calculation stages can be determined to be 3. According to the order of the data bits of the initial data index identifier from low to high, the initial data index identifier of the first data and the initial data index identifier of the second data can be determined as valid data bits. That is, the adjustment range of the data bits of the initial data index identifier of the first data and the initial data index identifier of the second data can be determined as the lower three data bits. Assuming that the stage identifier corresponding to the second calculation stage is 1 and the second preset value is 1, it can be determined that the number of adjustments k corresponding to the calculation stage is 2. Assuming that the target data index identifier of the first data and the target data index identifier of the second data need to be determined for the fourth butterfly calculation of the second calculation stage, and the butterfly index identifier of the fourth butterfly calculation is 3, the initial data index identifier of the first data can be determined to be 6 according to the butterfly index identifier of the fourth butterfly calculation, which is converted into a binary number of 110, and the initial data index identifier of the second data is 7, which is converted into a binary number of 111. The valid data bit 110 in the initial data index identifier of the first data can be circularly shifted rightward twice, and the data after the shift is 101, that is, the target data index identifier of the first data is 101, which is converted to a decimal number of 5. Similarly, the valid data bit 111 in the initial data index identifier of the second data can be circularly shifted rightward twice, and the data after the shift is 111, that is, the target data index identifier of the second data is 101, which is converted to a decimal number of 7.
[0129] When performing butterfly calculation, it is necessary not only to obtain the data for butterfly calculation, that is, not only to obtain the first data and the second data, but also to obtain the rotation factor for each butterfly calculation. The method of obtaining the index identification of the rotation factor when the frequency domain data is butterfly calculated is different from the method of obtaining the index identification of the rotation factor when the time domain data is butterfly calculated.
[0130] As a possible implementation manner, when the input data in the first data group is frequency domain data, the method further includes:
[0131] For each calculation stage, determine the stage identifier of the calculation stage, and determine the third shift number based on the stage identifier of the calculation stage. Perform a third shift process on the preset second reference data according to the third shift number to obtain the second target reference data. For each butterfly calculation in the calculation stage, determine the address information of the rotation factor of the butterfly calculation according to the butterfly index identifier and the second target reference data.
[0132] In the embodiment of the present application, it is necessary to determine the rotation factor for each butterfly calculation in each calculation stage. Therefore, for each calculation stage, the stage identifier of the calculation stage is determined. For the convenience of description, the following description is taken as the wth calculation stage as an example, wherein w is an integer greater than 0 and not greater than m, and m is the number of calculation stages. When calculating the index identifier of the rotation factor during each butterfly calculation in the wth calculation stage, the preset second reference data can be obtained, the second reference data is first adjusted, and then the butterfly index identifier is adjusted using the adjusted second reference data, so as to determine the index identifier of the rotation factor, and then determine the address information of the rotation factor. In order to adjust the preset second reference data, the third shift data needs to be obtained first. At this time, for the wth calculation stage, the third shift data corresponding to the wth calculation stage can be determined according to the stage identifier of the wth calculation stage. In some embodiments, the stage identifier of the wth calculation stage can be determined as the third shift data. Or, in other embodiments, the third shift data can be preset. Of course, the third shift data can also be determined in other ways, and the embodiment of the present application is not limited to this.
[0133] After determining the third shift data of the w-th calculation stage, the second reference data can be adjusted. At this time, the second reference data can be subjected to a third shift process according to the third shift data to obtain the second target reference data. In some embodiments, the third shift process can be a left shift. In this way, when the stage identifier of the w-th calculation stage is 0, the second reference data is shifted to the left by 0 bits, that is, the second target reference data is the same as the second reference data. In some embodiments, the second reference data is 0xFFFF. Of course, the second reference data can also be other values pre-set according to actual needs, and the embodiment of the present application is not limited to this. When the stage identifier of the w-th calculation stage is 1, the second reference data is shifted to the left by 1 bit, and the second target reference data is 0xFFFE. After calculating the second target reference data, for each butterfly calculation in the w-th calculation stage, the butterfly index identifier of the butterfly calculation can be subjected to a second logical operation with the second target parameter data to obtain the index identifier of the rotation factor of the butterfly calculation, and then the address information of the rotation factor of the butterfly calculation can be determined according to the index mark of the rotation factor and the preset base address information.
[0134] In some embodiments, the second logic operation is an AND operation. For each butterfly calculation in the wth calculation stage, an AND operation may be performed on the butterfly index identifier of the butterfly calculation and the second target parameter data to obtain an index identifier of the rotation factor of the butterfly calculation.
[0135] At this time, butterfly calculation is performed based on the address information of the first data and the address information of the second data to obtain the first result and the second result including:
[0136] Based on the address information of the first data, the address information of the second data and the address information of the rotation factor corresponding to the butterfly calculation, the first data, the second data and the rotation factor corresponding to the butterfly calculation are obtained; the butterfly calculation is performed according to the first data, the second data and the rotation factor to obtain the first result and the second result.
[0137] That is, each time a butterfly calculation is performed, the address information of the first data, the address information of the second data and the address information of the rotation factor can be obtained, so that the first data can be obtained according to the address information of the first data, the second data can be obtained according to the address information of the second data, and the rotation factor can be obtained according to the address information of the rotation factor, and the first data and the second data can be butterfly calculated using the rotation factor to obtain the first result and the second result.
[0138] In some embodiments, when performing butterfly calculations, the process of adjusting the data bit sequence of obtaining the initial data index identifier of the first data, the initial data index identifier of the second data, the initial data index mark of the first data, and the initial data index mark of the second data can be implemented through logic gates to implement operations such as shifting, addition, subtraction, and bit operations. For example, CDE (Custom Datapath Extension) instructions can be used to implement operations such as shifting, addition, subtraction, and bit operations with fewer logic gates. In this way, the above process can be performed in only one clock cycle each time the butterfly calculation is performed to calculate the address information of the first data and the address information of the second data. Similarly, the address information of the rotation factor can be calculated through one clock cycle, which greatly reduces the time overhead of the butterfly calculation, improves the calculation speed of the butterfly calculation, and improves the calculation efficiency.
[0139] For example, when the CDE instruction is used to implement the above process, since the CDE instruction can be executed in the pipeline like an ordinary instruction, the time consumption of a CDE instruction is 1 clock cycle. In this way, for each calculation stage from the second calculation stage to the mth calculation stage, the overhead of generating the address information of the first data and the address information of the second data is 1 clock cycle, and the overhead of generating the address information of the rotation factor is 1 clock cycle, that is, the total overhead of generating the address information is 2 clock cycles. For a butterfly calculation, if the data and the rotation factor are stored in int32_t type, the time consumption of each part is shown in Table 7. Among them, a butterfly operation requires 2 complex data, namely the first data and the second data, and 1 rotation factor, so the overhead of obtaining the first data, the second data and the rotation factor, and updating the first data and the second data is 6 and 4 clock cycles respectively. A butterfly calculation includes one complex multiplication, one complex addition and one complex subtraction, which requires a total of 8 clock cycles. Among them, a complex multiplication requires 4 clock cycles, a complex addition requires 2 clock cycles, and a complex subtraction requires 2 clock cycles. In the actual implementation process, the number of butterflies processed in a loop is different, which will affect the total overhead of the loop jump. The jump instruction usually requires 3 clock cycles. If a loop processes 4 butterflies, the average jump overhead of 1 butterfly is 3 / 4 clock cycles. In this way, the average overhead of a single butterfly calculation is 21.75 clock cycles, as shown in Table 7.
[0140]
[0141] Table 7
[0142] Furthermore, when the input data is time domain data, for the first calculation stage, or when the input data is frequency domain data, for the last calculation stage, since the rotation factors are all 1, there is no need to load the rotation factors or perform complex multiplication. If one loop processes two butterfly calculations, the clock cycle overhead of a single butterfly calculation in the first calculation stage is 15.5 clock cycles, as shown in Table 8.
[0143]
[0144] Table 8
[0145] That is to say, implementing the above process through logic gates does not increase the pipeline overhead, and can also reduce the time overhead of butterfly calculation, increase the calculation speed of butterfly calculation, and improve calculation efficiency.
[0146] As a possible implementation manner, the above-mentioned obtaining the butterfly index identifier corresponding to the i-th butterfly calculation includes:
[0147] Obtaining a butterfly index identifier corresponding to the i-th butterfly calculation from one of the first storage module and the second storage module. When i is greater than 2, the butterfly index identifier corresponding to the i-th butterfly calculation is obtained based on the butterfly index identifier corresponding to the i-1-th butterfly calculation, and the butterfly index identifier corresponding to the i-1-th butterfly calculation is stored in the other of the first storage module and the second storage module.
[0148] The butterfly index identifier stored in the other is updated according to the butterfly index identifier corresponding to the i-th butterfly calculation, wherein the updated butterfly index identifier in the other is the butterfly index identifier corresponding to the i+1-th butterfly calculation.
[0149] In order to improve the calculation speed, a ping-pong cache mechanism can be used in the embodiment of the present application, that is, two storage modules are used to maintain the butterfly index identifier, for example, the butterfly index identifier is maintained by the first storage module and the second storage module. Since the ping-pong cache mechanism alternately obtains the butterfly index identifier in the first storage module and the second storage module, after the first storage module or the second storage module obtains the butterfly index identifier, it is necessary to update its own butterfly index identifier according to the butterfly index identifier cached in the other storage module. Based on this, for the butterfly calculation of each calculation stage, when performing the i-th butterfly calculation, the butterfly index identifier corresponding to the i-th butterfly calculation is obtained from one of the first storage module and the second storage module. After obtaining the butterfly index identifier corresponding to the i-th butterfly calculation, the address information of the corresponding first data, the address information of the second data, and the address information of the rotation factor during the i-th butterfly calculation can be calculated in the subsequent steps according to the butterfly index identifier corresponding to the i-th butterfly calculation. Furthermore, in order to be able to obtain the butterfly index identifier corresponding to the i+1th butterfly calculation in the other of the first storage module and the second storage module, the butterfly index identifier stored in the other of the first storage module and the second storage module can be updated according to the butterfly index identifier corresponding to the i-th butterfly calculation, and the butterfly index identifier stored in the other of the first storage module and the second storage module is updated to the butterfly index identifier corresponding to the i+1th butterfly calculation, so that when performing the i+1th butterfly calculation, the butterfly index identifier corresponding to the i+1th butterfly calculation can be obtained from the other of the first storage module and the second storage module.
[0150] For example, when performing the i-th butterfly calculation, the butterfly index identifier corresponding to the i-th butterfly calculation is obtained from the first storage module. After obtaining the butterfly index identifier corresponding to the i-th butterfly calculation, not only can the address information of the corresponding first data, the address information of the second data, and the address information of the rotation factor during the i-th butterfly calculation be calculated according to the butterfly index identifier corresponding to the i-th butterfly calculation in the subsequent steps. The butterfly index identifier stored in the second storage module can also be updated according to the butterfly index identifier corresponding to the i-th butterfly calculation, and the butterfly index identifier stored in the second storage module is updated to the butterfly index identifier corresponding to the i+1-th butterfly calculation, so that when performing the i+1-th butterfly calculation, the correct butterfly index identifier can be obtained from the second storage module. Similarly, when performing the i+1th butterfly calculation, the butterfly index identifier corresponding to the i+1th butterfly calculation can be obtained from the second storage module. After obtaining the butterfly index identifier corresponding to the i+1th butterfly calculation, not only can the subsequent steps be performed according to the butterfly index identifier corresponding to the i+1th butterfly calculation to calculate the address information of the corresponding first data, the address information of the second data, and the address information of the rotation factor during the i-th butterfly calculation. The butterfly index identifier stored in the first storage module can also be updated according to the butterfly index identifier corresponding to the i+1th butterfly calculation, and the butterfly index identifier stored in the first storage module can be updated to the butterfly index identifier corresponding to the i+2th butterfly calculation, so that when performing the i+2th butterfly calculation, the correct butterfly index identifier can be obtained from the first storage module. In this way, the first storage module and the second storage module can be used to jointly maintain the butterfly index identifier in the above manner to improve the calculation speed of the butterfly calculation.
[0151] As a possible implementation manner, the first storage module pre-stores a butterfly index identifier corresponding to the first butterfly calculation, and the second storage module pre-stores a butterfly index identifier corresponding to the second butterfly calculation.
[0152] At this time, the above-mentioned acquisition of the butterfly index identifier corresponding to the i-th butterfly calculation also includes:
[0153] When i is 1, the butterfly index identifier corresponding to the first butterfly calculation is obtained from the first storage module. When i is 2, the butterfly index identifier corresponding to the second butterfly calculation is obtained from the second storage module. The butterfly index identifier stored in the first storage module is updated according to the butterfly index identifier corresponding to the second butterfly calculation.
[0154] That is, the butterfly index identifier corresponding to the first butterfly calculation and the butterfly index identifier corresponding to the second butterfly calculation can be stored in the first storage module and the second storage module respectively. For example, the butterfly index identifier corresponding to the first butterfly calculation is pre-stored in the first storage module, and the butterfly index identifier corresponding to the second butterfly calculation is pre-stored in the second storage module. At this time, when obtaining the butterfly index identifier corresponding to the first butterfly calculation, the butterfly index identifier corresponding to the first butterfly calculation can be obtained from the first storage module, so that the address information of the first data, the address information of the second data and the address information of the rotation factor required for the first butterfly calculation can be calculated according to the butterfly index identifier corresponding to the first butterfly calculation. Since the butterfly index identifier corresponding to the first butterfly calculation and the butterfly index identifier corresponding to the second butterfly calculation are stored in the first storage module and the second storage module respectively, after obtaining the butterfly index identifier corresponding to the first butterfly calculation, there is no need to update the butterfly index identifier stored in the second storage module. When performing the second butterfly calculation, the butterfly index identifier corresponding to the second butterfly calculation can be obtained from the second storage module. At this time, after obtaining the butterfly index identifier corresponding to the second butterfly calculation, the address information of the first data, the address information of the second data and the address information of the rotation factor required for the second butterfly calculation can be calculated according to the butterfly index identifier corresponding to the second butterfly calculation. Since the butterfly index identifier currently stored in the first storage module is the butterfly index identifier corresponding to the first butterfly calculation, in order to obtain the correct butterfly index identifier corresponding to the third butterfly calculation from the first storage module, it is necessary to update the butterfly index identifier stored in the first storage module according to the butterfly index identifier corresponding to the second butterfly calculation. In other words, after obtaining the butterfly index identifier corresponding to the second butterfly calculation, the butterfly index identifier stored in the first storage module is updated according to the butterfly index identifier corresponding to the second butterfly calculation, and the butterfly index identifier in the first storage module is updated to the butterfly index identifier corresponding to the third butterfly calculation, so that the i-th butterfly calculation can continue to be performed correctly.
[0155] When the butterfly index flag is updated, it is different according to the difference in the value of the butterfly index flag corresponding to the first butterfly calculation and the butterfly index flag corresponding to the second butterfly calculation.
[0156] In some embodiments, the butterfly index identifier corresponding to the first butterfly calculation can be set to a first value, and the butterfly index identifier corresponding to the second butterfly calculation can be set to a second value, and the first value is less than the second value. That is, the butterfly calculation is performed in the order of the butterfly index identifiers from small to large. At this time, when the butterfly index identifier is updated, the sum of the current butterfly index identifier and the first preset value needs to be used as the updated butterfly index identifier. For example, when the butterfly index identifier stored in the other of the first storage module and the second storage module is updated, the sum of the butterfly index identifier corresponding to the i-th butterfly calculation and the first preset value can be used as the butterfly index identifier corresponding to the i+1-th butterfly calculation, and the butterfly index identifier stored in the other of the first storage module and the second storage module is updated to the sum of the butterfly index identifier corresponding to the i-th butterfly calculation and the first preset value.
[0157] In other embodiments, in order to reduce the calculation time of the butterfly calculation and improve the calculation rate, the butterfly index identifier corresponding to the first butterfly calculation is the maximum value among the butterfly index identifiers corresponding to the butterfly calculations contained in the calculation stage; the butterfly index identifier corresponding to the second butterfly calculation is the second largest value among the butterfly index identifiers corresponding to the butterfly calculations contained in the calculation stage.
[0158] That is, for each calculation stage, the butterfly index identifier corresponding to the first butterfly calculation can be set to the maximum value of the butterfly index identifiers in the calculation stage, and the butterfly index identifier corresponding to the second butterfly calculation can be set to the second largest value among the butterfly index identifiers in the calculation stage. In this way, when updating the butterfly index identifier, the difference between the current butterfly index identifier and the second preset value needs to be used as the updated butterfly index identifier. For example, when updating the butterfly index identifier stored in the other of the first storage module and the second storage module, the difference between the butterfly index identifier corresponding to the i-th butterfly calculation and the second preset value can be used as the butterfly index identifier corresponding to the i+1-th butterfly calculation, and the butterfly index identifier stored in the other of the first storage module and the second storage module is updated to the difference between the butterfly index identifier corresponding to the i-th butterfly calculation and the second preset value.
[0159] For example, when the first data group includes 8 input data, the butterfly index identifier corresponding to the first butterfly calculation is set to 3, and the butterfly index identifier corresponding to the second butterfly calculation is set to 2. At this time, the second preset value is 1.
[0160] In some embodiments, when the butterfly index identifier is updated to a minimum value, for example, updated to 0, the corresponding flag bit will also have a change in state value when the butterfly index identifier is updated to 0. In this way, the method of updating the butterfly index identifier from a maximum value to a minimum value can be implemented without using comparison instructions, thereby reducing the clock cycles used and increasing the calculation rate.
[0161] In some embodiments, in order to reduce the number of storage modules used, the second storage module can also be used as a storage module for the address information of the second data. In this way, since the butterfly index identifier is jointly maintained and updated by the two storage modules, the correct butterfly index identifier can be obtained each time the butterfly calculation is performed, and the calculation efficiency will not be reduced.
[0162] Step S104: Reverse the index identifiers of the output data contained in the second data group to obtain a target data group.
[0163] In the embodiment of the present application, after obtaining the second data group, in order to obtain the correct frequency domain data, it is necessary to reverse the index identifiers of the output data contained in the second data group to obtain the target index identifiers of the output data, and arrange the output data in the order of the target index identifiers to obtain the target data group. The target data group is the frequency domain data obtained after Fourier transforming the input data in the first data group.
[0164] For example, the second data group includes 8 output data, and the index identifiers of the 8 outputs are processed in reverse order to obtain a target data group in which the output data is correctly sorted, such as Figure 4 shown.
[0165] Corresponding to the above embodiment, the embodiment of the present application also provides a microprocessor chip. Figure 5 This is a schematic diagram of the structure of a microprocessor chip provided in an embodiment of the present application. Figure 5 As shown, the microprocessor chip includes a memory 501, a processor 502, and a computer program stored in the memory 501 and executable on the processor 502. When the processor 502 executes the program, the Fourier transform data processing method described in the above embodiment is implemented.
[0166] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention or some parts of the embodiments.
[0167] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
Claims
1. A Fourier transform data processing method, characterized in that: include: Acquire a first data group; the first data group includes a plurality of input data; Determining the number of calculation stages included in the butterfly calculation and the number of butterfly calculations included in each calculation stage based on the number of input data included in the first data group; Performing butterfly calculation on the first data group to generate a second data group; wherein, when performing butterfly calculation on the first data group, address information of data for each butterfly calculation is determined based on the number of calculation stages and the number of butterfly calculations included in each calculation stage; the second data group includes a plurality of output data; The index identifiers of the output data contained in the second data group are processed in reverse order to obtain a target data group.
2. The method according to claim 1, characterized in that The performing butterfly calculation on the first data group to generate a second data group comprises: For each calculation stage of the butterfly calculation, when performing the i-th butterfly calculation, obtain the butterfly index identifier corresponding to the i-th butterfly calculation; wherein i is an integer greater than 0; Based on the butterfly index identifier, determining an initial data index identifier of the first data and an initial data index identifier of the second data; Respectively adjusting the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data to obtain the target data index identifier of the first data and the target data index identifier of the second data; Determine address information of the first data and address information of the second data based on a target data index identifier of the first data and a target data index identifier of the second data; The butterfly calculation is performed based on the address information of the first data and the address information of the second data to obtain a first result and a second result, and the first result is stored based on the address information of the first data, and the second result is stored based on the address information of the second data.
3. The method according to claim 2, characterized in that The step of respectively adjusting the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data to obtain the target data index identifier of the first data and the target data index identifier of the second data comprises: The input data in the first data group is time domain data, and for each calculation stage between the first calculation stage to the mth calculation stage, a stage identifier of the calculation stage is determined; m is the number of the calculation stages; In the initial data index identifier, according to the order of data bits from low to high, the first data bit in the initial data index identifier of the first data and the initial data index identifier of the second data are respectively determined as the first data part, the second data bit to the j+1th data bit are determined as the second data part, and the j+2th data bit to the mth data bit are determined as the third data part; wherein j is the stage identifier of the calculation stage; The first data portion, the second data portion, and the third data portion are arranged in a first preset order to obtain a target data index identifier for the first data and a target data index identifier for the second data, respectively.
4. The method according to claim 2, characterized in that: The step of respectively adjusting the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data to obtain the target data index identifier of the first data and the target data index identifier of the second data comprises: The input data in the first data group is time domain data. For the first calculation stage, the initial data index identifier of the first data and the initial data index identifier of the second data are respectively processed in reverse order to obtain the target data index identifier of the first data and the target data index identifier of the second data.
5. The method according to claim 2, characterized in that: The step of respectively adjusting the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data to obtain the target data index identifier of the first data and the target data index identifier of the second data comprises: The input data in the first data group is time domain data, and for the mth calculation stage, in the initial data index identifier, in the order of data bits from low to high, the first data bit in the initial data index identifier of the first data and the initial data index identifier of the second data are respectively determined as the fourth data part, and the second data bit to the mth data bit are determined as the fifth data part; The fourth data portion and the fifth data portion are arranged according to a second preset order to obtain a target data index identifier of the first data and a target data index identifier of the second data respectively.
6. The method according to any one of claims 3 to 5, characterized in that: Also includes: Determine a first shift number based on the number of calculation stages, and perform a first shift process on the preset first reference data based on the first shift number to obtain first target reference data; For each calculation stage between the first calculation stage to the mth calculation stage, determining a stage identifier of the calculation stage; For each butterfly calculation in the calculation stage, determining a second shift number according to a stage identifier of the calculation stage and the number of the calculation stages; Performing a second shift process on the butterfly index identifier of the butterfly calculation according to a second shift number to obtain a first value; Determine address information of a rotation factor corresponding to the butterfly calculation according to the first value and the first target reference data; The butterfly calculation corresponding to the butterfly index identifier is performed based on the address information of the first data and the address information of the second data to obtain the first result and the second result, including: Acquire the first data, the second data and the rotation factor corresponding to the butterfly index identifier based on the address information of the first data, the address information of the second data and the address information of the rotation factor corresponding to the butterfly index identifier; Butterfly calculation is performed according to the first data, the second data and the rotation factor to obtain a first result and a second result.
7. The method according to claim 2, characterized in that The step of respectively adjusting the data sequence of the initial data index identifier of the first data and the initial data index identifier of the second data to obtain the target data index identifier of the first data and the target data index identifier of the second data comprises: The input data in the first data group is frequency domain data, and the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are determined according to the number of calculation stages in the order of the data bits of the initial data index identifier from low to high; The number of adjustments k is determined according to the stage identifier of the calculation stage, and the valid data bits of the initial data index identifier of the first data and the initial data index identifier of the second data are adjusted k times in bit order according to preset rules to obtain the target data index identifier of the first data and the target data index identifier of the second data.
8. The method according to claim 7, characterized in that Also includes: For each calculation stage, determining a stage identifier of the calculation stage; determining a third shift number of the calculation stage based on the stage identifier of the calculation stage; Performing a third shift process on the preset second reference data according to the third shift number to obtain second target reference data; For each butterfly calculation in the calculation stage, determining address information of a rotation factor of the butterfly calculation according to the butterfly index identifier and the second target reference data; The butterfly calculation is performed based on the address information of the first data and the address information of the second data to obtain the first result and the second result, including: Acquire the first data, the second data and the rotation factor corresponding to the butterfly calculation based on the address information of the first data, the address information of the second data and the address information of the rotation factor; The butterfly calculation is performed according to the first data, the second data and the rotation factor to obtain a first result and a second result.
9. The method according to claim 2, characterized in that: The obtaining of the butterfly index identifier corresponding to the i-th butterfly calculation comprises: Obtaining a butterfly index identifier corresponding to the i-th butterfly calculation from one of the first storage module and the second storage module; wherein, when i is greater than 2, the butterfly index identifier corresponding to the i-th butterfly calculation is obtained based on the butterfly index identifier corresponding to the i-1-th butterfly calculation, and the butterfly index identifier corresponding to the i-1-th butterfly calculation is stored in the other of the first storage module and the second storage module; The butterfly index identifier stored in the other one is updated according to the butterfly index identifier corresponding to the i-th butterfly calculation; wherein the updated butterfly index identifier in the other one is the butterfly index identifier corresponding to the i+1-th butterfly calculation.
10. The method according to claim 9, characterized in that The first storage module pre-stores a butterfly index identifier corresponding to the first butterfly calculation, and the second storage module pre-stores a butterfly index identifier corresponding to the second butterfly calculation; The step of obtaining the butterfly index identifier corresponding to the i-th butterfly calculation further includes: When i is 1, obtaining a butterfly index identifier corresponding to the first butterfly calculation from the first storage module; When i is 2, obtaining a butterfly index identifier corresponding to the second butterfly calculation from the second storage module; The butterfly index identifier stored in the first storage module is updated according to the butterfly index identifier corresponding to the second butterfly calculation.
11. The method according to claim 10, characterized in that For each calculation stage, the butterfly index identifier corresponding to the first butterfly calculation is the maximum value among the butterfly index identifiers corresponding to the butterfly calculations included in the calculation stage; The butterfly index identifier corresponding to the second butterfly calculation is the second largest value among the butterfly index identifiers corresponding to the butterfly calculations included in the calculation stage.
12. A microprocessor chip, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the Fourier transform data processing method according to any one of claims 1 to 11 is implemented.