Generalized hyperbolic CORDIC-based inverse hyperbolic cosine solving device and solving method

By applying the CORDIC algorithm in a generalized hyperbolic coordinate system, combining floating point number processing and logarithmic calculation, the accuracy and resource consumption problems of the anti-hyperbolic cosine solution method in the existing technology are solved, and the fast and high-precision inverse hyperbolic is achieved. Cosine computing, suitable for a wide range of application scenarios.

CN119065635APending Publication Date: 2024-12-03CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410929273.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing inverse hyperbolic cosine solution methods, such as Newton's iterative method and hyperbolic CORDIC method, have a large impact on accuracy, a large amount of hardware resource consumption and a limited convergence range, which is difficult to meet the needs of widespread applications.

Method used

The CORDIC algorithm based on the generalized hyperbolic coordinate system is adopted, and the solution of inverse hyperbolic cosine is realized through floating point processing, square deviation calculation under root number, logarithmic preprocessing and logarithmic calculation modules. Only addition, shifting and sum are required. A small number of multiplication operations reduces the number of iterations and expands the calculation range.

Benefits of technology

It realizes fast calculation speed, high accuracy and few iterations, and is suitable for inverse hyperbolic cosine solution of any positive number, reducing hardware design complexity and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119065635A_ABST
    Figure CN119065635A_ABST
Patent Text Reader

Abstract

The invention discloses an inverse hyperbolic cosine solving device and an inverse hyperbolic cosine solving method based on generalized hyperbolic CORDIC. According to the method, inverse hyperbolic cosine calculation is converted into root square difference and logarithm which can be calculated through a CORDIC algorithm under a generalized hyperbolic coordinate system. According to the anti-hyperbolic cosine device, a floating-point number processing module converts any floating-point number x into a # imgabs0 # root number lower square difference calculation module, a root number lower square difference value is calculated through a generalized hyperbolic CORDIC working in a vector mode, and then a logarithm processing value # imgabs1 # logarithm preprocessing module decomposes # imgabs2 # into an index part k2 and a mantissa part r2 through multiplication, addition and shifting operation; and the logarithm calculation module is used for solving an inverse hyperbolic tangent value taking 2 as a cardinal number through a generalized hyperbolic CORDIC calculation unit working in a vector mode, and further obtaining a calculation result of an inverse hyperbolic cosine value through addition and multiplication operations. According to the invention, the floating-point number processing module and the logarithm preprocessing module can be multiplexed by modules, the root sign lower square difference calculation module and the logarithm calculation module can also be multiplexed by modules, only simple logic resources such as addition, shift and a small number of multipliers are adopted, and the method has the advantages of short critical path, low hardware overhead and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of digital signal processing of very large scale integrated circuits, and in particular to an inverse hyperbolic cosine solving device and a solving method based on generalized hyperbolic CORDIC. Background Art

[0002] Inverse hyperbolic cosine is widely used in audio or image signal processing, feature extraction, nonlinear transformation, signal tracking and other scenarios. Many scholars have made contributions to the circuit design of inverse hyperbolic cosine. The most commonly used method for solving inverse hyperbolic cosine is Newton's iteration method. Newton's iteration method converges quickly. However, an initial guess value is required when solving, and this guess value has a greater impact on the accuracy. Moreover, Newton's iteration method requires a large number of multiplication operations and consumes a lot of hardware resources. The calculation method based on hyperbolic CORDIC is a new type of inverse hyperbolic cosine solution method, but the convergence range of this method is small, and multiple reverse iterations are required to expand the convergence range, and the application limitations are more obvious.

[0003] The CORDIC algorithm has attracted widespread attention because it only has shift and addition operations and its circuit design is simple. The algorithm was proposed in 1956 and was initially used to calculate trigonometric functions and multiplication and division. Later, the CORDIC algorithm in the hyperbolic coordinate system was proposed, which can realize exponential and logarithmic operations based on the natural constant e. The CORDIC algorithm in the generalized hyperbolic coordinate system extends the hyperbolic CORDIC algorithm to any number as the basis, greatly improving the application range of hyperbolic CORDIC. Summary of the invention

[0004] The present invention aims to expand the calculation range, avoid reverse iteration, and reduce the complexity of hardware design. Based on the CORDIC algorithm in a generalized hyperbolic coordinate system, a novel inverse hyperbolic cosine solving device and solving method are proposed.

[0005] The technical solution adopted by the device of the present invention is: an inverse hyperbolic cosine solving device based on generalized hyperbolic CORDIC, comprising: a floating point number processing module for expressing the positive number x to be solved as Where r1∈[1,2), k1 is an integer, according to Shift 1 right by k1 to get And r1, k1 and The value is output to the square root difference calculation module;

[0006] The square root difference calculation module is used to calculate the square root difference value. And add x to get Pass to the logarithmic preprocessing module;

[0007] Logarithmic preprocessing module is used to Divided into The form of, and the exponent part k2 is shifted right one position to get r2 performs the operations of adding 1 and -1 to obtain r2+1 and r2-1 respectively, and outputs them to the logarithmic calculation module;

[0008] Logarithmic calculation module, used to calculate logarithmic values according to The inverse hyperbolic cosine of the number x to be solved is obtained through multiplication operation

[0009]

[0010] The floating point number processing module includes a floating point number processing unit and a constant shift register unit. The floating point number processing unit decomposes the input number x into In the form of, k1 is an integer, r1∈[1,2), the constant shift register unit shifts 1 right by k1 bits to obtain And r1, k1 and The value is output to the square root difference calculation module;

[0011] The square root difference calculation module comprises a CORDIC calculation unit in a vector mode generalized hyperbolic coordinate system, a first multiplier unit, a first adder unit and a left shift register unit; the CORDIC calculation unit in the vector mode generalized hyperbolic coordinate system calculates the square root difference according to the input r1, k1 are calculated is a constant of 0.6072529; the first multiplier unit calculates the CORDIC calculation unit in the vector mode generalized hyperbolic coordinate system Multiply get The left shift register unit converts the output result of the multiplier unit Shift left by k1 to get The first adder unit adds the calculation result of the shift register unit to Add to x to get the logarithmic parameter value

[0012] The logarithmic preprocessing module includes a preprocessing unit, a right shift register unit, a second adder unit and a third adder unit; the preprocessing unit Decompose into Wherein k2 is an integer, r2∈[1,2), and the right shift register unit shifts the decomposed k2 value right by one bit to obtain The second adder unit adds 1 to the decomposed r2 value to obtain r2+1, and the third adder unit adds -1 to the decomposed r2 value to obtain r2-1, and outputs it to the logarithm calculation module;

[0013] The logarithmic calculation module includes a CORDIC calculation unit in a vector mode generalized hyperbolic coordinate system, a fourth adder unit and a second multiplier unit, wherein the CORDIC calculation unit in the vector mode generalized hyperbolic coordinate system calculates a logarithmic value with 2 as the base. The fourth adder unit calculates the logarithmic value of The logarithmic preprocessing module obtains Add together to get The second multiplier unit outputs the logarithmic value Multiply by 2ln2 to get the inverse hyperbolic cosine

[0014] The present invention provides an inverse hyperbolic cosine solution method based on generalized hyperbolic CORDIC, the method comprising the steps of:

[0015] (1) For the number x to be solved, if x satisfies Then shift the number x right by k1 bits to get the number r1 in the range [1,2). k1 is an integer. Shift the stored constant 1 right by k1 bits to get Output r1, k1, To the square root difference calculation module;

[0016] (2) Using the CORDIC algorithm in vector mode in a generalized hyperbolic coordinate system, solve the square root difference

[0017]

[0018] (3) The calculated value in step (2) Multiply by a constant get Then Shift the k1 bits calculated in step (1) to get

[0019] (4) Subtract the square root difference calculated in step (3) from Add to the input number x to get the logarithmic processing number The logarithmic preprocessing unit is used to calculate Decompose to get r2 and k2, and shift the exponent part k2 right by one position to get r2 performs the operations of adding 1 and -1 to get r2+1 and r2-1 respectively;

[0020] (5) Using the CORDIC algorithm in the generalized hyperbolic coordinate system working in vector mode, solve the logarithmic value According to the decomposition operation of step (4) Will And the result obtained in step (4) Add together to get

[0021] Finally, multiply by 2ln2 to get

[0022] In step (2), the initial value x0 of the x channel of the CORDIC algorithm in the generalized hyperbolic coordinate system is set to r1, and the initial value y0 of the y channel is set to The initial value z0 of the z channel is set to 0, the generalized hyperbolic coordinate system base b is set to 2, and the output value of x is obtained after several iterations

[0023] In the step (5), the initial value x0 of the x channel of the CORDIC algorithm in the generalized hyperbolic coordinate system is set to r2+1, the initial value y0 of the y channel is set to r2-1, the initial value z0 of the z channel is set to 0, and the generalized hyperbolic coordinate system basis b is set to 2. After several iterations, the output value of z is obtained.

[0024] The present invention has the following beneficial effects:

[0025] (1) The present invention only needs to perform addition, shift and a small amount of multiplication operations, with a short critical path, fast calculation speed, few iterations and high accuracy.

[0026] (2) The device of the present invention can be used to solve the inverse hyperbolic cosine value of any positive number without being affected by the convergence range of the CORDIC algorithm itself. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 This is the overall architecture diagram of the inverse hyperbolic cosine solver based on generalized hyperbolic CORDIC; Specific implementation plan

[0028] The scheme of the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0029] For any positive number, according to the identity

[0030]

[0031] Therefore, solving the inverse hyperbolic cosine can be transformed into solving and The solution.

[0032] The overall architecture of the inverse hyperbolic cosine solution device based on generalized hyperbolic CORDIC of the present invention is shown in FIG. Figure 1 As shown. The floating point number processing module mainly processes the input x. For any value x, if x satisfies (k1 is an integer), then by shifting right by k1 bits, we can get the number r1 in the range [1,2). x can be expressed as According to the properties of the square difference function under the square root, we have:

[0033]

[0034] Because the convergence domain of the CORDIC algorithm working in the generalized hyperbolic coordinate system is and The value of r1 falls within the convergence region and also meets the constraint that the overall value under the square root is greater than 0. Therefore, the CORDIC algorithm working in the generalized hyperbolic coordinate system can be used to solve the square difference under the square root of r1, and then obtain

[0035] According to the properties of the inverse hyperbolic cosine function, we have:

[0036]

[0037] Deformed:

[0038]

[0039] Taking the base 2 logarithm of both sides, we get:

[0040]

[0041] Derived:

[0042]

[0043] According to the properties of floating point decomposition, we have:

[0044]

[0045] Because the convergence domain of the CORDIC algorithm working in the generalized hyperbolic coordinate system is and The value of r2 falls within the convergence region, so the CORDIC algorithm working in the generalized hyperbolic coordinate system can be used to solve the logarithm of r2 with base 2, and then cosh -1 x.

[0046] The generalized hyperbolic CORDIC computing unit working in vector mode represents the hardware structure of the i+1th cascade stage of the generalized hyperbolic CORDIC when it is fully pipelined, including six adders (subtractors) and two shift registers. The input is the output x of the previous pipeline stage. i ,y i ,z i The basis of the ordinary hyperbolic CORDIC algorithm is the natural constant e, while the basis b of the generalized hyperbolic CORDIC coordinate system working in the vector mode can be any positive number. In the present invention, the value of the basis b is taken as 2. The iteration formula is as follows:

[0047] x i+1 =x i -sign(y i )(2 -i y i )

[0048] y i+1 =y i -sign(y i )(2 -i x i )

[0049]

[0050] Before hardware implementation, it is necessary to pre-calculate The value of is stored in the lookup table. i If y is a positive number, i Shift right by i bits and add to x i Subtract to get x i+1 , x i Shift right by i bits and add to y i Subtract to get y i+1 , z i and in the lookup table Add the values ​​of i+1 ; if y i If y is negative, i Shift right by i bits and add to x i Add together to get x i+1 , x i After right shift i bits, add y i Add together to get y i+1 , z i and in the lookup table Subtract the value of i+1 Output x i+1 ,y i+1 , z i+1 It will be used as the input of the next pipeline stage. If the CORDIC algorithm needs to go through N iterations to obtain the target accuracy, N computational units need to be cascaded, and pipelines are added after each cascade to achieve full pipeline operation.

[0051] In the present invention, the calculation unit can be used to calculate the logarithmic value and the square root difference. When calculating the square root difference, the initial value x0 of the x channel in the calculation unit is set to r1, and the initial value y0 of the y channel is set to The initial value z0 of the z channel is set to 0. Among them, r1 and It is obtained by shifting the output r1 and output k1 of the floating-point processing unit module. After several iterations, the x channel output value x n for x n The output value of is obtained by multiplication. Then after the shift register is shifted left by k1 bits and the addition operation, we can get

[0052] Will The floating point unit process is decomposed into the exponent part k2 and the mantissa part r2, where r2∈[1,2). According to the properties of the logarithmic function, we can get:

[0053]

[0054] Therefore, the input of the floating point preprocessing module is The output is r2 and

[0055] When calculating logarithms, the initial value x0 of the x channel is set to r2+1, the initial value y0 of the y channel is set to r2-1, and the initial value z0 of the z channel is set to 0. Among them, r2+1 and r2-1 are obtained by adding or subtracting 1 from the output r2 of the floating-point decomposition unit module. After several iterations, the output value z of the z channel is n for

[0056] So, z n Output value and Add together to get Finally, multiply it by 2ln2 to get

[0057] Example

[0058] (1) In this embodiment, the input data is (1,2 8 ). In the generalized hyperbolic CORDIC algorithm, the maximum number of CORDIC iterations is set to 16, where the number 4 and 13 are repeated once when using the generalized hyperbolic CORDIC. Therefore, the generalized hyperbolic CORDIC needs to be iterated 18 times in total, and the output of the x channel after 18 iterations is the square root difference, and the output of the z channel after 18 iterations is the logarithm value with base 2 as the base.

[0059] (2) This embodiment takes image processing as an example to illustrate how the device is used in practical applications. In image processing, such as feature extraction, nonlinear transformation and other operations, the solution of inverse hyperbolic cosine is used. Generally, image processing is implemented based on FPGA. The calculation time using the original method is usually relatively long, and the hardware resource overhead is large. The solution device provided by the present invention can be deployed on FPGA. The input of the solution device is the number to be solved x represented by a floating point number. By flexibly setting the number of iterative calculations, different accuracy requirements can be met. After several iterative operations, the output is the inverse hyperbolic cosine value of x. The solution device adopts a fully pipelined structure, and its critical path is a shift register and an adder. The existing inverse hyperbolic cosine solution device is designed using the Newton iteration method or the hyperbolic CORDIC. Compared with the Newton iteration device, the device reduces the delay and hardware overhead. Compared with the hyperbolic CORDIC method, it meets a wide range of inputs and reduces the number of iterations. Therefore, deploying the solution device on the FPGA can achieve the purpose of reducing delay and reducing design complexity.

[0060] The invention can obtain the inverse hyperbolic cosine calculation result only through shifting, addition and a small number of multipliers, greatly shortens the critical path, improves the effect of module reuse, increases the input range, reduces the number of iterations, and improves the calculation accuracy.

[0061] Table 1: Accuracy calculation table

[0062] Condition enter Verilog implementation accuracy Case 1 6 <![CDATA[2.7050×10 -6 ]]>

Claims

1. An inverse hyperbolic cosine solving device and solving method based on generalized hyperbolic CORDIC, characterized in that: The device includes: Floating point number processing module, used to express the positive number x to be solved as Where r1∈[1,2), k1 is an integer, according to Shift 1 right by k1 to get And r1, k1 and The value is output to the square root difference calculation module; The square root difference calculation module is used to calculate the square root difference value And add x to get Pass to the logarithmic preprocessing module; Logarithmic preprocessing module is used to Divided into The form of, and the exponent part k2 is shifted right one position to get r2 performs the operations of adding 1 and -1 to obtain r2+1 and r2-1 respectively, and outputs them to the logarithmic calculation module; Logarithmic calculation module, used to calculate logarithmic values according to The inverse hyperbolic cosine of the number x to be solved is obtained through multiplication operation The floating point number processing module includes a floating point number processing unit and a constant shift register unit. The floating point number processing unit decomposes the input number x into In the form of, k1 is an integer, r1∈[1,2), the constant shift register unit shifts 1 right by k1 bits to obtain And r1, k1 and The value is output to the square root difference calculation module; The square root difference calculation module comprises a CORDIC calculation unit in a vector mode generalized hyperbolic coordinate system, a first multiplier unit, a first adder unit and a left shift register unit; the CORDIC calculation unit in the vector mode generalized hyperbolic coordinate system calculates the square root difference according to the input r1, k1 are calculated is a constant of 0.6072529; the first multiplier unit calculates the CORDIC calculation unit in the vector mode generalized hyperbolic coordinate system Multiply get The left shift register unit converts the output result of the multiplier unit Shift left by k1 to get The first adder unit adds the calculation result of the shift register unit to Add to x to get the logarithmic parameter value The logarithmic preprocessing module includes a preprocessing unit, a right shift register unit, a second adder unit and a third adder unit; the preprocessing unit Decompose into Wherein k2 is an integer, r2∈[1,2), and the right shift register unit shifts the decomposed k2 value right by one bit to obtain The second adder unit adds 1 to the decomposed r2 value to obtain r2+1, and the third adder unit adds -1 to the decomposed r2 value to obtain r2-1, and outputs it to the logarithm calculation module; The logarithmic calculation module includes a CORDIC calculation unit in a vector mode generalized hyperbolic coordinate system, a fourth adder unit and a second multiplier unit, wherein the CORDIC calculation unit in the vector mode generalized hyperbolic coordinate system calculates a logarithmic value with 2 as the base. The fourth adder unit calculates the logarithmic value of The logarithmic preprocessing module obtains Add together to get The second multiplier unit outputs the logarithmic value Multiply by 2ln2 to get the inverse hyperbolic cosine 2. The inverse hyperbolic cosine solution method based on generalized hyperbolic CORDIC according to claim 1, characterized in that: The inverse hyperbolic cosine calculation consists of the following steps: (1) For the number x to be solved, if x satisfies Then shift the number x right by k1 bits to get the number r1 in the range [1,2). k1 is an integer. Shift the stored constant 1 right by k1 bits to get Output r1, k1, To the square root difference calculation module; (2) Using the CORDIC algorithm in vector mode in a generalized hyperbolic coordinate system, solve the square root difference (3) The calculated value in step (2) Multiply by a constant get Then Shift the k1 bits calculated in step (1) to get (4) Subtract the square root difference calculated in step (3) from Add to the input number x to get the logarithmic processing number The logarithmic preprocessing unit is used to calculate Decompose to get r2 and k2, and shift the exponent part k2 right by one position to get r2 performs the operations of adding 1 and -1 to get r2+1 and r2-1 respectively; (5) Using the CORDIC algorithm in the generalized hyperbolic coordinate system working in vector mode, solve the logarithmic value According to the decomposition operation of step (4) Will And the result obtained in step (4) Add together to get Finally, multiply by 2ln2 to get In step (2), the initial value x0 of the x channel of the CORDIC algorithm in the generalized hyperbolic coordinate system is set to r1, and the initial value y0 of the y channel is set to The initial value z0 of the z channel is set to 0, the generalized hyperbolic coordinate system base b is set to 2, and the output value of x is obtained after several iterations In the step (5), the initial value x0 of the x channel of the CORDIC algorithm in the generalized hyperbolic coordinate system is set to r2+1, the initial value y0 of the y channel is set to r2-1, the initial value z0 of the z channel is set to 0, and the generalized hyperbolic coordinate system basis b is set to 2. After several iterations, the output value of z is obtained.