An area-saving cordic implementation method
By introducing errors to extend the number of iterations in the SOC, the compensation coefficient becomes a constant, and using a combined logic circuit instead of the multiplier, the Cordic algorithm uses area and increase power consumption in the SOC, and achieves the effect of saving area and power consumption.
Patent Information
- Application Number
- CN202411650566.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-19
AI Technical Summary
When implementing Cordic algorithm in SOC, a multiplier is needed for modular compensation, which takes up a large chip area and increases cost and power consumption.
The number of iterations is extended by introducing errors, so that the compensation coefficient becomes a constant, thereby using a combined logic circuit instead of the multiplier.
The Cordic implementation method that saves area and power consumption in SOC is implemented, avoids the use of multipliers and only brings a small error gain in the output results.
Smart Images

Figure CN119180260B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of system on chip design, and in particular relates to a method for realizing area saving of cordic (coordinate rotation digital computer) in SOC (System on Chip). Background Art
[0002] When using the Cordic algorithm to implement sine and cosine, modulus, hyperbolic sine and cosine, square root and other functions, the Cordic algorithm needs to work in a circular system or a hyperbolic system, and its calculation results need to consider the compensation of the modulus value, usually by multiplying the result of the iterative calculation by a coefficient, as shown below:
[0003]
[0004] Where i represents the number of iterations, represents the modulus gain of the circular system, and K h represents the modulus gain of the hyperbolic system. To reduce the Cordic calculation error, the number of iterations i is generally greater than 15. At this time, it can be considered that and are stable constants. The quantization bit width is 31, and K c and K h The corresponding values of the number of iterations are shown in Table 1. However, when Cordic calculates some special points, the operation will end early, that is, the actual number of iterations is less than 16 times, and the corresponding K c and K h , will vary depending on the number of iterations. Taking the calculation of the cosine function as an example, assuming that the preset number of Cordic iterations is 20, the angle value table used for Cordic iteration is shown in Table 2 below. When the value to be calculated is , Cordic actually only needs 1 iteration to complete the calculation. According to Table 1, K c The value should be 1518500249. When the calculated value is, Cordic actually only needs 2 iterations to complete the calculation. According to Table 1, K c The value should be 1358187913, so K c and K h The value of should be variable. Even if the preset number of iterations is 20, the stable value 1304065748 cannot be used directly.
[0005] Table 1 shows K c and K h The corresponding value table of the number of iterations. c represents the modulus gain of the circular system, K h Represents the modulus gain of a hyperbolic system:
[0006] K cand K h Table of values corresponding to the number of iterations
[0007]
[0008] Table 2 is the angle value table used by Cordic for iteration:
[0009] Cordic Iteration Angle Value Table
[0010]
[0011] In summary, when the Cordic algorithm implements functions that require modulus compensation, such as sine and cosine, modulus, hyperbolic sine and cosine, and square root, a multiplier is required to implement K c or K h The multiplication operation of the iteration result is as shown in the appendix of the manual. Figure 1 Therefore, when implementing the Cordic algorithm in a SOC (System on Chip), a multiplier must be used at the same time, and the multiplier will occupy a large chip area, increasing cost and power consumption. Summary of the invention
[0012] The purpose of the present invention is to provide an area-saving Cordic implementation method. The method extends the number of iterations by introducing errors according to the judgment conditions for ending Cordic iterations, so that the compensation coefficient becomes a constant, thereby making the multiplication of the Cordic iteration result and the compensation coefficient become the multiplication of a variable and a constant. When this is implemented in a SOC, a combinational logic circuit can be used to replace the multiplier, which greatly saves the chip area and power consumption, and can well solve the problems raised in the above-mentioned background technology.
[0013] To achieve the above object, the present invention provides the following technical solution: a method for realizing area-saving Cordic, wherein N represents the preset number of Cordic iterations, and when the number of iterations i does not reach N, and the judgment value d of the iteration direction is i When it returns to 0, it means that the calculation ends prematurely. At this time, the error value is introduced to force Cordic to return to 0 and enter forward rotation. After the number of iterations reaches N, the calculation is stopped. The coefficient K c or K h will become a constant, and finally the Nth iteration value and K c or K h Multiply them to get the final calculation result;
[0014] Among them, K c represents the modulus gain of the circular system, K h Represents the modulus gain of the hyperbolic system, and the initial value of i is 0.
[0015] Preferably, when performing the Cordic algorithm operation, the cordic implementation method selects a system function and a working mode according to the type of function to be implemented, specifically including:
[0016] When calculating cosine / sine / park / ipark functions, select circular system as system type and rotation mode as working mode;
[0017] When calculating atan2 / modulus / atan functions, select circular system as system type and vector mode as working mode;
[0018] When calculating the mult function, select the linear system as the system type and the rotation mode as the working mode;
[0019] When calculating the div function, select the linear system as the system type and the vector mode as the working mode;
[0020] When calculating cosh / sinh functions, select hyperbolic system as system type and rotation mode as working mode;
[0021] When calculating atanh / std_dev / ln functions, select hyperbolic system as system type and vector mode as working mode;
[0022] When the working mode is selected as vector mode, the judgment condition of the iteration direction is d i =-sign(y i );
[0023] When the working mode is selected as rotation mode, the judgment condition of the iteration direction is d i =sign(z i );
[0024] Among them, the judgment value d of the iteration direction i There are three situations: i >0,d i <0 or d i =0.
[0025] Preferably, when d i = 0, if Cordic calculates cosine / sine / park / ipark / modulus / cosh / sinh / std_dev function; at this time, according to the working mode, in d i Add an LSB error value to continue the Cordic iteration process;
[0026] When working in rotation mode, the iteration termination judgment condition is d i =sign(zi ) = sign(z i-1 + shift_z i-1 ) = 0, so the error compensation needs to be added to the angle value Z, that is:
[0027] if (z i-1 + shift_z i-1 == 0);
[0028] z i = z i-1 + shift_z i-1 + 1'b1;
[0029] When working in vector mode, since the iteration termination judgment condition is d i = -sign(y i ) = -sign(y i-1 + shift_y i-1) == 0, so the error compensation value needs to be added to the coordinate value Y, that is:
[0030] if (y i-1 + shift_y i-1 == 0);
[0031] y i = y i-1 + shift_y i-1 + 1'b1;
[0032] Among them, shift_z i-1 is the gain value of the angle value Z in the previous iteration, and shift_y i-1 is the gain value of the coordinate value Y in the previous iteration. Cordic samples with a 31-bit width for quantization, and the floating-point value corresponding to the error value 1'b1 is 1 / 2 31 ;
[0033] Judge whether the current iteration count i is equal to N. If i < N, it means that the specified iteration count has not been reached. Let i = i + 1 and enter the first step. If i = N, the iteration is completed, and then coefficient compensation is performed.
[0034] Preferably, when d i > 0, perform forward iteration; when d i < 0, perform backward iteration;
[0035] At this time, the angle value Z and the coordinate value Y are iterated normally as follows:
[0036] z i = z i-1 + shift_z i-1 ;
[0037] y i = y i-1 + shift_y i-1 ;
[0038] Determine whether the current iteration number i is equal to N. If i < N, it means that the specified iteration number has not been reached. Let i = i + 1 and enter the first step. If i = N, the iteration is completed, and then coefficient compensation is performed.
[0039] Preferably, the specific process of the coefficient compensation includes:
[0040] If the current Cordic calculation is for the cosine / sine / park / ipark / modulus function, the X-axis and Y-axis iteration values are respectively multiplied by the constant K c to obtain the final Cordic calculation value;
[0041] If the current Cordic calculation is for the cosh / sinh / std_dev function, the X-axis and Y-axis iteration values are respectively multiplied by the constant K h to obtain the final Cordic calculation value.
[0042] Compared with the prior art, the beneficial effects of the present invention are:
[0043] The present invention realizes a Cordic implementation method that saves area. For special points where iteration is terminated in advance, according to the selected system function and working mode, a minimum error of 1 LSB is introduced, the iteration number is extended, and the coefficient compensation value becomes a constant, avoiding the use of a multiplier. The effect of the implementation scheme of the present invention is shown in Table 4. Five special points are selected, and the calculation function is cosine. This method only brings a small error gain to the final output result, but reduces the chip area and power consumption overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 For the multiplier to implement K c / K h Multiplication operation schematic diagram of the iteration result.
[0045] Figure 2 Schematic diagram of the working process of a Cordic implementation method that saves area according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0047] like Figure 2 As shown, this area-saving cordic implementation method includes the following working process:
[0048] N represents the preset number of Cordic iterations, i represents the current i-th iteration, and the initial value of i is 0.
[0049] The first step is to select the system function and working mode according to the type of function to be implemented. As shown in Table 1, when calculating the cosine / sine / park / ipark function, the system type is selected as the circular system and the working mode is selected as the rotation mode. At this time, the judgment condition for the iteration direction is d i =sign(z i ); When calculating atan2 / modulus / atan functions, select circular system as system type, vector mode as working mode, and the judgment condition of iteration direction is d i =-sign(y i ); When calculating the mult function, select the linear system as the system type, the rotation mode as the working mode, and the judgment condition for the iteration direction is d i =sign(z i ); When calculating the div function, select the linear system as the system type, the vector mode as the working mode, and the judgment condition for the iteration direction is d i =-sign(y i ); When calculating the cosh / sinh function, select the hyperbolic system as the system type, the rotation mode as the working mode, and the judgment condition for the iteration direction is d i =sign(z i ); When calculating atanh / std_dev / ln functions, select hyperbolic system as system type, vector mode as working mode, and the judgment condition of iteration direction is d i =-sign(y i ).
[0050] The second step is to determine d i The value of d i >0, perform forward iteration and go directly to step 4; d i <0, perform negative iteration and go directly to step 4; when d i =0, if Cordic calculates functions such as cosine / sine / park / ipark / modulus / cosh / sinh / std_dev, go to step 3, otherwise go to step 4.
[0051] The third step is to select the working mode according to the iAn LSB (Least Significant Bit) error value is added to the value to allow the Cordic iteration process to continue. When working in the rotation mode, the iteration termination judgment condition is d i =sign(z i )=sign(z i-1 +shift_z i-1 )=0, so error compensation needs to be added to the angle value Z:
[0052] if(z i-1 +shift_z i-1 = = 0);
[0053] z i =z i-1 +shift_z i-1 +1′b1;
[0054] When working in vector mode, the iteration termination judgment condition is d i =-sign(y i )=-sign(y i-1 +shift_y i-1 )=0, the error compensation value needs to be added to the coordinate value Y:
[0055] if(y i-1 +shift_y i-1 = = 0);
[0056] y i =y i-1 +shift_y i-1 +1′b1;
[0057] Among them, shift_z i-1 is the gain value of the angle value Z in the previous iteration, shift_y i-1 The gain value of the coordinate value Y in the previous iteration, Cordic sampling 31bit bit width for quantization, the floating point value corresponding to the error value 1′b1 is 1 / 2 31 , after completing the third step, go directly to the fifth step.
[0058] The fourth step is to iterate the angle value Z and the coordinate value Y normally, as follows:
[0059] z i =z i-1 +shift_z i-1 , corresponding to the rotation mode;
[0060] y i =y i-1 +shift_z i-1, corresponding to the vector mode;
[0061] Proceed to the fifth step.
[0062] Fifth step: Determine whether the current iteration count i is equal to N. If i < N, it means the specified iteration count has not been reached. Let i = i + 1 and proceed to the first step. If i = N, the iteration is completed, and proceed to the sixth step for coefficient compensation.
[0063] Sixth step: If the current Cordic calculation is for the cosine / sine / park / ipark / modulus function, the X-axis and Y-axis iteration values need to be multiplied by the constant K c (when quantized to 31 bits, the corresponding value is 1304065748) to obtain the final Cordic calculation value. If the current Cordic calculation is for the cosh / sinh / std_dev function, the X-axis and Y-axis iteration values need to be multiplied by the constant K h (when quantized to 31 bits, the corresponding value is 1296540104) to obtain the final Cordic calculation value. If the current Cordic calculation is for the other functions in Table 3, no coefficient compensation is required, and the final Cordic calculation value can be obtained directly.
[0064] Table 3 is the system function and working mode table:
[0065] System Function and Working Mode Table
[0066]
[0067] The present invention realizes a Cordic implementation method that saves area. For special points where iteration ends prematurely, according to the selected system function and working mode, a minimum error of 1 LSB is introduced, the iteration count is extended, and the coefficient compensation value becomes a constant, avoiding the use of a multiplier. The effect of the implementation solution of the present invention is shown in Table 4. Five special points are selected, and the function selection is cosine. This method only brings a small error gain to the final output result, but reduces the chip area and power consumption overhead.
[0068] Table 4 is the effect table of the implementation solution for the five special points selected by the present invention with the cosine function calculation:
[0069] Special Input Point Value and Error Gain Effect Table
[0070]
[0071] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0072] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A cordic implementation method for saving area in a SOC system on chip, characterized in that: In this cordic implementation method, N represents the preset number of Cordic iterations. When the number of iterations i does not reach N, and the judgment value d of the iteration direction i When it returns to 0, it means that the calculation ends prematurely. At this time, the error value is introduced to force Cordic to return to 0 and enter forward rotation. After the number of iterations reaches N, the calculation is stopped. The coefficient K c or K h will become a constant, and finally the Nth iteration value and K c or K h Multiply them to get the final calculation result; Among them, K c represents the modulus gain of the circular system, K h Represents the modulus gain of the hyperbolic system, and the initial value of i is 0.
2. A method for realizing cordic in a SOC system on chip for saving area according to claim 1, characterized in that: When performing Cordic algorithm operations, this Cordic implementation method selects system functions and working modes according to the type of function to be implemented, specifically including: When calculating cosine / sine / park / ipark functions, the system type is selected as the circular system and the working mode is selected as the rotation mode; When calculating atan2 / modulus / atan functions, the system type is selected as the circular system and the working mode is selected as the vector mode; When calculating mult functions, the system type is selected as the linear system and the working mode is selected as the rotation mode; When calculating div functions, the system type is selected as the linear system and the working mode is selected as the vector mode; When calculating cosh / sinh functions, the system type is selected as the hyperbolic system and the working mode is selected as the rotation mode; When calculating atanh / std_dev / ln functions, the system type is selected as the hyperbolic system and the working mode is selected as the vector mode; When the working mode is selected as vector mode, the judgment condition of the iteration direction is d i =-sign(y i );y i represents the coordinate value of the i-th iteration; When the working mode is selected as rotation mode, the judgment condition of the iteration direction is d i =sign(z i );zi represents the angle value of the i-th iteration; Among them, the judgment value d of the iteration direction i There are three situations: i >0,d i <0 or d i =0.
3. The method for realizing area-saving cordic in a SOC system on chip according to claim 2, characterized in that: When i = 0, if Cordic calculates cosine / sine / park / ipark / modulus / cosh / sinh / std_dev function; at this time, according to the working mode, in d i Add an LSB error value to continue the Cordic iteration process; When working in rotation mode, the iteration termination judgment condition is d i =sign(z i )=sign(z i-1 +shift_z i-1 )=0, so the error compensation needs to be added to the angle value Z, that is: if(z i-1 +shift_z i-1 ==0); With i =from i-1 +shift_z i-1 +1′b1; When working in vector mode, the iteration termination judgment condition is d i =-sign(y i )=-sign(y i-1 +shift_y i-1 )=0, so the error compensation value needs to be added to the coordinate value Y, that is: if(y i-1 +shift_y i-1 ==0); and i =and i-1 +shift_y i-1 +1′b1; Among them, shify_z i-1 is the gain value of the angle value Z in the previous iteration, shify_y i-1 The gain value of the coordinate value Y in the previous iteration, Cordic sampling 31bit bit width for quantization, the floating point value corresponding to the error value 1′b1 is 1 / 2 31 ; Judge whether the current iteration count i is equal to N. If i < N, it means that the specified iteration count has not been reached. Let i = i + 1 and enter the first step. If i = N, the iteration is completed, and then coefficient compensation is performed.
4. The method for realizing area-saving cordic in a SOC system on chip according to claim 3, characterized in that: When i >0, perform forward iteration; when d i <0, perform negative iteration; At this time, the angle value Z and the coordinate value Y are iterated normally as follows: z i =z i-1 +shift_z i-1 ; and i =and i-1 +shift_y i-1 ; Judge whether the current iteration count i is equal to N. If i < N, it means that the specified iteration count has not been reached. Let i = i + 1 and enter the first step; If i = N, the iteration is completed, and then coefficient compensation is performed.
5. A method for realizing area-saving cordic in a SOC system on chip according to claim 3 or 4, characterized in that: The specific process of the coefficient compensation includes: If the current Cordic calculation is cosine / sine / park / ipark / modulus function, the X-axis and Y-axis iteration values are required, which are respectively related to the constant K c Multiply them to get the final Cordic calculation value; If the current Cordic calculation is cosh / sinh / std_dev function, the X-axis and Y-axis iteration values are required, which are respectively related to the constant K h Multiply them to get the final Cordic calculation value.
Citation Information
Patent Citations
Complex logarithm implementation method, device and equipment based on CORDIC algorithm, and computer storage medium
CN113127802A
Improved CORDIC iterative operation method and device, equipment, storage medium and chip
CN118276820A