Vector modulus length calculation method and system based on CORDIC algorithm
Scaling and amplifying the initial vector modulus length will solve the problem of the initial vector selection range due to pseudo-rotation error in the CORDIC algorithm, which significantly improves the selectivity of the vector range and avoids the problem of overflow of the modulus length.
Patent Information
- Application Number
- CN202411563043.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-28
AI Technical Summary
When calculating the vector modulus length, the initial vector selection range is too small due to pseudo-rotation error, which limits the practicality and performance of the circuit.
By scaling the modulus length of the initial vector, it is first reduced to N times, and then iterating the CORDIC algorithm vector mode, then enlarge the result M times to obtain the final modulus length calculation result.
The initial vector range that the CORDIC algorithm can select is significantly improved, expanding it from a partial range of the circumference to the entire unit circumference or even the circumference with a radius is solved, solving the problem of mold length overflow.
Smart Images

Figure CN119536685A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of CORDIC algorithm, and more specifically, to a vector modulus length calculation method and system based on the CORDIC algorithm. Background Art
[0002] The core idea of the CORDIC (Coordinate Rotation Digital Computer) algorithm is to approximate the calculation of the target function through a series of fixed-angle rotations. These rotation angles are usually arc tangent values of powers of 2, which can be obtained by looking up a table. The algorithm includes two modes: Rotation Mode and Vectoring Mode. The Rotation Mode is used to calculate the sine and cosine values of the target angle, while the Vectoring Mode is used to convert polar coordinates to a Cartesian coordinate system.
[0003] Usually, when the CORDIC circuit engine calculates the modulus length MOD, the modulus length result cannot exceed K times the radius R of the unit circle due to the fixed error introduced by the pseudo-rotation of the algorithm. This limitation will cause many problems because the coordinates of the initial vector are basically limited to [-1,1] in the circuit implementation. Most of the data is unavailable, which limits the practicality and performance of the circuit. Summary of the invention
[0004] The present application provides a vector modulus calculation method and system based on the CORDIC algorithm. The present application solves the problem of too small initial vector selection range caused by pseudo-rotation error in CORDIC modulus calculation by scaling the initial vector with modulus overflow. Specifically, the technical solution of the present application is as follows:
[0005] In a first aspect, the present application discloses a method for calculating vector modulus length based on a CORDIC algorithm, comprising:
[0006] Obtaining the coordinates of the initial vector and calculating the initial modulus length; determining whether the initial vector will generate a modulus length overflow after iterating the CORDIC algorithm vector mode;
[0007] If yes, before performing CORDIC algorithm vector mode iteration on the initial modulus, multiply the initial modulus by a reduction coefficient N, so that the initial modulus is reduced to N times of the original;
[0008] After the CORDIC algorithm vector mode iteration is completed, the calculated result is multiplied by the magnification factor M to obtain the final module length calculation result.
[0009] In some embodiments, the steps of obtaining the coordinates of the initial vector, calculating the initial modulus, and determining whether the initial modulus will overflow after performing CORDIC algorithm vector mode iteration include the following steps:
[0010] Get the coordinates (x, y) of the initial vector;
[0011] Calculate the initial modulus P:
[0012] When the initial modulus P satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur;
[0013] Where n is the number of iterations; A n is the error coefficient of the vector modulus after n pseudo-rotations; R is the maximum modulus that the system can express;
[0014] In some implementations, when the initial modulus length P satisfies P>R*k; the initial modulus length will generate a modulus length overflow after the CORDIC algorithm vector mode iteration;
[0015] Calculating a reduction coefficient N; the reduction coefficient is used to reduce the initial module length that will cause module length overflow to N times the original length;
[0016]
[0017] Among them, P is the initial modulus length; R is the maximum modulus length that the system can express; n is the number of iterations; A n It is the error coefficient of the vector modulus after n pseudo-rotations.
[0018] In some embodiments, the vector modulus calculation method based on the CORDIC algorithm further includes: calculating a magnification factor M; the magnification factor M is used to restore the reduced modulus result;
[0019]
[0020] Among them, P is the initial module length; R is the maximum module length that the system can express.
[0021] In some implementations, the vector modulus calculation method based on the CORDIC algorithm further includes:
[0022] The x-coordinate and y-coordinate of the initial vector are set to have a value range of [-t, t]; wherein t is an arbitrary value;
[0023] Based on the value range of the initial vector, determining whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration;
[0024] Specifically include:
[0025] Calculate the maximum initial modulus P within the value range,
[0026] When t satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur.
[0027] In a second aspect, the present application also discloses a vector modulus length calculation system based on the CORDIC algorithm, including:
[0028] A judgment module is used to obtain the coordinates of the initial vector and calculate the initial modulus; and to judge whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration;
[0029] A scaling module, for, if yes, multiplying the initial modulus by a reduction coefficient N before performing CORDIC algorithm vector mode iteration on the initial modulus, so that the initial modulus is reduced to N times of the original;
[0030] Algorithm module, used to perform CORDIC algorithm vector mode iteration;
[0031] The scaling module is also used to multiply the obtained calculation result by the magnification factor M after the CORDIC algorithm vector mode iteration is completed to obtain the final module length calculation result.
[0032] In some implementations, the judgment module is further used to: obtain the coordinates (x, y) of the initial vector; and calculate the initial modulus P:
[0033] When the initial modulus P satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur;
[0034] Where n is the number of iterations; A n is the error coefficient of the vector modulus after n pseudo-rotations; R is the maximum modulus that the system can express;
[0035] In some embodiments, the scaling module is further used for when the initial modulus P satisfies P>R*k; the initial modulus will generate a modulus overflow after the CORDIC algorithm vector mode iteration;
[0036] Calculating a reduction coefficient N; the reduction coefficient is used to reduce the initial module length that will cause module length overflow to N times the original length;
[0037]
[0038] Among them, P is the initial modulus length; R is the maximum modulus length that the system can express; n is the number of iterations; A n It is the error coefficient of the vector modulus after n pseudo-rotations.
[0039] In some embodiments, the scaling module is further used to calculate a magnification factor M; the magnification factor M is used to restore the reduced module length result;
[0040]
[0041] Among them, P is the initial module length; R is the maximum module length that the system can express.
[0042] In some embodiments, the judgment module is further used to set the value range of the x-coordinate and the y-coordinate of the initial vector to [-t, t]; wherein t is an arbitrary value; based on the value range of the initial vector, judge whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration;
[0043] Specifically include: calculating the maximum initial modulus P within the value range,
[0044] When t satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur.
[0045] Compared with the prior art, the present invention has at least one of the following beneficial effects:
[0046] The present application aims to solve the problem of too small selection range of initial vectors due to pseudo-rotation error in CORDIC modulus calculation, introduces a method for scaling the initial vectors and calculating and restoring the modulus, which can expand the selection range of the initial vectors infinitely.
[0047] This application proposes a new method in the rotation calculation of the CORDIC circular system vector mode, aiming to solve the problem that the modulus exceeds the circumference radius during the rotation calculation due to the error factor and the initial modulus. This method significantly improves the range of initial vectors that can be selected by the CORDIC algorithm without changing the original accuracy and performance, and expands it from a partial range of the circumference to the entire unit circle or even to a radius of circumference. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The preferred implementation scheme will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present application.
[0049] Figure 1 This is a schematic diagram of the coordinate transformation of the CORDIC algorithm;
[0050] Figure 2 Schematic diagram of CORDIC algorithm pseudo-rotation;
[0051] Figure 3 It is a schematic diagram of the processing flow of mold length overflow in the prior art;
[0052] Figure 4 Schematic diagram of three circles and radii when calculating the module length for the CORDIC engine;
[0053] Figure 5 This is a schematic diagram of the effect of the initial modulus value range in this application;
[0054] Figure 6 A schematic diagram of a flow chart of calculating a vector modulus in one embodiment of the method proposed in this application;
[0055] Figure 7 This is a schematic diagram of the flow of calculating the vector modulus in another embodiment of the method proposed in this application. DETAILED DESCRIPTION
[0056] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0057] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections.
[0058] In order to simplify the drawings, only the parts related to the invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".
[0059] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0060] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0061] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the specific implementation methods of the present application will be described below with reference to the accompanying drawings. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.
[0062] The CORDIC (Coordinate Rotation Digital Computer) algorithm is an iterative method for calculating a variety of mathematical functions, namely the coordinate rotation digital calculation method, which was first proposed by JD Volder1 in 1959. It includes trigonometric functions, hyperbolic functions, exponential functions, and logarithmic functions. When the CORDIC algorithm was first proposed, it was used for vector rotation and orientation operations in navigation systems. The advantage of the CORDIC algorithm is that it does not require complex hardware multipliers or lookup tables, but instead implements calculations through a series of addition, subtraction, and shift operations, which makes it very suitable for hardware implementation, especially in digital systems such as FPGAs and ASICs.
[0063] The core idea of the CORDIC algorithm is to approximate the calculation of the target function through a series of fixed-angle rotations. These rotation angles are usually arc tangent values of powers of 2, which can be obtained by looking up a table. The algorithm includes two modes: rotation mode and vectoring mode. The rotation mode is used to calculate the sine and cosine values of the target angle, while the vectoring mode is used to convert polar coordinates to a Cartesian coordinate system.
[0064] In terms of hardware implementation, the CORDIC algorithm can be implemented using hardware description languages such as Verilog and VHDL. For example, the CORDIC algorithm can be implemented on an FPGA to calculate sine and cosine waveforms, which is very useful in digital signal processing and communication systems. In addition, the CORDIC algorithm can also be used to implement a digitally controlled oscillator (NCO), which is an important component of software radio and direct digital synthesizer (DDS).
[0065] In mathematics, a "vector" is a quantity with magnitude (modulus) and direction, which can be represented in multidimensional space. A vector is usually described by a set of numerical values, which can be two-dimensional, three-dimensional, or higher. The "modulus", also known as the Euclidean norm, is the magnitude of a vector. The modulus is a scalar value that represents the distance from the origin to the point represented by the vector in space. In two-dimensional or three-dimensional space, the modulus can be thought of as the length of the vector in space. For a vector v = (x, y) in two-dimensional space, its modulus can be calculated using the following formula: For a vector v = (x, y, z) in three-dimensional space, its modulus can be calculated by the following formula:
[0066] The vectoring mode of the CORDIC algorithm is mainly used in hardware implementation to calculate the polar coordinate representation of a given point, that is, to convert from the Cartesian coordinate system (x, y) to the polar coordinate system (r, θ). Figure 1 As shown. The modulus is the distance from a point (x, y) in the Cartesian coordinate system to the origin. The Cartesian coordinate system is also called the rectangular coordinate system.
[0067] In this mode, the algorithm makes a series of small rotations until the y component approaches zero. At this time, the value of the x component is the modulus of the point (r), and the accumulated rotation angle (θ) can be obtained through the angle accumulator (z).
[0068] The specific implementation process is as follows: The vector mode of the CORDIC algorithm, the application scenario is to calculate the modulus (r) and rotation angle (θ) of the point in the transformed polar coordinate system when the coordinates of the point in the Cartesian coordinate system are known. Among them, the rotation angle (θ) is also called the phase angle; the modulus (r) is also called the amplitude. The iterative process of the CORDIC algorithm changes to the following formula:
[0069]
[0070] Where i is a certain iteration; x and y are the coordinates of the input vector; z is the accumulated value of the rotation angle; d i is the direction of rotation; θ i is the rotation angle, usually obtained from a lookup table. These rotation angles are usually the inverse tangent of a power of 2, θ i =arctan(2 -i ).
[0071] Direction of rotation: After N iterations, we get the following formula:
[0072]
[0073] Among them, x0 and y0 are the horizontal and vertical coordinates of the initial vector respectively; n is the number of iterations; x n ,y n They are the results of multiple rotations of the vector mode; A n is the error coefficient of the vector modulus after n pseudo-rotations. By setting x0=1, z0=0, the rotation angle θ can be finally obtained as tan -1 y (0) .
[0074] Due to the pseudo-rotation of the CORDIC algorithm, in the Cartesian coordinate plane, rotating (x1, y1) by an angle θ to (x2, y2) yields: Reference Manual Attached Figure 2 shown.
[0075] By factoring in cosθ, the equation becomes:
[0076] After removing the cosθ term, we get the pseudo-rotation formula:
[0077] Reference Figure 2 , before pseudo-rotation,
[0078] After pseudo-rotation,
[0079] The modulus of the pseudo-rotated vector R will increase by 1 / cosθ.
[0080] Since the cosθ term is ignored in each iteration during the pseudo-rotation operation, the final x n ,y n A n times.
[0081]
[0082] A n Find infinite product,
[0083] If the number of iterations executed is known, A can be directly obtained n Final value.
[0084] Among them, the error coefficient A n As a result, the range of the initial vector can only be selected in a certain area when calculating the modulus (assuming that the radius of the range is R, In the existing technology, the CORDIC algorithm will eliminate the error of the modulus length after calculating the modulus length. The method is to multiply the modulus length calculated by the engine by n Reduce A ntimes, the actual module length is make
[0085] It is precisely because of the fixed error (error coefficient A) introduced by the pseudo-rotation of the CORDIC algorithm when calculating the modulus length MOD. n ) exists, resulting in the modulus length not exceeding the unit circle radius R This limitation will lead to many problems. In order to solve this problem, in the prior art, when the vector exceeds the range, the result can only be set to a fixed value (maximum value of the modulus, for example, 1), indicating that the calculation exceeds the range. The calculation process is shown in the attached manual. Figure 3 shown.
[0086] The present application aims to solve the problem in CORDIC modulus calculation that the pseudo-rotation error will make the modulus calculation result larger by An times, resulting in too small a range of initial vector selection. By introducing a method for scaling the initial vector and calculating and restoring the modulus, the selection range of the initial vector can be infinitely expanded.
[0087] Reference Manual Attached Figure 4 The three circles and radii used by the CORDIC engine to calculate the modulus. Assuming that the radius of the circle that wraps the initial vector is R, if the radius of the initial vector (initial modulus) is less than R*k, then X after the CORDIC calculation is completed n ≤R, that is, the vector with a radius less than R*k in the figure will not overflow; R is the radius of the unit circle. If the radius of the initial vector is less than or equal to R, then after the calculation is completed, X n ≤R×A n If the radius of the initial vector is greater than R, then after the calculation is completed, X n >R×A n , which means that overflow will definitely occur. Figure 4 In the example, most of the data in the part larger than radius R is unavailable due to computational overflow, which limits the practicality and performance of the circuit.
[0088] This application proposes a vector modulus calculation method based on the CORDIC algorithm, which significantly improves the range of initial vectors that can be selected by the CORDIC algorithm, expanding it from a circular range of a fixed value R to an arbitrary value range without changing the original accuracy and performance.
[0089] The specific concept of the vector modulus calculation method of this application is described below:
[0090] We set the vector modulus of an initial vector to P; the value of P exceeds the fixed value range of the circumference radius R*k. According to the normal calculation method, the final calculation result must have a modulus overflow. Figure 5As shown, in order to scale the value range of the initial vector to a circle with a radius of R*k, we must first scale the circle with a radius of p that completely contains the value range of the vector, and scale its radius to the circle with the maximum radius R that the system can express. At this time, the reduction factor is
[0091] Then, in order to avoid overflow after calculation, the circumference of the radius R is scaled to the circumference of the radius R*k. At this time, the reduction factor is k. At this point, the CORDIC modulus calculation of vectors within the value range will not cause modulus overflow. After the calculation is completed, the result X n The pseudo-rotation has been used to offset the fixed magnification of the modulus by An times, but the result needs to be magnified again to offset the factor of scaling from a circle with radius p to a circle with radius R. This magnification factor is
[0092] From the above discussion, it can be inferred that no matter how large the original CORDIC vector is, as long as there is a certain vector modulus length P, this maximum modulus length P can be reduced by N times to make it less than or equal to R*k times the radius, and finally the result can be enlarged The exact modulus length of the initial vector can be obtained by multiplying it by .
[0093] Using this vector modulus calculation method, there is a way to perform calculations on CORDIC regardless of how large or small its value range is.
[0094] In actual applications, when executing the CORDIC algorithm, the circuit implementation will basically limit the x and y coordinates of the initial vector to between [-t, t]. Figure 5 The maximum vector magnitude within the area is
[0095] Ideally, the circle with P as radius is the maximum value of the vector modulus. However, in practical applications, the vector range is the square between the x and y coordinates [-t, t]. In order to facilitate the scaling of the modulus, its range is placed within a circle, and the smallest circle that encloses this square is the circle with a radius of p. Through this application, vectors within the range of [-t, t] will not overflow after calculation. t takes any value.
[0096] Another embodiment of the vector modulus calculation method based on the CORDIC algorithm provided in the present application includes the following steps:
[0097] When the cordie engine calculation starts, it determines whether the vector modulus is greater than the radius R*k, where R is the maximum modulus that the system can express. If it is greater than R*k, the vector modulus is reduced by N times, and then enlarged by M times after the iterative calculation is completed.
[0098] N is the ratio of the maximum vector modulus P to R in the range of values, multiplied by k:
[0099] M is the ratio between the maximum modulus R of the system and the maximum vector modulus P of the range;
[0100] Among them, P is the initial modulus length; R is the maximum modulus length that the system can express; n is the number of iterations; A n It is the error coefficient of the vector modulus after n pseudo-rotations.
[0101] The process of calculating the vector modulus length by the method proposed in this application is shown in the appendix of the specification. Figure 6 shown.
[0102] This application proposes a new method in the rotation calculation of the CORDIC circular system vector mode, aiming to solve the problem that the modulus exceeds the circumference radius during the rotation calculation due to the error factor and the initial modulus. This method significantly improves the range of initial vectors that can be selected by the CORDIC algorithm from the range of [-1,1] to any value of [-t,t] without changing the original accuracy and performance.
[0103] Another embodiment of the vector modulus length calculation method based on the CORDIC algorithm of the present application is shown in the attached specification. Figure 7 As shown, the following steps are included:
[0104] S100, obtaining the coordinates of the initial vector, calculating the initial modulus, and determining whether the initial vector will generate a modulus overflow after iterating the vector mode of the CORDIC algorithm.
[0105] S200: If yes, then before performing CORDIC algorithm vector mode iteration on the initial modulus, multiply the initial modulus by a reduction coefficient N, so that the initial modulus is reduced to N times of the original value.
[0106] S300, after the CORDIC algorithm vector mode iteration is completed, the obtained calculation result is multiplied by the magnification coefficient M to obtain the final module length calculation result.
[0107] Specifically, the coordinates (x, y) of the initial vector are obtained.
[0108] Calculate the initial modulus P:
[0109] When the initial modulus P satisfies The initial vector will not generate module length overflow after the CORDIC algorithm vector mode iteration.
[0110] When the initial modulus length P satisfies P>R*k, the initial modulus length will have a modulus length overflow after the CORDIC algorithm vector mode iteration.
[0111] If there is no overflow, the operation is performed according to the normal algorithm, and if there is an overflow, the reduction coefficient N is calculated. The reduction coefficient is used to reduce the initial module length that will cause module length overflow to N times the original.
[0112] Calculate the magnification factor M. The magnification factor M is used to restore the reduced module length result.
[0113] Among them, P is the initial modulus length and R is the maximum modulus length that the system can express. n is the number of iterations. n It is the error coefficient of the vector modulus after n pseudo-rotations.
[0114] Where n is the number of iterations. n is the error coefficient of the vector modulus after n pseudo-rotations. R is the maximum modulus that the system can express.
[0115] In another implementation of this embodiment, the value range of the x-coordinate and the y-coordinate of the initial vector is set to [-t, t], where t is an arbitrary value.
[0116] Based on the value range of the initial vector, it is determined whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration.
[0117] Specifically include:
[0118] Calculate the maximum initial modulus P within the value range,
[0119] When t satisfies The initial vector will not generate module length overflow after the CORDIC algorithm vector mode iteration.
[0120] If the value of t satisfies Then, the initial vector will have a modulus overflow after the CORDIC algorithm vector mode iteration. In this case, it is necessary to use the vector modulus calculation method described in the above embodiment to reduce the initial vector and then amplify the calculation result.
[0121] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0122] Based on the same technical concept, the present application also discloses a vector modulus length calculation system based on the CORDIC algorithm, which can be used to implement any of the above-mentioned vector modulus length calculation methods based on the CORDIC algorithm. Specifically, the vector modulus length calculation system based on the CORDIC algorithm of the present application includes:
[0123] The judgment module is used to obtain the coordinates of the initial vector, calculate the initial modulus, and judge whether the initial vector will have a modulus overflow after the CORDIC algorithm vector mode iteration.
[0124] The scaling module is used for, if yes, multiplying the initial modulus by a reduction coefficient N before performing CORDIC algorithm vector mode iteration on the initial modulus, so that the initial modulus is reduced to N times of the original.
[0125] Algorithm module for performing CORDIC algorithm vector mode iterations.
[0126] The scaling module is also used to multiply the obtained calculation result by the magnification factor M after the CORDIC algorithm vector mode iteration is completed to obtain the final module length calculation result.
[0127] In some implementations, the determination module is further used to: obtain the coordinates (x, y) of the initial vector. Calculate the initial modulus P:
[0128] When the initial modulus P satisfies The initial vector will not generate module length overflow after the CORDIC algorithm vector mode iteration.
[0129] Where n is the number of iterations. n is the error coefficient of the vector modulus after n pseudo-rotations. R is the maximum modulus that the system can express.
[0130] In some implementations, the scaling module is further configured to, when the initial modulus P satisfies P>R*k, the initial modulus will have a modulus overflow after the CORDIC algorithm vector mode iteration.
[0131] Calculate a reduction coefficient N. The reduction coefficient is used to reduce the initial module length that would cause module length overflow to N times the original length.
[0132]
[0133] Among them, P is the initial modulus length and R is the maximum modulus length that the system can express. n is the number of iterations. nIt is the error coefficient of the vector modulus after n pseudo-rotations.
[0134] In some implementations, the scaling module is further used to calculate a magnification factor M. The magnification factor M is used to restore the reduced module length result.
[0135]
[0136] Among them, P is the initial modulus length and R is the maximum modulus length that the system can express.
[0137] In some embodiments, the judgment module is further configured to set the value range of the x-coordinate and the y-coordinate of the initial vector to [-t, t], where t is an arbitrary value. Based on the value range of the initial vector, it is determined whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration.
[0138] Specifically include: calculating the maximum initial modulus P within the value range,
[0139] When t satisfies The initial vector will not generate module length overflow after the CORDIC algorithm vector mode iteration.
[0140] This application aims to solve the problem of too small initial vector selection range caused by pseudo-rotation error in CORDIC modulus calculation, introduces the scaling of the initial vector, and calculates and completes the method of restoring the modulus. This application proposes a new method in the rotation calculation of the CORDIC circular system vector pattern, which aims to solve the problem of the modulus length exceeding the circumferential radius during the rotation calculation due to the error factor and the initial modulus. This method significantly improves the range of initial vectors that can be selected by the CORDIC algorithm without changing the original accuracy and performance, and can expand the selection range of the initial vector infinitely.
[0141] The vector modulus calculation method and system based on the CORDIC algorithm of the present application have the same technical concept, and the technical details of the two embodiments are applicable to each other. In order to reduce repetition, they will not be repeated here.
[0142] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned program modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program units or modules to complete all or part of the functions described above. The program modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into a processing unit, and the above-mentioned integrated unit can be implemented in the form of hardware or in the form of software program units. In addition, the specific names of the program modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application.
[0143] Although the preferred embodiments of the present application 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 falling within the scope of the present application.
Claims
1. A vector modulus length calculation method based on the CORDIC algorithm, characterized in that: The steps include: Obtaining the coordinates of the initial vector and calculating the initial modulus length; determining whether the initial vector will generate a modulus length overflow after iterating the CORDIC algorithm vector mode; If yes, before performing CORDIC algorithm vector mode iteration on the initial modulus, multiply the initial modulus by a reduction coefficient N, so that the initial modulus is reduced to N times of the original; After the CORDIC algorithm vector mode iteration is completed, the calculated result is multiplied by the magnification factor M to obtain the final module length calculation result.
2. The method for calculating vector modulus length based on the CORDIC algorithm as claimed in claim 1, characterized in that: The method of obtaining the coordinates of the initial vector and calculating the initial modulus length and determining whether the initial modulus length will cause a modulus length overflow after iterating the vector mode of the CORDIC algorithm comprises the following steps: Get the coordinates (x, y) of the initial vector; Calculate the initial modulus P: When the initial modulus P satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur; Where n is the number of iterations; A n is the error coefficient of the vector modulus after n pseudo-rotations; R is the maximum modulus that the system can express; 3. The method for calculating vector modulus length based on the CORDIC algorithm as claimed in claim 2, characterized in that: When the initial modulus length P satisfies P>R*k; the initial modulus length will have a modulus length overflow after the CORDIC algorithm vector mode iteration; Calculate the reduction factor N; The reduction coefficient is used to reduce the initial module length that may cause module length overflow to N times the original length; Among them, P is the initial modulus length; R is the maximum modulus length that the system can express; n is the number of iterations; A n It is the error coefficient of the vector modulus after n pseudo-rotations.
4. The method for calculating vector modulus length based on the CORDIC algorithm as claimed in claim 3, characterized in that: Also includes: Calculate the magnification factor M; The magnification factor M is used to restore the reduced modulus result; Among them, P is the initial module length; R is the maximum module length that the system can express.
5. The method for calculating vector modulus length based on the CORDIC algorithm according to any one of claims 1 to 4, characterized in that: Also includes: The x-coordinate and y-coordinate of the initial vector are set to have a value range of [-t, t]; wherein t is an arbitrary value; Based on the value range of the initial vector, determining whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration; Specifically include: Calculate the maximum initial modulus P within the value range, When t satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur.
6. A vector modulus length calculation system based on the CORDIC algorithm, characterized in that: include: The judgment module is used to obtain the coordinates of the initial vector and calculate the initial modulus; Determine whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration; A scaling module, for, if yes, multiplying the initial modulus by a reduction coefficient N before performing CORDIC algorithm vector mode iteration on the initial modulus, so that the initial modulus is reduced to N times of the original; Algorithm module, used to perform CORDIC algorithm vector mode iteration; The scaling module is also used to multiply the obtained calculation result by the magnification factor M after the CORDIC algorithm vector mode iteration is completed to obtain the final module length calculation result.
7. The vector modulus length calculation system based on the CORDIC algorithm as claimed in claim 6, characterized in that: The judgment module is further used to: obtain the coordinates (x, y) of the initial vector; and calculate the initial modulus P: When the initial modulus P satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur; Where n is the number of iterations; A n is the error coefficient of the vector modulus after n pseudo-rotations; R is the maximum modulus that the system can express; 8. The vector modulus length calculation system based on the CORDIC algorithm as claimed in claim 7, characterized in that: The scaling module is also used for when the initial modulus P satisfies P>R*k; the initial modulus will have a modulus overflow after the CORDIC algorithm vector mode iteration; Calculate the reduction factor N; The reduction coefficient is used to reduce the initial module length that may cause module length overflow to N times the original length; Among them, P is the initial modulus length; R is the maximum modulus length that the system can express; n is the number of iterations; A n It is the error coefficient of the vector modulus after n pseudo-rotations.
9. The vector modulus length calculation system based on the CORDIC algorithm as claimed in claim 6, characterized in that: The scaling module is also used to calculate the magnification factor M; the magnification factor M is used to restore the reduced module length result; Among them, P is the initial module length; R is the maximum module length that the system can express.
10. The vector modulus length calculation system based on the CORDIC algorithm according to any one of claims 6 to 9, characterized in that: The judgment module is further used to set the value range of the x-coordinate and the y-coordinate of the initial vector to [-t, t]; wherein t is an arbitrary value; based on the value range of the initial vector, judge whether the initial vector will generate a modulus overflow after the CORDIC algorithm vector mode iteration; Specifically include: calculating the maximum initial modulus P within the value range, When t satisfies When the initial vector is iterated through the CORDIC algorithm vector mode, no module length overflow will occur.