Abstract:
A fast divider is disclosed in the present invention. It utilizes a division method which uses a smaller quotient digit set of {-1, 1} than {-1, 0, 1} that used by known algorithms, therefore accelerates the speed of calculation. Partial remainders are computed with the signs of remainders decided independently and in parallel. By taking the absolute values of the remainders, the remainders are successively subtracted without the need of knowing the signs of remainders, while signs of the remainders can be decided in parallel and independently at the same time. The method adopts non-restoring division operation and CSA (carry save adder) type of operation for fast subtraction. The method is also an on-line algorithm that facilitates highly pipelined operations while it is much simpler than the existing on-line algorithms.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to an apparatus for finding a quotient, especially to an apparatus for finding a quotient in a digital system. 
     Inherently, division operation is a sequential operation. The quotient digits are produced only after the sign of the remainder has been detected. As a result, division operation is much slower than a multiplication operation. Efforts have been put in speeding up the division operation. It is noted that the SRT algorithm (C. V. Freiman, &#34;Statistical Analysis of Certain Binary division algorithms,&#34; Proc. IRE, Vol. 49, Jan. 1961, pp. 91-103; K. Hwang, Computer Arithmetic: Principles, Architectures, and Design, 1979, pp. 222-223) eliminates the restoring operations of the partial remainders. Another algorithm disclosed by K. Hwang confines the quotient digits either to be 1 or -1, depending on the signs of remainders. However, the bottleneck of those algorithms lies in sign detection of the remainder. Fast addition algorithms such as CLA (carry-lookahead addition) shorten the operation time, but results in complex hardware structures. 
     Recently, division algorithms based on SD (signed-digit) number representation was proposed which is much faster than the previous algorithm (S. Kuninobu et al., &#34;Design of High Speed MOS Multiplier and Divider Using Redundant Binary Representation,&#34; IEEE Proceeding of Symposium on Computer Arithmetic, 1987, pp. 80-86). This algorithm considerably shortens the time for remainder subtraction by using carry-propagation-free SD addition. However, it is much more complex because in each iteration the SD algorithm must check three most significant digit (MSD) bits of the remainder to decide the quotient digit in the set of {-1, 0, 1}, and then perform the SD addition. Moreover, the final SD result must be converted to binary representation. Also note that the signed-digit addition is more complicated than the conventional carry-save adder (CSA). 
     Another type of algorithm entirely avoids the slow subtract-detect-shift type of operation previously mentioned. They transform the division operation to a series of multiplication operations that converge to the original quotient. Among the examples are the constant convergence (S. Waser and M. J. Flynn, Introduction to Arithmetic for Digital Systems Designers, New York: CBS College Publishing, Chap. 5, 1982) and quadratic convergence (P. Markenstein, &#34;Computation of Elementary Functions on the IBM RISC System/6000 Processor,&#34; IBM Journal of Research and Development, Vol. 34, 1990, pp. 111-119; D. A. Patterson and J. L. Hennessy, Computer: A Quantitative Approach, San Mateo, Calif., Morgan Kaufman, 1990) division algorithms which are based on Newton-Raphson algorithm. They are often found in multiplier-based processors. They are still sequential type of operation to certain degree, and obviously require much more shift-and-add operations. 
     There is an on-line division algorithm that facilitates serial/serial division operation (K. S. Trivedi and M. D. Ercegovac, &#34;On-Line Algorithms for Division and Multiplication,&#34; IEEE Trans. on Computers, Vol. C-26, No. 7, July 1977). This algorithm has advantages such as that: (a) it is pipelined at digit level; (b) all operands and results are communicated digit serially, and (c) result digits are on-line obtained after a few initial delay. On the other hand, among some of its disadvantages are: (a) it requires more complex three-input signed-digit addition operation; (b) it needs more complicated quotient decision circuit for range detection of the remainder, and (c) output results have to be converted to binary representations. 
     SUMMARY OF THE INVENTION 
     In this work, a fast radix-2 division algorithm and its architecture is proposed. The algorithm adheres to the shift/subtract-and-add type of division operation because it uses less iteration steps than those utilizing multiplicative approaches. The key idea behind this algorithm is to separate the sign detection operation of remainder from the remainder subtraction operation. By taking the absolute values of the remainders, we can successively subtract the remainders without the need of knowing the signs of remainders, while signs of the remainders can be decided in parallel and independently at the same time. To enhance the algorithm&#39;s performance, several design techniques were incorporated into its architectural realization. 
     The new algorithm and its architecture try to retain most advantages of the aforementioned algorithms as possible, and simultaneously eliminate their disadvantages. The algorithm adopts non-restoring division operation and CSA type of operation for fast subtraction. Quotient digit set of {1, -1} is assumed for fast quotient conversion to binary representation. The algorithm is also an on-line algorithm that facilitates highly pipelined operation while it is much simpler than the existing on-line algorithms. 
     This object of the present invention are fulfilled by providing a digital device for finding a quotient from a divisor and a dividend. The digital device comprises a plurality of operators, each coupled in sequence, each of the operators receiving one digit of the divisor and one digit of the dividend and performing signed-digit subtraction, then outputting the result of the partial remainder of the subtraction, a plurality of negating circuits for taking the absolute value of the partial remainder, each coupled in the same sequence with the operators and coupled with the corresponding operator, each of the negating circuits receiving one digit of the result of the partial remainder of the subtraction from the corresponding operator and a flag from the preceding negating circuit, and negating the sign of the digit received from the corresponding operator when the flag received from the preceding negating circuit is negative, and when the flag received from the preceding negating circuit is zero and the digit received from the corresponding operator is negative, or keeping the sign of the digit received from the corresponding operator when the flag received from the preceding negating circuit is positive, or when the flag received from the preceding negating circuit is zero and the digit received from the corresponding operator is positive or zero, then outputting the digit to the preceding operator of the corresponding operator for next iteration, or outputting a positive flag when the flag received from the preceding negating circuit is positive or when the flag received from the preceding negating circuit is zero and the digit received from the corresponding operator is positive, and outputting a negative flag when the flag received from the preceding negating circuit is negative and when the flag received from the preceding negating circuit is zero and the digit received from the corresponding operator is negative, and outputting a zero flag when the flag received from the preceding negating circuit is zero and the digit received from the corresponding operator is zero, a quotient decision circuit, receiving the flag outputted by the negating circuit at the end of sequence, and performing exclusive-OR operation with the last flag outputted by the negating circuit at the end of sequence, then negating and outputting the result of the exclusive-OR operation as one of the digit of the quotient, and a plurality of shift registers interposed between each of said circuits, for adjusting circuit timing. 
     Further scope of applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description. 
    
    
     BRIEF DESCRIPTION OF THE FIGURES 
     The present invention will become more fully understood from the detailed description given hereinafter and the accompanying drawings which are given by way of illustration only, and thus are not limitative of the present invention and wherein: 
     FIG. 1 is a schematic block diagram showing a divider according to the present invention; 
     FIG. 2a is a schematic block diagram showing a full-adder; 
     FIG. 2b is a schematic circuit diagram showing an embodiment of a half-adder HA1 shown in FIG. 2a; 
     FIG. 2c is a schematic circuit diagram showing an embodiment of a half-adder HA2 shown in FIG. 2a; 
     FIG. 3a is a schematic block diagram showing a negating circuit; 
     FIG. 3b is a schematic circuit diagram showing an embodiment of the negating circuit shown in FIG. 3a; 
     FIG. 4a is a schematic block diagram showing a quotient decision circuit; and 
     FIG. 4b is a schematic circuit diagram showing an embodiment of the quotient decision circuit shown in FIG. 3a. 
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
     For achieving fast division, a new division algorithm is discussed hereinafter. 
     NEW DIVISION ALGORITHM 
     Given normalized n-bit signed-magnitude operands 1/2≦|X|&lt;1, 1/2≦|Y|&lt;1, quotient Q 2  of Y/X can be solved using the following principles, where the quotient digits Q 2  =a s  a 0  ·a 1  a 2  . . . a n  is in sign-magnitude representation and a s  is the sign bit. 
     Principle 1 
     a s  equals to the result of exclusive-OR of the sign bits y s  and x s  of Y and X, respectively, i. e., a s  =y s  ⊕x s . 
     Principle 2 
     Partial remainder R i+1  can be solved by modifying the conventional, nonrestoring algorithm stated by K. Hwang as follows. The signed-binary quotient Q has its quotient digit q i  ε{1, -1}, and 
     
         R.sub.i+1 =2|R.sub.i -q.sub.i+1 &#39;X|      (1) 
    
     where R 0  =|Y|, q 0  =1, q i  &#39; is the i-th pseudo quotient digit. Since R i+1  is always positive, Eq. (1) can be rewritten as ##EQU1## where S.sub.Γi =The sign of remainder (R i  -X), 
     S i  =True sign of i-th remainder of S i-1  ⊕S.sub.Γi , 
     Z i  =Zero Flag, Z 0  =0, and 
     S 0  =S.sub.Γ0 =Sign{R 0  }=0. 
     The algorithm can be performed using the method described below. 
     NEW DIVISION METHOD 
     Define signed-magnitude numbers Y s  =y s  ·y 1  y 2  . . . y n , X s  =x s  ·x 1  x 2  . . . x s , and Q s  =q s  q 0  ·q 1  q 2  . . . q b  in the signed-binary representation, i. e. q i  ε{1, -1}, and the sign-magnitude representation of Q 2  =a s  a 0  ·a 1  a 2  . . . a b , a i  ε{0, 1}. The quotient Q 2  of X s  /Y s  can be solved by the following steps: 
     Step 1 
     a s  =y s  ⊕x s . 
     Step 2 
     Define Y=y 1  y 2  . . . y n , X=x 1  x 2  . . . x s , Q=a 0  a 1  a 2  . . . a b , R 0  =Y, i=0, and S 0  =0. 
     Step 3 
     Align the first non-zero bit of X with the first non-zero digit of R 0 . 
     Step 4 
     Subtract X from R i  and yield next signed-digit partial remainder R i+1 . Set the sign of R i+1  to S.sub.Γi+1 (note that the sign of R i+1  equals the sign of first non-zero digit of R i+1 ). Set the result of S i  ⊕S.sub.Γi+1 to the true sign of the next remainder S i+1 , i. e. S i+1  =S i  ⊕S.sub.Γi+1. Set a i  to 1 if S i+1  =0 (means the remainder is positive) or R i+1  =0. Set a i  to 0 if S i+1  =1 (means the remainder is negative). 
     Step 5 
     If S i+1  =1, then take the absolute value of R i+1  (by negating the signs of all digits). Shift R i+1  left by one bit. Add 1 to i. Repeat step 4 until i reaches a predetermined value or R i+1  =0. 
     For better comprehension, two examples are used to demonstrate the division method hereinafter: 
     EXAMPLE 1 ##STR1## 
     EXAMPLE 2 
     In this example, note that a digit with a bar means a digit having negative value, e.g. ##STR2## 
     Since absolute values of the partial remainders are computed instead of their actual values, the algorithm facilitates parallel computations of partial remainder and quotient digit. To further speed up the operation of subtraction in the preferred embodiment, we use modified signed-digit operation which will be briefly discussed hereinafter. 
     MODIFIED SIGNED-DIGIT SUBTRACTION 
     Since computations of Eq. (2) involves only the subtraction operation of two positive numbers, R i  and X, we can speed up the computation by defining the CSA-like operation as follows. 
     
         y.sub.j -x.sub.j =2c.sub.j+1 +t.sub.j                      (5.a) 
    
     
         t.sub.j +c.sub.j =s.sub.j                                  (5.b) 
    
     wherein 
     y j , s j  ε{-1, 0, 1} 
     x j , t j  ε{0, 1} 
     c j  ε{-1, 0}. 
     Here, a signed-digit bit y j  (represents the j-th digit of R i ) subtracts a binary digit x j , then generates carry c j+1  and intermediate result t j . The finial result s j  (represents the j-th digit of R i+1 , before taking absolute value) is obtained by adding t j  and the carry-in bit c j . Since s j  {-1, 0, 1}, there will be no carry generated from t j  +c j . As a result, the modified signed-digit subtraction efficiently eliminates carry propagation. In addition, the complexity of this operation is similar to that of conventional CSA. Example 3 depicts the modified subtraction method where T i  =t 1  t 2  . . . t n  and C i  =c 1  c 2  . . . c n . 
     EXAMPLE 3 ##STR3## 
     As shown in the above example, T i  and C i  are calculated first, then R i  can be easily decided. The truth table of t j  and c j+1  value are listed in table 1 where the signed-digit r j  of R i  is represented by two bits, r j   1  and r j   2 . r j   1  =sign{r j  }·r j   2  =|r j  |. 
     
                       TABLE 1______________________________________TRUTH TABLE OF t.sub.j AND c.sub.j+1x.sub.j    r.sub.j .sup.1            r.sub.j .sup.2                        c.sub.j+1                             t.sub.j______________________________________0          0     0           0    00          0     1           0    10          1     1           1    11          0     0           1    11          0     1           0    01          1     1           1    0______________________________________ Note that r.sub.j represents jth digit of R.sub.i here. 
    
     The truth table of s j  (represents the j-th digit of R i+1 , before taking absolute) is listed in table 2. 
     
                       TABLE 2______________________________________TRUTH TABLE OF s.sub.jc.sub.j  t.sub.j        s.sub.j .sup.1                         s.sub.j .sup.2______________________________________0        0              0     00        1              0     11        0              1     11        1              0     0______________________________________ 
    
     From the above tables we can see that the signed-digit subtraction can be achieved by a simple digital circuit, and can be pipe-lined for better performance. 
     CONCLUSION 
     In summary, the division algorithm have the advantages as follows: 
     a) It uses a smaller quotient digit set of {1, -1} than {-1, 0, 1}, that simplifies that quotient decision circuits like some known algorithms do, but achieves the exact division and trivial conversion of the results from signed-binary representation to binary representation. 
     b) It needs no quotient estimator. 
     c) In each iteration, the algorithm computes partial remainders without knowing the signs of previous remainders and decides the signs of remainders independently and in parallel. In addition, these two operations are done in pipelined fashion and in digit level with maximum throughput rate. 
     d) Its architecture is basically consists of the simple CSA type cells. 
     e) It can handle either positive or negative operands. 
     From above discussion, the proposed division algorithm is very efficient. The new algorithm&#39;s realization is demonstrated hereinbelow, by two preferred embodiments of the present invention. 
     RADIX-2 BIT-SERIAL DIVIDER 
     FIG. 1 shows the structure of an n-bit radix-2 bit-serial divider 1 according to the present invention. Divider 1 includes n+1 operators 10, n+1 negating circuits 20, a quotient decision circuit 30, and a plurality of shift registers D. Shift registers D are used for adjusting the timing of the entire circuit. It should be noted that this circuit can be easily modified, by one who skilled in the art, to perform division operation on other bit numbers. 
     Operator 10 is used to subtract the dividend X from the divisor Y or the partial remainders of Y, then output the partial remainder of the subtraction. Each operator 10 has a first input 12 and a second input 14, for respectively receiving one bit of the divisor Y and the dividend X in sequence, from the most significant bits y MSB  and x MSB , to the least significant bits y LSB  and x LSB . Each bit y i  of Y is loaded to the corresponding first input 12, and each bit x i  of X is loaded to the corresponding second input 14. Each operator 10 has a third input 19, a first output 16 and a second output 18. Each first output 16 is connected to the third input 19 of the preceding operator 10 in sequence. Each operator 10 subtracts one bit x i  of the dividend X, which is inputted from the second input 14, from one bit y i  and yields one bit s i  of the result. It should be noted that of the divisor Y, which is inputted from the first input 12, y i  and s i  are all signed-digits, where y i  is represented by two bits y i   1  and y i   2 , and s i  is represented by two bits, s i   1  and s i   2 . Although it is not shown in FIG. 1, y i  and s i  are both transferred by two wires in the circuit. In the present embodiment, signed-digits -1, 0, 1 are represented by 11, 00, 01, respectively. 
     Please refer to FIGS. 2a, 2b, and 2c. FIG. 2a shows the block diagram of the preferred embodiment of the operator 10. Three bits x i , y i   1  and y i   2  (representing x i  and y i ) are sent to a half-adder HA1. The half-adder HA1 performs the calculation of Eq. 5.a, then outputs the carry-in bit c i+1  and the intermediate result t i . After passing through shift register D, t i  is sent into another half-adder HA2 together register D, t i  is sent into another half-adder HA2 together with the carry-in bit c i  (from the half-adder HA1 of another operator 10 on the right side). Half-adder HA2 performs the calculation of Eq. 5.b, then outputs the finial result s i  with two bits s i   1  and s i   2 . The preferred embodiments of the half-adders HA1 and HA2 are shown in FIGS. 2b and 2c respectively. The truth table of the half-adder HA1 is the same as Table 1. The truth table of the half-adder HA2 is the same as Table 2. 
     The negating circuit 20 is used to take the absolute value of the partial remainder s i , that is, in signed-digit operation, to decide whether the signs of the digits of the partial remainder outputted by the operator 10 should be negated or not. The negating circuits 20 find out the first non-zero digit of s i , and check its sign. If it is positive, then s i  will pass the negating circuits 20 without changing. If it is negative, then the signs of all non-zero digits of s i  will be negated. 
     As shown in FIG. 3a, the k-th negating circuits 20 has a first input 21 for receiving one digit s i  of the final result from one of the operator 10, a first output 23 for outputting one digit r i  of the partial remainder, a second input 22 for receiving a flag digit f i  (k) from another preceding negating circuit 20, and a second output 24 for outputting a flag digit f i  (k+1). It should be noted that s i , r i , f i  (k), and f i  (k+1) are all signed digits, where s i  is represented by s i   1  and s i   2 , r i  is represented by r i   1  and r i   2 , f i  (k) is represented by f i   1  (k) and f i   2  (k), f i  (k+1) is represented by f i   1  (k+1) and f i   2  (k+1). A preferred embodiment of the negating circuit 20 is illustrated in FIG. 3b. 
     Referring to FIG. 1, the second input 22 of each negating circuit 20 is coupled to the second output 24 of the preceding negating circuit 20 through a shift register D in sequence. The first input 21 of each negating circuit 20 is coupled to the corresponding operator 10 through a shift register D. The first output 23 of each negating circuit 20 is coupled to the first input 12 of the preceding operator through a shift register D. The truth table of the negating circuit 20 is listed in table 3. 
     
                       TABLE 3______________________________________TRUTH TABLE OF f.sub.i (k + 1)f.sub.i .sup.2 (k)f.sub.i .sup.1 (k)        s.sub.i .sup.2              s.sub.i .sup.1                   f.sub.i .sup.2 (k + 1)                            f.sub.i .sup.1 (k + 1)                                     r.sub.i .sup.2                                         r.sub.i .sup.1______________________________________0    0       0     0    0        0        0   00    0       0     1    0        1        0   10    0       1     1    1        1        0   10    1       0     0    0        1        0   00    1       0     1    0        1        0   10    1       1     1    0        1        1   11    1       0     0    1        1        0   01    1       0     1    1        1        1   11    1       1     1    1        1        0   1______________________________________ 
    
     As shown in FIG. 1 and FIG. 4, the quotient decision circuit 30 has a first input 31 coupled to the n-th negating circuit 20 for receiving the flag digit f i  (n+1) from the n-th negating circuit 20 (only f i   2  (n+1) is needed to decide the quotient digit), and a quotient digit output 32 for outputting computed quotient digit a i . The quotient decision circuit 30 decides the quotient digit a i  by executing Eq. 3  and Eq. 4, that is, to take the exclusive-OR value of sign{f i  (n+1)} and sign{f i-1  (n+1)}, e.g. f i   2  (n+1)⊕f i-1   2  (n+1), then negate it, using a exclusive-OR (EOR) gate 33 and a NOT gate 34. 
     If the first operator 10 outputs an intermediate result s i  =1 (e.g. 01) which means the remainder is positive, then the first negating circuit 20 coupled to the first operator 10 receives it and outputs a positive flag f i  (1) (e.g. 01), and transmits it to the quotient decision circuit 30. Each of other operators 10 and negating circuits 30 performs the same operation, and outputs the finial result r i  =s i  to the preceding operator 10 for next iteration. 
     If the first operator 10 outputs an intermediate result s i  =-1 (e.g. 11) which means the remainder is negative, then the first negating circuit 20 coupled to the first operator 10 receives it and outputs a negative flag f i  (1) (e.g. 11), and transmits it to the quotient decision circuit 30. Each of other operators 10 and negating circuits 30 performs the same operation, and inverses the sign of the intermediate result s i , then outputs the finial result r i  =-s i  to the preceding operator 10 for next iteration. 
     If the first operator 10 outputs an intermediate result s i  =0 (e.g. 00), then the first negating circuit 20 coupled to the first operator 10 receives it and outputs a zero flag f i  (1) (e.g. 00), and the sign of the remainder is still not determined. Each of other operators 10 and negating circuits 30 performs the same operation, until there is a non-zero intermediate result s i , then decides the sign of the remainder and whether the sign of the intermediate result should be negated, and finally outputs the finial result r i  to the preceding operator 10 for next iteration. 
     When f i  (n+1) and f i+1  (n+1) are both positive or negative, then the quotient decision circuit 30 outputs a quotient digit a i  =1. When f i  (n+1) is positive and f i+1  (n+1) is negative, or f i  (n+1) is negative and f i+1  (n+1) is positive, then the quotient decision circuit 30 outputs a quotient digit a i  =0. If all remainder digits are zero, e.g. there is exact division, then the quotient decision circuit 30 outputs a quotient digit a i  =1. After n times iteration, a n-digit quotient can be determined. More quotient digits can be determined if more iteration is performed. 
     The algorithm and architecture can be extended to higher radix divisions such as radix-4 division. Since the remainders are taken absolute values, the digit set contains only digits 1 and 2 is sufficient for the entire radix-4 operation. This greatly reduces the number of search regions for the quotient digits, in contrast to the bigger set of {0, 1, 2, 3} that existing algorithms allow. 
     While the invention has been described by way of an example and in terms of several preferred embodiments, it is to be understood that the invention need not be limited to the disclosed embodiment. On the contrary, it is intended to cover various modifications and similar arrangements included within the spirit and scope of the appended claims, the scope of which should be accorded the broadest interpretation so as to encompass all such modifications and similar structures.