1. Technical Field
The present disclosure generally relates to a fast divider and, more particularly, to a fast divider with a high convergence speed and a fast division method thereof.
2. Description of Related Art
Division is a general method of numerical computation to obtain a quotient according to a divisor and a dividend. Therefore, a divider is an essential device in various circuits. Conventional division algorithms can be categorized into slow division, Newton-Raphson division and Goldschmidt division.
All of the three division algorithms can be used to obtain a quotient. However, these division algorithms have some problems. For example, the convergence speeds of these division algorithms are not fast enough, with the result that multiple division calculations are required to make the outcome approximate to the actual quotient. Moreover, these division algorithms take higher hardware cost, larger hardware size and higher hardware complexity to implement.
One aspect of the present disclosure provides a fast divider. The fast divider includes an initial parameter setting unit and an arithmetic unit. The arithmetic unit is coupled to the initial parameter setting unit. The initial parameter setting unit is configured to receive a divisor and a dividend and set a plurality of initial parameters of a sequence according to the divisor and the dividend. The plurality of initial parameters includes an initial term, a first term and a common ratio. The common ratio has an absolute value smaller than 1 The arithmetic unit is configured to store a recurrence relation of the sequence and iteratively compute a quotient using the recurrence relation according to the plurality of initial parameters. The recurrence relation indicates that a (k+1)th term is equal to a product of a kth term multiplied by a sum of the common ratio and 1 subtracted by a product of a (k−1)th term multiplied by the common ratio. k is an integer larger than or equal to 1.
Another aspect of the present disclosure provides a fast division method. The fast division method includes the steps herein. In Step A, a divisor and a dividend are received. In Step B, a plurality of initial parameters of a sequence are estimated according to the divisor and the dividend. The plurality of initial parameters includes an initial term, a first term and a common ratio. The common ratio has an absolute value smaller than 1 In Step C, a quotient is iteratively computed using a recurrence relation of the sequence according to the plurality of initial parameters. The recurrence relation indicates that a (k+1)th term is equal to a product of a kth term multiplied by a sum of the common ratio and 1 subtracted by a product of a (k−1)th term multiplied by the common ratio. k is an integer larger than or equal to 1.
As previously stated, the present disclosure provides a fast divider and a fast division method thereof using only addition, subtraction, multiplication, and bit shifting to compute the quotient in division computation to reduce the hardware cost, the hardware size and the hardware complexity. Moreover, the present disclosure providing a fast divider and a fast division method thereof exhibits a convergence speed and the fast divider only executes a small number of iteration computations to obtain an iteration result approximate to the actual quotient.
In order to further understand the techniques, means and effects of the present disclosure, the following detailed descriptions and appended drawings are hereby referred to, such that, and through which, the purposes, features and aspects of the present disclosure can be thoroughly and concretely appreciated; however, the appended drawings are merely provided for reference and illustration, without any intention to be used for limiting the present disclosure.
The accompanying drawings are included to provide a further understanding of the present disclosure, and are incorporated in and constitute a part of this specification. The drawings illustrate exemplary embodiments of the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
Referring to
The initial parameter setting unit 10 is configured to receive a divisor D and a dividend N and set a plurality of initial parameters of a sequence according to the divisor D and the dividend N. The sequence includes a plurality of terms. The plurality of initial parameters includes an initial term a0, a first term a1 and a common ratio r of the sequence. The common ratio r has an absolute value smaller than 1 (i.e., |r|<1).
The arithmetic unit 11 is configured to store a recurrence relation of the sequence and iteratively compute a quotient Q using the recurrence relation according to the plurality of initial parameters. In the arithmetic unit 11, the recurrence relation indicates that a (k+1)th term ak+1 is equal to a product of a kth term ak multiplied by a sum of the common ratio and 1 (i.e., r+1) subtracted by a product of a (k−1)th term ak−1 multiplied by the common ratio r. k is an integer larger than or equal to 1. Moreover, the roots of the characteristic equation of the recurrence relation are, respectively, 1 and the common ratio r. The recurrence relation can be expressed as:
ak+1=(1+r)ak−rak−1, ∀k≥1 (1)
In short, the arithmetic unit 11 can convert division into iteratively computing a recurrence relation so that the computed iteration result approaches the actual quotient Q. From the recurrence relation, the arithmetic unit 11 uses addition, subtraction, multiplication, and bit shifting to compute the quotient Q without using division. Accordingly, the cost and complexity of the hardware of the fast divider 1 can be reduced.
Persons with ordinary skill in the art may understand that the characteristic equation can be derived from the recurrence relation and each term of the recurrence relation can be expressed as the general solution of the equation. For example, the kth term ak of the sequence can be expressed as a linear combination of 1 and the common ratio r to the power of k (rk) with a first coefficient α and a second coefficient β. The kth term ak can be expressed as:
ak=α+βrk (2)
The kth term ak approaches the actual quotient Q after repeated iteration computations. In other words, when k approaches infinity, the kth term ak can be expressed as:
Accordingly, after multiple iteration computations, the first coefficient α equals or approaches the quotient Q. That is, the kth term ak approaches the actual quotient Q when α equals the quotient Q. The first coefficient α and the second coefficient β correspond to the initial term a0, the first term a1 and the common ratio r of the recurrence relation. Therefore, the convergence speed of the fast divider 1 depends on how the initial parameter setting unit 10 decides the initial term a0, the first term a1 and the common ratio r. The iteration result computed by the arithmetic unit 11 approaches the quotient Q faster when the plurality of initial parameters is estimated more precisely. The faster the convergence speed, the more rapidly the iteration result obtained by the fast divider 1 after each iteration computation approaches quotient Q. How the initial parameter setting unit 10 determines the plurality of initial parameters will be further described herein.
To further describe the operation of the fast divider 1, please refer to
In Step S202, the initial parameter setting unit 10 sets the initial parameters of the recurrence relation. More particularly, the initial parameter setting unit 10 sets the initial term a0 to be 0 and sets the first term a1 to be a first function g(D) divided by 2 to the power of a second function f(D) (as expressed in Equation 4). Moreover, the initial parameter setting unit 10 further sets the common ratio r to be 1 subtracted by a product of the first term a1 multiplied by the divisor D (as expressed in Equation 5). It should be noted that the first function g(D) and the second function f(D) exist when the common ratio has an absolute value |r| smaller than 1.
Then, substituting k=0, 1, respectively, into Equation (2), we obtain the following two equations:
a0=α+β (6)
a1=α+βr (7)
Subtracting Equation (7) from Equation (6) multiplied by r, we obtain the following equation:
Substituting a0, a1 and r into Equation (8), the first coefficient α can be simplified as:
As previously stated, in the present disclosure, the initial term a0, the first term a1 and the common ratio r enables the first coefficient α to approach the quotient Q.
It should be noted that since the common ratio r=1−a1D, the first term a1 estimated by the initial parameter setting unit 10 approaches 1/D, the absolute value |r| of the common ratio approaches 0, and the convergence speed of the recurrence relation becomes faster. Therefore, the convergence speed of the recurrence relation depends on the first function g(D) and the second function f(D).
To describe how the first function g(D) and the second function f(D) are designed to estimate the first term a1, please refer to
The divisor D is within a range between 2 to the power of s and 2 to the power of s+1 with s being an integer (i.e., 2s≤D<2s+1). After receiving the divisor D, the initial parameter setting unit 10 obtains the s value by determining the power when 2s approaches the divisor D the most but is smaller than D.
Then, the initial parameter setting unit 10 determines an intersection point of the equation x=2s and the equation y=1/x, and the intersection point is used as a tangential point to derive a linear equation (Equation (10)) of a first tangent line y1.
Similarly, the initial parameter setting unit 10 determines an intersection point of the equation x=2s+1 and the equation y=1/x, and the intersection point is used as a tangential point to derive a linear equation (Equation (11)) of a second tangent line y2.
Furthermore, the initial parameter setting unit 10 computes an intersection point of the first tangent line y1 and the second tangent line y2 to obtain the x-coordinate of the intersection point as 2s+2/3.
The initial parameter setting unit 10 determines how to estimate the first term a1 according to the value of the divisor. When the divisor D is located on the left side of the linear equation x=2s+2/3, the first term a1 converges faster to the actual quotient Q if the first term a1 is estimated with the first tangent line y1. On the contrary, when the divisor D is located on the right side of the linear equation x=2s+2/3, the first term a1 converges faster to the actual quotient Q if the first term a1 is estimated with the second tangent line y2.
To enable the first term a1 to approach 1/D, the fast divider 1 of the present disclosure defines a first function g(D) and a second function f(D). The first function g(D) is equal to 2 to the power of s+1 subtracted by the divisor D and the second function f(D) is equal to a product of s multiplied by 2 when a product of the divisor D multiplied by 3 is smaller than or equal to 2 to the power of s+2. On the other hand, the first function g(D) is equal to 2 to the power of s+2 subtracted by the divisor D and the second function f(D) is equal to a product of s multiplied by 2 plus 2 when a product of the divisor D multiplied by 3 is larger than 2 to the power of s+2. The first function g(D) and the second function f(D) are expressed below.
In the present disclosure, the fast divider 1 changes the first function g(D) and the second function f(D) according to the value of the divisor
D to adjust the first term a1 so that the first term a1 approaches actual quotient Q. Compared to the conventional divider where the quotient Q is approached from x=2s or 2s+1, the fast divider 1 of the present disclosure estimates the quotient Q using the first term a1 to exhibit a higher convergence speed.
For example, when the divisor D is 100, the fast divider 1 determines that s is 6, and 3*(100) is larger than 28. Using the Equations (12) and (13), the first function g(D) is 156, and the second function f(D) is 14. Then, according to Equation (4), the fast divider 1 sets the first term a1 to be 156/214. Compared to the conventional divider where 1/100 is approached from 1/64 or 1/128, the fast divider 1 of the present disclosure iteratively computes the first term a1 to enable the computed iteration result converges to 1/100 more rapidly.
Then, referring back to
To obtain the quotient Q rapidly, the present disclosure further provides a method for rapidly computing the recurrence relation. Referring to
According to Equation (14), during the iteration computations by the arithmetic unit 11, if
approaches
within a finite number of iteration computations, the iteration result computed by the arithmetic unit 11 is more approximate to the actual quotient Q.
Therefore, to make the iteration result computed by the arithmetic unit 11 rapidly approach the actual quotient Q, the arithmetic unit 11 defines a parameter matrix Mt. The parameter matrix Mt has a plurality of elements therein depending on the common ratio r, and the parameter matrix Mt changes with the change of the number of iteration computations. The parameter matrix Mt is equal to the square of a previous parameter matrix Mt−1 obtained after a (t−1)th iteration computation is executed when a tth iteration computation is being executed. Thus, we obtain
where t is the number of iteration computations by the arithmetic unit 11.
According to Equation (15), the parameter matrix Mt can be rewritten as:
The iteration result after the tth iteration computation by the arithmetic unit 11 can be expressed as a matrix product of the parameter matrix Mt multiplied by a column matrix having the first term a1 and the initial term a0 as elements. Thus, we obtain
According to Equation (16), the power of the parameter matrix Mt increases exponentially as the number of iteration computations increases. As a result, the parameter matrix Mt rapidly approaches
Compared to the iteration computation by the conventional divider, the iteration computation of the arithmetic unit 11 according to the present disclosure exhibits a higher convergence speed.
In Step S402, the arithmetic unit 11 diagonalizes and rewrites the parameter matrix Mt. More particularly, the diagonalized parameter matrix Mt is expressed below:
Then, the diagonalized parameter matrix Mt is rewritten as:
In Step S403, the arithmetic unit 11 selects an element in the rewritten parameter matrix Mt as an iteration coefficient mt so as to rewrite the recurrence relation according to the iteration coefficient mt. In the present embodiment, the arithmetic unit 11 selects
as an iteration coefficient mt. On the other hand,
can be expressed as (1-mt). Moreover, in other embodiments, the arithmetic unit 11 may also select other elements in the parameter matrix Mt as iteration coefficients mt, to which the present disclosure is not limited.
When t>0, the iteration coefficient mt can be expressed as mt=(1+r2
the iteration coefficient mt can further be rewritten as:
mt=[2−(1−r2
According to Equation (20), the iteration coefficient mt is expressed as:
On the other hand, from Equation (17) and (19), the previously stated recurrence relation can further be simplified as:
a2
In other words, the recurrence relation in Equation (1) can be simplified with only the initial term a0, the first term a1 and the common ratio r for iteration computations.
In Step S404, the arithmetic unit 11 iteratively computes according to the recurrence relation in Equation (22) to obtain the iteration result a2
As previously stated, the present disclosure provides a fast divider and a fast division method thereof using only addition, subtraction, multiplication, and bit shifting to compute the quotient in division computation to reduce the hardware cost, the hardware size and the hardware complexity. Moreover, the present disclosure providing a fast divider and a fast division method thereof exhibits a convergence speed and the fast divider only executes a small number of iteration computations to obtain an iteration result approximate to the actual quotient.
The above-mentioned descriptions represent merely the exemplary embodiment of the present disclosure, without any intention to limit the scope of the present disclosure thereto. Various equivalent changes, alterations or modifications based on the claims of the present disclosure are all consequently viewed as being embraced by the scope of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
105106296 A | Mar 2016 | TW | national |
Number | Name | Date | Kind |
---|---|---|---|
3828175 | Amdahl | Aug 1974 | A |
4364115 | Asai | Dec 1982 | A |
4481600 | Asai | Nov 1984 | A |
Entry |
---|
Michael J. Flynn, “On Division by Functional Iteration”, IEEE Transactions on Computers, vol. C-19, No. 8, Aug. 1970. |
David L. Harris, et al., “SRT Division Architectures and Implementations”, Computer Systems Laboratory, Stanford University. |
S.F. Anderson, et al., “The IBM System/3GO Model 91: Floating-Point Execution Unit”, IBM Journal—Jan. 1967. |
Number | Date | Country | |
---|---|---|---|
20170255449 A1 | Sep 2017 | US |