Abstract:
A system of and method for extended Booth encoding of two binary numbers, K and L. A stage of the encoder receives K[2n+1], K[2n], L[2n+1], and C[n−1], N−1≧n≧0, with N being the length of L, and it being assumed L[2n]=0, and forms C[n], S[n], M 1 [n], and M 2 [n] according to the following equations: C[n]=K[2n+1]|L[2n+1], S[n]=K[2n+1]{circumflex over ( )}L[2n+1], M 1 [n]=K[2n]{circumflex over ( )}C[n−1], M 2 [n]=(S[n]&amp;/K[2n]&amp;/C[n−1])|(/S[n]&amp;K[2n]&amp;C[n−1]), where | refers to the logical OR function, {circumflex over ( )} to the exclusive OR function, &amp; to the logical AND function, and/to the logical inversion function. Numerous applications are discussed such as using the extended Booth encoded numbers to perform arithmetic computations of the form Z=(±X±Y)*±W.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates generally to Booth encoding, and more specifically, to efficiently performing computations through extended Booth encoding of the operands thereto. 
     2. Background 
     Many Digital Signal Processor (“DSP”) applications involve or require multiplying the sum or difference of two or more signed (two&#39;s-complement) binary numbers, (X±Y), by a third signed binary number, W, resulting in Z=W*(X±Y). In a symmetric finite impulse response (FIR) filter, for example, the separate multiplication of two samples, s i  and s j , by the same coefficient, c k , can be replaced by the computation c k *(s i +s j ), resulting in the savings of a multiplier. Similarly, in a multiplication of two complex numbers, each of the real and imaginary components of the product can be determined through three computations of the form C*(A+B), resulting in the saving of a multiplier. Each of these examples requires an addition before the multiplication. 
     In current practice, two numbers must be added in a carry-propagate adder before the multiplication can be efficiently performed. Carry-save adders are commonly used to sum multiple input vectors (K 0 +K 1 + . . . +Kn) to produce sum and carry vectors, S and C. In current practice, S and C must be added in a carry propagate adder before the product, Z=W*(K 0 +K 1 + . . . +Kn) can be efficiently produced. 
     Unfortunately, the carry-propagate adder required by these computations imposes a tradeoff between size and speed. A ripple carry adder, for example, is small but slow. In contrast, a carry-look-ahead adder, while fast, is large. No conventional adder is available which combines the size advantage of the ripple carry adder with the speed advantage of the carry lookahead adder. 
     Consequently, there is a need for a system for and method of performing the computation Z=W*(X±Y) which is not subject to the foregoing tradeoff between size and speed. 
     There is further a need for a system for and a method of performing such computations which overcomes one or more disadvantages of the prior art. 
     The objects and advantages of the subject invention include fulfillment of any of the foregoing needs, singly or in combination. 
     Additional objects and advantages will be set forth in the description which follows or will be apparent to those of skill in the art. 
     SUMMARY OF THE INVENTION 
     To achieve one or more of the foregoing objects, and in accordance with the invention as broadly described herein, there is provided, in a first embodiment of the subject invention, a system of and method for performing extended Booth encoding of two signed binary numbers, K and L. In one implementation, the extended Booth encoder converts the sum K[2n+1:2n]+L[2n+1], where L[2n]=0, into the Booth triplet M 2 [n], M 1 [n], and S[n]. In one application, this triplet can then combined with a third signed binary number W to form the partial-product vectors PP[n] which are summed to produce Z=(K+L)*W in the same manner that the triplet produced by a standard Booth encoder is used combine partial products. 
     A second embodiment of the subject invention comprises a system for and a method of multiplying the sum or difference of two signed binary numbers, X and Y, by a third signed binary number W. 
     In this embodiment, an extended Booth encoder is included for encoding the sum of the operands X and Y to form encoded data. Partial products circuitry, identical to that used with standard modified Booth encoding, is also included for forming, responsive to the encoded data, a plurality of partial products, PP. The partial products, PP, are then added or subtracted, again responsive to the encoded data, together to form Z. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a truth table for the extended Booth encoder. 
     FIG. 2 illustrates one implementation of the extended Booth encoder. 
     FIG. 3 illustrates one implementation of a reformatter. 
     FIG. 4 a  is a block diagram of a system for performing an arithmetic computation of the form Z=(K+L)*W, where L[2n]=0. 
     FIG. 4 b  is a block diagram of a system for performing an arithmetic computation of the form Z=(X+Y)*W. 
     FIG. 4 c  is a block diagram of a system for performing an arithmetic computation of the form Z=(±X±Y)*±W. 
     FIG. 5 is a flowchart depicting one embodiment of a method in accordance with the subject invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     I. Background: The Classical Booth Encoder 
     In computing the product Z=X*W, the classical Booth encoder converts the binary-weighted bit-pair X[2n+1:2n] into the Booth triplet M 2 [n], M 1 [n], and S[n]. This triplet is then combined with W to form the partial-product vector PP[n] according to the following rules: When M 1 [n]=1, PP[n] is set to 1*W*(4**n); when M 2 [n]=1, PP[n] is set to 2*W*(4**n); and when both M 1 [n] and M 2 [n] are zero, PP[n] is set to 0. (In any Booth encoded implementation, M 1 [n] and M 2 [n] cannot be 1 at the same time.) Each partial product PP[n], N−1&lt;=n&lt;=0, is then added to or subtracted from Z, responsive to S[n], using the following rules: when S[n]=0, PP[n] is added to Z, and when S[n]=1, PP[n] is subtracted from Z. 
     In one implementation example, the partial products are added or subtracted together using a carry-save adder, such as a Wallace tree, followed by a carry-propagate adder. In this implementation example, a carry-save adder sums all the partial products to produce sum and carry output vectors, S and C. The carry-propagate adder then adds S and C to produce the final output, Z. 
     II. The Extended Booth Encoder 
     A system  10  for computing Z=(K+L)*W is illustrated in FIG. 4 a . As illustrated, the system comprises extended Booth encoder  11  and partial products circuitry  12 . 
     In computing the product Z=(K+L)*W, the extended Booth encoder  11  converts the sum K[2n+1:2n]+L[2n+1], where L[2n]=0, into the Booth triplet M 2 [n], M 1 [n], and S[n]. In the partial products circuitry  12 , these triplets can then combined with W to form the partial-product vectors PP[n], which are summed to produce Z=(K+L)*W in the same manner that the triplets produced by a standard Booth encoder produces Z=X*W. 
     FIG. 1 gives the truth table for the extended Booth encoder. The outputs of this truth table satisfy the requirements of a classical Booth code as the sum of the binary-weighted inputs equals the Booth-coded sum of the outputs and M 1  and M 2  are never 1 at the same time (that is, for the same set of inputs). C[n] is used to encode the next triplet, K[2n+3:2n+2]+L[2n+2], but is not used directly in forming the partial products for the multiplier. It can be seen from FIG. 1 that C[−1], i.e., C[n−1] when n=0, functions as a “carry” into the encoder: if C[−1]=1, then (K+L+1) is Booth encoded. If no carry input is needed, C[−1] is set to 0. 
     The truth table of FIG. 1 can be represented by, among others, the following equations: 
     
       
           C[n]=K [2 n +1 ]|L [2 n +1]  (Equation 1a) 
       
     
     
       
           S[n]=K [2 n +1 ]{circumflex over ( )}L [2 n +1]  (Equation 1b) 
       
     
     
       
           M   1 [ n]=K [2 n]{circumflex over ( )}C[n −1]  (Equation 1c) 
       
     
     
       
           M   2 [ n ]=( S[n ]&amp;/ K [2 n ]&amp;/ C[n −1])|(/ S[n ]&amp; K [2 n ]&amp; C[n −1])  (Equation 1d) 
       
     
     where | refers to the logical OR function, {circumflex over ( )} to the exclusive OR function, &amp; to the logical AND function, and/to the inversion function. 
     FIG. 2 shows one implementation of the extended Booth encoder in logic elements suitable for use in hardware circuits. In this figure, element  1  is a logical OR gate, element  2  is an exclusive OR gate, element  3  is a logical AND gate, elements  4   a  and  4   b  are logical NOR gates, and element  5  is a multiplexor which outputs A 0  when S=0, and outputs A 1  when S=1. It should be appreciated, however, that other implementations are possible in which the function of the Booth encoder is implemented in software executable by a processor. The software may be stored on a computer readable medium accessible by a processor. 
     The value of S[n] when M 1 [n]=0 and M 2 [n]=0 does not matter from an arithmetic standpoint as +0=−0. The equation for S[n] shown above yields the simplest logic implementation; however, other equations for S[n] may be employed to achieve different objectives. For example, power might be saved in some multiplier implementations if S[n] for M 1 [n]=0 and M 2 [n]=0 always has the same value, either 1 or 0. 
     Note that, if L[2n+1] is set to 0, Equations 1a-1d become: 
     
       
           C[n]=K [2 n +1]  (Equation 2a) 
       
     
     
       
           S[n]=K [2 n +1]  (Equation 2b) 
       
     
     
       
           M   1 [ n]=K [2 n]{circumflex over ( )}C[n −1]  (Equation 2c) 
       
     
     
       
           M   2 [ n ]=( S[n ]&amp;/ K [2 n ]&amp;/ C[n −1])|(/ S[n ]&amp; K [2 n ]&amp; C[n −1])  (Equation 2d) 
       
     
     These are the equations for a standard Booth encoder. This means that, if L[2n+1]=0, the pair K[2n+1:2n] can be encoded using a standard Booth encoder or an extended Booth encoder with L[2n+1] set to 0. 
     There are three restrictions on K implicit in this discussion: 1) K is a signed, two&#39;s-complement number; 2) the length of K is even so that the bits of K can be extended Booth encoded in pairs; and, 3) K is at least as long as L. The first restriction can be removed by appending a 0 to the most-significant end of K to make K an unsigned number. The second and third restrictions can be removed by sign extending K until its length is even and it is longer than L. One skilled in logic design will realize that these limitations can also be overcome by generating special truth tables and logic equations similar to FIG.  1  and Equations 1a-1d for the top bits of K and L. This effort usually does not generate any significant savings in logic or complication compared to the extensions to K proposed above. 
     III. Example Applications for Extended Booth Encoder 
     A system  14  for performing the general computation Z=(X+Y)*W is illustrated in FIG. 4 b . As illustrated, the system comprises reformatter  13 , extended Booth encoder  11 , and partial products circuitry  12 . 
     In order to perform the operation Z=W*(X+Y), inputs X and Y must be converted into K and L so that X[N−1:0]+Y[N−1:0]=K[N:0]+L[N−1:0], and L[2n]=0. One way to do this is to use reformatter  13  which, in one implementation, functions as follows: First, if N is even, sign-extend X and Y by one bit so that N is odd: this will make the length of K even after it is extended one bit during the addition shown below. 
     Second, add X to Y in the adder comprising multiple half adders and full-adders arranged into two-bit-long ripple-carry adders as follows: For n=0, use the one-bit-long half-adder: 
     U 0 : Half-Adder 
     (A←X[0], 
     B←Y[0], 
     SUM→K[0], 
     C out →K[1] 
     ); 
     or, if a carry input is desirable, use a full-adder: 
     U 0 : Full-Adder 
     (A←X[0], 
     B←Y[0], 
     C←Cin, 
     SUM→K[0], 
     C out →K[1] 
     ); 
     For (N−1)/2&gt;=n&gt;=1, use the two-bit-long ripple-carry adder: 
     U 1 : Half-Adder 
     (A←X[2n−1], 
     B←Y[2n−1], 
     SUM→L[2n−1], 
     C out →Tmp[2n] 
     ); 
     U 2 : Full-Adder 
     (A←X[2n], 
     B←Y[2n], 
     CIN←Tmp[2n], 
     SUM→K[2n], 
     C out →K[2n+1] 
     ); 
     The logic equations for the half-adder are well known to anyone skilled in logic design. They are: 
     SUM[i]=X[i]{circumflex over ( )}Y[i], and 
     CARRY[i]=X[i]&amp; Y[i]. 
     The logic equations for the full-adder are also well known to anyone skilled in logic design. They are: 
     SUM[i]=X[i]{circumflex over ( )}Y[i]{circumflex over ( )}Cin[i], and 
     CARRY[i]=(X[i]&amp;Y[i])|(X[i]&amp;Cin[i])|(Y[i]&amp;Cin[i]). 
     Examples of hardware implementations for the reformatter are shown in FIG.  3 . FIG. 3 a   1  illustrates the case in which n=0, and there is no carry in. FIG. 3 a   2  illustrates the case in which n=0, and there is a carry in. FIG. 3 a   3  illustrates the case in which n&gt;0. In each of these cases, the elements  6   a ,  6   b  are half adders with no carry in bit, while elements  7   a ,  7   b  are full adders with a carry in bit. 
     When this has been accomplished, in extended Booth encoder  11 , K+L is encoded using the extended Booth encoder and the resultant Booth triplets, S, M 2 , and M 1 , are processed in partial products circuitry  12  as has been described previously. 
     The advantage of adding X to Y using the extended Booth encoder instead of using a carry-propagate adder increases as the length of the input vectors increase because the carry propagation delay for a carry-propagate adder increases as the length of the input vectors, but a carry need only be propagated one bit, from L[2n] to L[2n+1], for the extended Booth encoder, no matter how long the input vectors are. 
     The function Z=W*(X+Y) can be extended to the more general function Z=±W*(±X±Y) where the exact function performed is controlled by three control signals, NegW, NegX, and NegY. A system  16  for performing this general computation is illustrated in FIG. 4 c . As illustrated, the system  16  comprises logic circuitry  17 , logic circuitry  18 , reformatter  13 , extended Booth encoder  11 , logic circuitry  15 , and partial products circuitry  12 . 
     In this system, X is subtracted if NegX is 1 or added if NegX is 0. Y is subtracted if NegY is 1 or added if NegY is 0. The combination of X and Y is multiplied by −W if NegW is 1 or by W if NegW is 0. X and Y can be negated using the well known relationship −X=˜X+1 for two&#39;s complement numbers, where the ˜ operator inverts all the bits of X. One way to implement this relationship is to form, in logic circuitry  17 , X′, where X′=NegX{circumflex over ( )}(X)+NegX, where NegX{circumflex over ( )}(X) indicates that each bit of X is to be exclusive-or&#39;ed with NegX. Likewise, in logic circuitry  18 , Y′ is defined, where Y′=NegY{circumflex over ( )}(Y)+NegY. Since both the extended Booth encoder  11  and the reformatter  13  have carry inputs, C[−1] and Cin respectively, the (±X±Y) function can be implemented by applying X′ to the X input and Y′ to the Y input of the reformatter  13  and NegX and NegY respectively to the two carry inputs, C[−1] and Cin. 
     NegW operates on the output of extended Booth encoder  11 : the product W*(±X±Y) can be inverted by inverting, in logic circuitry  15 , the sign bit, S[n], in all the Booth triplets output by the extended Booth encoder, S′=NegW{circumflex over ( )}(S), and applying S′ instead of S to the partial-product circuitry  12 . 
     A general method for applying an extended Booth encoder to perform arithmetic computations of the form Z=±W*(±X±Y) is illustrated in FIG.  5 . As illustrated, in optional step  20 , the operand X is modified responsive to NegX in the manner previously described to form X′. Similarly, in optional step  21 , the operand Y is modified responsive to NegY in the manner previously described to form Y′. (These two steps can be performed in parallel or serially). 
     In optional step  22 , X′ and Y′ (or X and Y as the case may be) are reformatted in the manner previously described to form K and L, and in step  23 , extended Booth encoding of K and L is performed to form S, M 1 , and M 2 . 
     In optional step  24 , the output S is modified responsive to NegW to form S′. 
     In step  25 , the partial products PP are formed responsive to M 1 , M 2 , and W in the manner previously described. 
     In step  26 , the partial products are combined responsive to S′ (or S as the case may be) in the manner previously described to form Z. 
     These method steps may be embodied in tangible form as software executable by a processor and stored on a computer readable medium which is accessible by the processor. 
     In general, the extended Booth encoder can be used with a carry-save adder to multiply the sum of any number of binary-weighted numbers by another number, Z=W*(X 0 +X 1 + . . . +Xn). To do this, one applies the sum and carry outputs, S and C, respectively, of a carry-save adder that sums X0 through Xn, to the K and L inputs, respectively, of the extended Booth encoder. S and C can be applied to K and L in at least two ways. First, S and C can be applied to K and L through a reformatter as described above. Second, the carry-save adder can be modified to propagate C[2n], which forces C[2n]=0, and save C[2n+1] for all n. When this is done, the carry-save adder becomes a partial-carry-save adder as only some of the carry bits are saved. 
     A special case of the ability to perform the operation Z=W*(X 0 +X 1 + . . . +Xn) arises when X 0  through Xn are all of the partial products resulting from the multiplication U*V. In that case, the operation performed is Z=U*V*W. 
     These examples demonstrate the versatility of the extended Booth encoder, particularly when used with carry-save, partial-carry-save, or short ripple-carry adders. One skilled in logic or hardware DSP design will see many other useful applications for this device. Further, though the descriptions here imply the use of hardware logic devices, it is clear that these functions could also be implemented in a processor programmed to perform them. 
     While embodiments, implementations, and examples have been shown and described, it should be apparent that there are many more embodiments, implementations, and examples that are within the scope of the subject invention. Accordingly, the invention is not to be restricted except in light of the appended claims and their equivalents.