Cross Reference to Related Applications
Apparatus for digital division computation, Ser. No. 816,595, filed on July 18, 1977, now abandoned in favor of continuation-in-part of application Ser. No. 959,269, filed on Nov. 9, 1978 now U.S. Pat. No. 4,364,115.
Background of the Invention
The present invention relates to a method and apparatus for division in data processing system and specially for floating point division in radix-2.sup.n digital computer where n>1.
Division by iterative multiplications has been implemented in the division process of digital computer. One technique described in "The IBM System/360 Model 91: Floating-point Execution Unit" IBM Journal of Res. & Develop. Vol. 11 No. 1, 1967 pp. 34-54 by S. F. Anderson et al. treats the dividend and divisor as numerator and denominator of a fraction. It accomplishes the division by multiplying both the numerator and denominator with the same sequence of convergence factors until the denominator approaches approximately unity. The resulting numerator then is considered an approximated quotient.
It is assumed the dividend and divisor are positive and normalized fractions in floating point number representation with the range 1>A,B.gtoreq.1/D where D denotes a radix. This normalized range implies that the divisor can be expressed as B=1-q for some q in the range 0<q.ltoreq.(D-1)/D. The first multiplying factor is chosen as R.sub.o =1+q then B.sub.o =B.times.R.sub.o =(1-q)(1+q)=1-q.sup.2. The second multiplying factor is selected as R.sub.1 =2-B.sub.o =1+q.sup.2 then B.sub.1 =B.sub.o .times.R.sub.1 =1-q.sup.4. In general, at the i.sup.th iteration, R.sub.i =1+q.sup.2.spsp.i and B.sub.i =1-q.sup.2.spsp.i+1. Since .vertline.q.vertline.<1 and q.sup.2.spsp.i+1 <.epsilon., B.sub.i is an approximated unity where .epsilon. represents the least significant bit of the division register in computer. Thus, AR.sub.o R.sub.1 R.sub.2 . . . R.sub.i is the desired quotient. The first multiplier R.sub.o, determined by table-lookup, is 10 bits long and yields a minimum 0 or 1 string length of seven bits in B.sub.o, namely 0.1111111xxx . . . or 0.0000000xxx . . . where x is 0 or 1.
This technique is essentially an power series evaluation of 1/B:
where B=(1+q)D and 0<q.ltoreq.1/(D-1). For 56-bits fraction, five multiplying factors, R.sub.o, R.sub.1, R.sub.2, R.sub.3, and R.sub.4 (=1+q.sup.2.spsp.i for i=1,2,3,4), are needed.
The acceleration method described in the related application was proposed to obtain a smaller value q from a given divisor. Then, the power series evaluation can be accomplished with a fewer number of multiplying factors with the smaller value where .vertline.q.vertline..ltoreq.1/(2D-3) was guaranteed. In the acceleration method, three successive applications of acceleration constants are needed in order to obtain the smaller value q.
Summary of the Invention
An object of this invention is to provide an improved high-speed division mechanism in radix-2.sup.n machine.
A further object of this invention is to implement a low-cost mechanism in division apparatus that performs high-speed division.
Dividend A and divisor B that are multiplied by successive acceleration constants result in Aa.sub.o a.sub.1 a.sub.2 /Ba.sub.o a.sub.1 a.sub.2 and the constant multiplied divisor is of the form Ba.sub.o a.sub.1 a.sub.2 =D.sup.n+i (1+q.sub.i /D.sup.n+i) by using the iterative mapping function defined herein where i denotes the i.sup.th iteration and D is a radix. Note: The multiplication of a.sub.2 (=(mD-1)/m) is accomplished by digit shift and subtraction.
Brief Description of the Drawing
FIG. 1 depicts the boundary between subdivisions S.sub.a and S.sub.a+1 which are defined herein.
FIG. 2 is a table of the s-subdivision with D=8 and m=2.
FIG. 3 is an operational block diagram indicating a performing logic of iterative multiplications of the acceleration constant to dividend A and divisor B.
Detailed Description of the Invention
Since this invention is an improvement of the invention described in the section of Cross Reference to related applications, the previous invention is summarized here.
A division A/B may be evaluated through the power series: ##EQU1## where D is the radix (.vertline.D.vertline.>1), B=D+P, and .vertline.P/D.vertline.<1. The power series involves no division operation (1/D.sup.n is a shift). The ratio .vertline.P/D.vertline. must be small for fast convergence.
Let the divisor B be in the domain (D.sup.n,D.sup.n+1) where D and D.sup.n are base radix and pseudoradix respectively. Then B=D.sup.n +q.sub.o, where q.sub.o =P for P>0 and q.sub.o =D.sup.n+1 -D.sup.n +P for P<0. When P=0, A/B is reduced to a shift operation. The ratio P/D.sup.n to be used in eq. (2.1) is represented by a function of q: ##EQU2##
We introduce an overrelaxation parameter a in eq. (2.2.b) as follows: ##EQU3## The suffix n is an argument of the function and may be omitted for simplicity. By imposing -g(q.sup.+, a+1)=g(q.sup.+,a) to determine the value of q.sup.+, which is the boundary of subdivisions S.sub.a for a=1,2,3, . . . ,D-1, the following results are obtained ##EQU4## where D' denotes an appropriate pseudoradix.
By substituting eq. (2.4) into eq. (2.3), the local maxima of g(q,a) in the subdivisions (i.e., the maximum ratios of P/D') are
FIG. 1 shows the area near the boundary between the subdivisions S.sub.a and S.sub.a+1.
An iterative contracting map has been introduced by starting with q.sub.o and recursively applying q.sub.i+1 =-g(q.sub.i, a.sub.i +1)D.sup.n. The movement of q.sub.o through the contracting mapping results in the subdivisions S.sub.D-1 where the smallest ratio P/D'-- i.e., q.sub.f =g(q*, D-1) in the domain [D.sup.n+i, D.sup.n+i+1 ]-- is obtained where i denotes the number of iterations. The q* denotes the very last q value in the recursive mapping; we can find this smallest ratio from eq. (2.6) with a=D-2.
Next, a generalized process of the method is described. A generalized parameter (ma+j)/m is proposed for the overrelaxation where m=1,2,2.sup.2,2.sup.3, . . . ,D, and j is an integer m>j.gtoreq.0. When m=1 and j=0, or m=1 and j=1, the parameter (ma+j)/m becomes a or a+1, respectively. This generalization thus includes the method discussed in the previous section. Moreover, the multiplication ma and the division 1/m of the new parameter can be accomplished only by digit shift operations. Therefore, the use of the generalized parameter in the overrelaxation does not increase the number of multiplications in computing the reciprocal of divisor B.
Let us consider a boundary of subdivisions defined by eqs. (2.5). By taking the average of parameters a and a+1 (i.e., (2a+1)/2) we find that the function g(q,(2a +1)/2) intersects the abscissa at the point marked by M.sub.2,1.sup.a, shown in FIG. 1. Furthermore, the intersecting point found from -g(q.sup.+, a+1)=g(q.sup.+, a) is the boundary between subdivisions S.sub.a and S.sub.a+1. The number of subdivision intervals increases from D to 2D-1 when we adopt the averaged parameter. A new narrower interval like this is called a sub-subdivision. The lower/upper boundaries of a sub-subdivision are ##EQU5## from conditions, -g(q.sub.L.sup.+,(ma+j+1)/m)=g(q.sub.L.sup.+,(ma+j)/m) and -g(q.sub.U.sup.+,(ma+j)/m)=g(q.sub.U.sup.+, (ma+j-1)/m) respectively, where m=2.sup.l and m-1.gtoreq.j.gtoreq.0 for a=1,2,3, . . . ,D-1 when l=1. There is, however, an exception in that the upper boundary of S.sub.1 is D'(D-1). The left-most sub-subdivision (a=D and j=0) is bounded by [0,D'/(2mD-1)]. We shall abbreviate sub-subdivision as s-subdivision (l=1) and sub-sub-subdivision as 2s-subdivision (l=2), . . . , and a 2.sup.l -subdivided sub- . . . sub-subdivision as ls-subdivision. Thus, the domain [0,D'(D-1)] of q is divided into the following ls-subdivisions: ##EQU6## with the parameter (ma+j)/m=(2.sup.l a+j)/2.sup.l. The boundary q.sub.L.sup.+ (a,j,m) is depicted in FIG. 1 with points marked by M.sub.2m,2j+1.sup.a where m=1 and j=0 for a subdivision; m=2 and j=0,1 for a s-subdivision; and m=4 and j=0,1,2,3 for a 2s-subdivision.
Next, consider the mapped value of q computed from g(q,(ma+j)/m). By substituting eq. (3.2) into g(q,(ma+j)/m), we obtain the value of q as follows: ##EQU7## As eq. (3.4) shows, the value of q decreases as the value of m increases. The worst case of q.sub.f for a fixed value m is obtainable as ##EQU8## by setting a=D-1 and j=m-1 in eq. (3.4).
The recursive application of q.sub.i+1 =h(q.sub.i,(mat.sub.1 +j.sub.i)/m)=-g(q.sub.i,(ma.sub.i +j.sub.i +1)/m)D.sup.n by starting with the initial value q.sub.o in S.sub.(ma.sbsb.o.sub.+j.sbsb.o.sub.)/m assures the movement of successive mapping images of q.sub.o into the ls-subdivision S(.sub.mD-1)/m (when a=D-1 and j=m-1) or S.sub.D. As soon as the last contracting image q* is reached in S.sub.(mD-1)/m or S.sub.D, the smallest quantity q.sub.f is evaluated from q.sub.f =-g(q*,(mD-1)/m) or q.sub.f =q*, depending on whether it has been reached in S.sub.(mD-1)/m or S.sub.D, respectively,
We have been discussing the first benefit of the generalized method. The second benefit is described below. Consider the difference between two values of q computed from g(q,(2ma+2j+1)/2m) and g(q,(ma+j)/m). The difference is (D.sup.n +q)/2mD.sup.n+1, which can be seen in FIG. 1 as 1/(4a+3) indicated by a brace when m=2 and j=1 are used. From this, we may introduce a modified mapping function h.sub.m (q,a) where the suffix m denotes the modification: ##EQU9##
The mappings by h.sub.m (q,(ma+j)/m) for the cases m=2 and j=1, and m=2 and j=0 are indicated in FIG. 1 with the shaded triangles. The largest mapped values for each case occur at the points of M.sub.2,1.sup.A and M.sub.4,1.sup.A on the abscissa. Since h.sub.m (q,(ma+j)/m) is a piece-wise linear mapping, it is sufficient to consider only the largest possible mapped value of q that happens to be the upper boundary of each ls-subdivision obtained through eq. (3.2).
Next, we present that the number of recursive applications for the worst case is two. By taking the worst initial q.sub.o =q.sub.U.sup.+ (a,j,m), the q.sub.1 value is as follows; ##EQU10## where q.sub.o belongs in S.sub.(ma.sbsb.o.sub.+J.sbsb.o.sub.)/m initially. It is obvious that if a.sub.o =1 and j.sub.o =0, q.sub.1 is greater than the upper boundary (3D.sup.n /(2mD-3) obtained by substituting a=D-1 and j=m-1 in eq. (3.3)) of the ls-subdivision S.sub.(mD-1)/m. So another contraction mapping of h.sub.m (q.sub.1,(ma.sub.1 +j.sub.1)/m) is required to obtain a smaller value.
First, we must determine the corresponding a.sub.1 and j.sub.1 for the value q.sub.1 from following inequalities obtained from the ls-subdivision boundaries in eq. (3.3): (2m(D-a.sub.1)-2j.sub.1 -1)D.sup.n /(2ma.sub.1 +2j.sub.1 +1)<D.sup.n /(2ma.sub.o +2j.sub.o -1).ltoreq.(2m(D-a.sub.1)-2j.sub.1 +1)D.sup.n /(2ma.sub.1 +2j.sub.1 -1)
After a simple computation, we obtain
where R denotes an integer in the range R-1 < R .ltoreq.R, and R is a real number.
Next, by using the value q.sub.1 and by determining a.sub.1 and j.sub.1 from the inequalities, R-1< R .ltoreq.R, the interval bound of q.sub.2 is determined as follows: (1) When the inequality R .ltoreq.R is used, the upper bound of the interval range is
Since the last term of eq. (3.8) is positive, there is no need to have the difference term, (D.sup.n +q.sub.1)/2mD, in h.sub.m (q,a). Then, we compare the upper bound of q.sub.2 with the upper bound of S.sub.(mD-1)/m :
Eq. (3.9) results in a positive number, so q.sub.2 must belong in S.sub.(mD-1)/m since 4(ma.sub.o +j.sub.o)-3>0, 2mD-3>0, and (2ma.sub.o +2j.sub.o -1)>0 by taking the smallest values of a.sub.o =1, j.sub.o =0, m=1, and D=2, and no further mapping is needed. (2) When the inequality R-1< R is used, the lower bound of the interval range is found as follows: ##EQU11## Eq. (3.10) results in a negative value when the smallest values of a.sub.o, j.sub.o, m and D are taken. Therefore, this negative value is replaced by (D.sup.n +q.sub.1)/2mD=(ma.sub.o +j.sub.o)D.sup.n /(mD(2ma.sub.o +2j.sub.o -1)), which is the largest value in h.sub.m (q.sub.o,(ma.sub.o +j.sub.o)/m), namely M.sub.2m,2j.sup.a for m=2,4 and j=1,2 respectively, as shown in FIG. 1. It is sufficient to compare the largest value with the upper bound of S.sub.(mD-1)/m : ##EQU12## Eq. (3.11)is positive when the smallest values of a.sub.o, j.sub.o, m and D are taken. Thus, from these two cases we find the value of q.sub.2 is in S.sub.(mD-1)/m or S.sub.D. Then, the final value of q.sub.f is computed as follows: ##EQU13##
An example of the generalized process: Let A=1 be a dividend and B=54 a divisor in decimal. By taking the base radix D=8=10.sub.8 and n=1, the value of P is found to be 56.sub.8 as follows: B=D.sup.n +P=54.sub.10 66.sub.8. All computation in the example is carried out in octal with m=2 by using the s-subdivision shown in FIG. 2 a computed from eq. (3.3).
Step 1: Since B=10+56, q.sub.o =56. From FIG. 2 and the value q.sub.o /D.sup.n =56/10 5.6, we find a.sub.o =1 and j.sub.o =0 in the s-subdivision. Set i=0 and .alpha.=1.
Step 2: Since q.sub.0 is not in S.sub.(2D-1)/2 nor in S.sub.D, go to the next step. ##EQU14## Since q.sub.o (=56) is less than the root, 7.0, of the s-subdivision as shown in FIG. 2 (q.sub.1 -=g(q.sub.o,(ma.sub.o +j.sub.o)/m)<0), the quantity (D.sup.n+i +q.sub.i)/2mD is added to q.sub.1, namely the acceleration constant (2ma.sub.i +2j.sub.i +1)/2m is used in the q.sub.i+1 and .alpha.(=.alpha.(2ma.sub.o +2j.sub.o +1)/2m=1.times.(5/4)=5/4) computations. Increase the counter i by one, i=i+1=0+1=1.
Step 4: Now the value q.sub.1 /D.sup.n becomes q.sub.1 /D.sup.n =0.34/10=0.034. By searching the s-subdivisions in FIG. 2, we find that q.sub.1 is in the s-subdivision with a.sub.1 =D-1 and j.sub.1 =1. Since the quantity q.sub.1 is now in S.sub.(mD-1)/m, go to step 5. ##EQU15## Comparing the real quotient, 1/66.sub.8 =0.0113664, with the approximate reciprocal, we find the results accurate up to 9 or 17 digits when the terms of the power series are evaluated up to q.sub.f.sup.2 or q.sub.f.sup.4, respectively.
FIG. 1 illustrates the boundary of subdivisions S.sub.a+1.sup.1 and S.sub.a.sup.1 ; the intervals of s-subdivisions S.sub.a+1.sup.2, S.sub.(2a+1)/2.sup.2, and S.sub.a.sup.2 ; and the intervals of 2s-subdivisions S.sub.a+1.sup.4, S.sub.(4a+3)/4.sup.4, S.sub.(4a+2)/4.sup.4, S.sub.(4a+1)/4.sup.4, and S.sub.a.sup.4. The difference terms, 1/(2ma+2j+1), in h.sub.m (9,(ma +j)/m) are indicated by the brace with 1/(2a+1) at the lower boundary of subdivision S.sub.a.sup.1 (when m=1 and j=0) and by the braces with 1/(4a+3) and 1/(4a+1) at the lower boundaries of s-subdivisions S.sub.(2a+1)/2.sup.2 and S.sub.a.sup.2 (when m=2 and j=1,0) respectively. Two dark solid lines, one dark dotted line and three dark chained lines represent the functions of g(q,(ma+j)/m) in (a) the cases m=1 and j=0,1 for the dark solid lines, in (b) the case m=2 and j=1 for the dark dotted line, and in (c) the cases m=4 and j 1,2,3 for the dark chained lines, respectively.
FIG. 2 is the table of the s-subdivision computed from eqs. (3.3) and the roots of g(q,(ma+j)/m)=0 in each s-subdivision.
FIG. 3 shows the successive multiplication of acceleration constants to dividend and divisor. When the control unit 1, comprising sequential circuitry, has received a division start signal after storing dividend A and divisor B into the dividend/quotient register 25 and the divisor register 2, respectively, the control unit resets the pseudoradix register 6 with a predetermined pseudoradix D.sup.n. Each of these three registers and the q register 7 is structured in a row of associated flipflops. Then the control unit commands the negatation logic 5 to get -D.sup.n and starts the addition 3 to obtain q.sub.o. The resultant q.sub.o is stored in the q register 7. Next, the control unit initiates the determination logic of a.sub.i and j.sub.i, comprising combinational logic circuits and Read Only Memory (ROM) of a table, that provides a control signal, s(D-1<a.sub.i), s(D-1=a.sub.i, m-1=j.sub.i) or s((D-1>a.sub.i) or (D-1=a.sub.i, m-1>j.sub.i)) by comparing a.sub.i and j.sub.i with D-1 and m-1 respectively, and an acceleration constant ma.sub.i +j.sub.i and the root of g(q.sub.i, (ma.sub.i +j.sub. i)/m)=0 as the output from the input q.sub.i. At the same time, the control unit starts the process of making the quantity D.sup.n +q.sub.i that reaches the multiplication 15 through the OR logic 12. Subsequently, the control unit regulates the following operations.
If a signal s((D-1>a.sub.i) or (D-1=a.sub.i,m-1>j.sub.i)) is generated, then the signal is used to open the paths of the AND logic gates 18 and 20 for the acceleration constant and for one, respectively. The constant passing the gate is sent to the shift and OR operation 14 to make the quantity (2ma.sub.i +2j.sub.i +1)/2 which is the modified acceleration constant in h.sub.m (q.sub.i,(ma.sub.i +j.sub.i)/m). The comparison q.sub.i -q.sub.r until 11 generates the result whether the difference of q.sub.i -q.sub.r is positive or negative. If the negative value of the comparison occurs then the AND logic gate 13 is opened for the path of the modified acceleration constant, (2ma.sub.i +2j.sub.i +1)/2, to the multiplications 15 and 27. If the positive value results then the AND logic gate 16 is opened for the path of the acceleration constant, ma.sub.i +j.sub.i, to the multiplications 15 and 27. After the multiplication 15 of the acceleration constant to D.sup.n +q.sub.i is completed, the sequential process, (1) (ma.sub.i +j.sub.i)(D.sup.n +q.sub.i)/m or (2ma.sub.i +2j.sub.i +1)(d.sub.n +g.sub.i)/2m by the shift m bits operation 19, (2) -D.sup.n+1 +(ma.sub.i +j.sub.i)(D.sup.n +q.sub.i)/m or -D.sup.n+1 +(2ma.sub.i +2j.sub.i +1)(D.sup.n+q.sub.i)/2m by the addition 21, and (3) q.sub.i+1 =(-D.sup.n+1 +(ma.sub.i +j.sub.i) (D.sup.n +q.sub.i)/m)/D or (-D.sup.n+1 +(2ma.sub.i +2j.sub.i +1)(D.sup.n +q.sub.i)/2m)/D by the digit shift 23, is initiated. Then, the quantity q.sub.i+1 is stored back in the q register 7.
The acceleration constant passed the AND logic gate 13 or 16 is used in the multiplication 27 to form the quantity (ma.sub.i +j.sub.i)A' or (2ma.sub.i +2j.sub.i +1)A'/2 where A' denotes the content of the dividend/quotient register 25. Then, the shift m bits operation 29 is performed to produce the next content of the dividend/quotient register. After the present content of the pseudoradix register 6 is sent to the multiplication 15 through the OR logic gate 12, the digit shift operation 4 is applied to the content of the register 6 to get the next iteration value in it. A process forming the new contents of the pseudoradix register 6, the q register 7, and the dividend/quotient register 25 described above is one iteration of the successive multiplication of acceleration constants.
If a signal s(D-1=a.sub.i, m-1=j.sub.i) is generated by the determination logic of a.sub.i and j.sub.i, the logical AND gates 8, 22, and 24 are opened for passing the quantities D.sup.n +q.sub.i, n+1, and A', respectively. Then, the quantity D.sup.n +q.sub.i is used to make the quantity (mD-1)(D.sup.n +q.sub.i) by the digit shift 9 and the subtraction 10. This resultant becomes the value of q.sub.f after the shift m bits operation 19, the addition 21 of -D.sup.n+1, and the digit shift 23, namely q.sub.f =(-D.sup.n+1 +(mD-1)(D.sup.n +q.sub.i)/m)/D.sup.n+1, which is stored back in the q register. Also the multiplication (mD-1)A'/m is performed through the digit shift 26 producing mDA', the subtraction 28 making (mD-1)A', and the shift m bits operation 29 resulting (mD-1)A'/m. The result is stored back in the dividend/quotient register. After the completion of the two multiplications of (mD-1)/m, namely after the delaying at the delay unit 30, the control signal s(D-1=a.sub.i, m-1=j.sub.i) becomes the ending signal of the successive multiplication of acceleration constants.
When a signal s(D-1<a.sub.i) is generated by the determination logic of a.sub.i and j.sub.i, the contents of the q register and of the dividend/quotient register become the results of the successive multiplication of acceleration constants. So the signal is the termination signal of the successive multiplication through the OR logic 31. Typical structures of the functions of the determination logic of a.sub.i and j.sub.i, and of the evaluation process of the power series are similar to the ones described in the FIGS. 7 and 8 of the filed application Ser. No. 959,269, now U.S. Pat. No. 4,364,115.
While the above description contains many specificities, these should not be construed as limitations on the scope of the invention, but rather as an exemplification of one preferred embodiment thereof. Many other variations are possible, for example if a parallel process provides the remainder of A/B where A>B, then this process is useful in integer number division. The parallel process is successive applications of Horner's scheme on the polynomial form (. . . (A.sub.m P+A.sub.m-1)P+. . . +A.sub.1)P+A.sub.o where A.sub.i for i=0,1,2, . . . ,m are digits of A=(. . . (A.sub.m D'+A.sub.m-1)D'+. . . A.sub.1)D'+A.sub.o and P=D'-B, and the applications continue on the evaluated result of Horner's scheme again and again until the very last result becomes less than D'. Suppose A=10000.sub.8 in the example where P=12.sub.8 and D'=D.sup.2 =100.sub.8. A computation is shown here. The first and second applications of Horner' s scheme result in (1.times.P+00).times.P+00=(1.times.12).times.12=144 and 1.times.12+44=56. Then the last result 56 is less than 100 and is less than B=66. So the remainder is 56.sub.8 =46.sub.10. When the last value is greater than B, the difference between the last value and the divisor (or a multiple of the divisor) becomes the remainder if P is less than B. If P is greater than B, a smaller P may be chosen by taking the difference between P and B. Accordingly, the scope of the invention should be determined not by the embodiment illustrated, but by the appended claims and their legal equivalents.