Abstract:
A squarer generates an array of partial products. A method of squaring a representation of a number includes generating an array of partial products, combining the partial product on one side of a diagonal of the array with partial products on the other side of the diagonal to form a folded array of partial products, and combining each of at least one more than half of the partial products in the diagonal of the array with a corresponding one of the partial products in the folded array to produce a new folded array of partial products. In an alternative embodiment, the present invention is a circuit for squaring an n-bit representation of a number.

Description:
TECHNICAL FIELD 
     This invention relates generally to squarers and particularly to high-speed squarers having reduced numbers of partial products. 
     BACKGROUND OF THE INVENTION 
     A squarer can be implemented using a general purpose multiplier having both of the inputs tied together. However, such an implementation results in a squarer that requires a large silicon area to implement, and is slow in operation. One known technique to increase the speed of a squarer is to fold the partial product array over a diagonal of an original array of partial products. The folded array of partial products is shifted since a multiplication by two is a left shift by one bit position. The folded array of partial products is then reduced using any one of a number of standard techniques. For example, the folded array of partial products can be reduced using an array of carry-save adders, followed by a carry-propagate adder. The maximum number of partial products to be reduced, such as in a column, is .left brkt-bot.n/2.right brkt-bot.+1 when squaring an n-bit representation of a number. 
     A technique to further reduce the number of partial products is described in &#34;A Fast Parallel Squarer Based On Divide-and-Conquer&#34; published by T. Yoo, K. F. Smith, and G. Gopalakrishnan in IEEE Journal of Solid State Circuits, vol. 32, June, 1997, pages 909-912. The divide-and-conquer technique employs progressively more complex circuits to reduce the total number of partial products. However, the number of partial products in the largest column remains .left brkt-bot.n/2.right brkt-bot.+1 for an n-bit squaring operation. While the divide-and-conquer technique is an improved squaring method, increased speed can be achieved by decreasing the number of partial products in the control path of the squarer. Therefore, there is a need for a squarer that decreases the number of partial products in the critical path of the squarer. 
     SUMMARY OF THE INVENTION 
     In accordance with the present invention, a method of squaring a representation of a number includes generating an array of partial products, combining the partial products on one side of a diagonal of the array with partial products on the other side of the diagonal to form a folded array of partial products, and combining each of the partial products in the diagonal of the array other than the partial product represented by the least significant bit with a corresponding one of the partial products in the folded array to produce a new folded array of partial products. In an alternative embodiment, the present invention is a circuit for squaring an n-bit representation of a number. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a circuit for generating partial products for an n-bit representation of a number; 
     FIG. 2 is a schematic diagram of a circuit to perform the squaring operation; 
     FIG. 3 is a cicuit for generating partial products from an n-bit two&#39;s complement form number; and 
     FIG. 4 is a schematic diagram of a circuit to perform the squaring operation of the two&#39;s complement form number. 
    
    
     DETAILED DESCRIPTION 
     Squarers are special purpose multipliers in which the multiplicand and multiplier are the same number, that is a number is multiplied by itself. By way of example, an n-bit representation of a number squared generates n squared partial products or partial product terms that need to be combined to generate the square, which has 2n bits. For example, when n is eight, an array of 64 partial products are generated as shown in Table 1 and the square has 16 bits as shown in FIG. 2 or 4. The partial product terms are arranged in columns by power of two for convenience of adding, as is known in the art. The partial product array is formed in n (here eight) rows, one for each of the bits in the representation of the number being squared. Columns here refer to the vertical alignment of partial products, and rows refer to the horizontal alignment of partial products, however, as is known in the art they could be interchanged. Equation 1 represents the squaring operation, individual partial products of which are shown in Table 1. ##EQU1## 
     
                                           TABLE 1__________________________________________________________________________                X.sub.0 X.sub.7                   X.sub.0 X.sub.6                      X.sub.0 X.sub.5                         X.sub.0 X.sub.4                            X.sub.0 X.sub.3                               X.sub.0 X.sub.2                                  X.sub.0 X.sub.1                                     X.sub.0 X.sub.0             X.sub.1 X.sub.7                X.sub.1 X.sub.6                   X.sub.1 X.sub.5                      X.sub.1 X.sub.4                         X.sub.1 X.sub.3                            X.sub.1 X.sub.2                               X.sub.1 X.sub.1                                  X.sub.1 X.sub.0          X.sub.2 X.sub.7             X.sub.2 X.sub.6                X.sub.2 X.sub.5                   X.sub.2 X.sub.4                      X.sub.2 X.sub.3                         X.sub.2 X.sub.2                            X.sub.2 X.sub.1                               X.sub.2 X.sub.0       X.sub.3 X.sub.7          X.sub.3 X.sub.6             X.sub.3 X.sub.5                X.sub.3 X.sub.4                   X.sub.3 X.sub.3                      X.sub.3 X.sub.2                         X.sub.3 X.sub.1                            X.sub.3 X.sub.0    X.sub.4 X.sub.7       X.sub.4 X.sub.6          X.sub.4 X.sub.5             X.sub.4 X.sub.4                X.sub.4 X.sub.3                   X.sub.4 X.sub.2                      X.sub.4 X.sub.1                         X.sub.4 X.sub.0 X.sub.5 X.sub.7    X.sub.5 X.sub.6       X.sub.5 X.sub.5          X.sub.5 X.sub.4             X.sub.5 X.sub.3                X.sub.5 X.sub.2                   X.sub.5 X.sub.1                      X.sub.5 X.sub.0   X.sub.6 X.sub.7 X.sub.6 X.sub.6    X.sub.6 X.sub.5       X.sub.6 X.sub.4          X.sub.6 X.sub.3             X.sub.6 X.sub.2                X.sub.6 X.sub.1                   X.sub.6 X.sub.0X.sub.7 X.sub.7   X.sub.7 X.sub.6 X.sub.7 X.sub.5    X.sub.7 X.sub.4       X.sub.7 X.sub.3          X.sub.7 X.sub.2             X.sub.7 X.sub.1                X.sub.7 X.sub.0__________________________________________________________________________ 
    
     The terms of Equation 1 may be rearranged in three groups as shown in Equation 2. ##EQU2## 
     The first term of Equation 2 represents the diagonal terms, as shown in Table 1 from lower left to upper right. The second term of Equation 2 represents the upper portion of the partial product array, that is those partial product terms upward and to the left of the diagonal partial product terms in Table 1. The third term in Equation 2 represents the portion of the partial product array below and to the right of the diagonal in Table 1. 
     Since the diagonal partial product terms are products of a bit with itself, each such diagonal partial product term can be replaced with a representation of the bit itself since the product of the bit and itself is the bit. Table 2 is the same as Table 1 with such a replacement of diagonal partial product terms. 
     
                                           TABLE 2__________________________________________________________________________                X.sub.0 X.sub.7                   X.sub.0 X.sub.6                      X.sub.0 X.sub.5                         X.sub.0 X.sub.4                            X.sub.0 X.sub.3                               X.sub.0 X.sub.2                                  X.sub.0 X.sub.1                                     X.sub.0             X.sub.1 X.sub.7                X.sub.1 X.sub.6                   X.sub.1 X.sub.5                      X.sub.1 X.sub.4                         X.sub.1 X.sub.3                            X.sub.1 X.sub.2                               X.sub.1                                  X.sub.1 X.sub.0          X.sub.2 X.sub.7             X.sub.2 X.sub.6                X.sub.2 X.sub.5                   X.sub.2 X.sub.4                      X.sub.2 X.sub.3                         X.sub.2                            X.sub.2 X.sub.1                               X.sub.2 X.sub.0       X.sub.3 X.sub.7          X.sub.3 X.sub.6             X.sub.3 X.sub.5                X.sub.3 X.sub.4                   X.sub.3                      X.sub.3 X.sub.2                         X.sub.3 X.sub.1                            X.sub.3 X.sub.0    X.sub.4 X.sub.7       X.sub.4 X.sub.6          X.sub.4 X.sub.5             X.sub.4                X.sub.4 X.sub.3                   X.sub.4 X.sub.2                      X.sub.4 X.sub.1                         X.sub.4 X.sub.0 X.sub.5 X.sub.7    X.sub.5 X.sub.6       X.sub.5          X.sub.5 X.sub.4             X.sub.5 X.sub.3                X.sub.5 X.sub.2                   X.sub.5 X.sub.1                      X.sub.5 X.sub.0   X.sub.6 X.sub.7 X.sub.6    X.sub.6 X.sub.5       X.sub.6 X.sub.4          X.sub.6 X.sub.3             X.sub.6 X.sub.2                X.sub.6 X.sub.1                   X.sub.6 X.sub.0X.sub.7   X.sub.7 X.sub.6 X.sub.7 X.sub.5    X.sub.7 X.sub.4       X.sub.7 X.sub.3          X.sub.7 X.sub.2             X.sub.7 X.sub.1                X.sub.7 X.sub.0__________________________________________________________________________ 
    
     Equation 3 represents folding the lower half of the partial product array into the upper half and combining terms. The second term of equation 3 is the combination of the second and third terms of equation 2. ##EQU3## 
     For example, combining x 1  x 0  and x 0  x 1  results in 2x 0  x 1 . Since multiplication by two is equivalent to a left shift by one, the resultant product is left shifted from the diagonal by one power of two as shown in Table 3. 
     
                                           TABLE 3__________________________________________________________________________             X.sub.0 X.sub.7                X.sub.0 X.sub.6                   X.sub.0 X.sub.5                      X.sub.0 X.sub.4                         X.sub.0 X.sub.3                            X.sub.0 X.sub.2                               X.sub.0 X.sub.1                                  X.sub.0          X.sub.1 X.sub.7             X.sub.1 X.sub.6                X.sub.1 X.sub.5                   X.sub.1 X.sub.4                      X.sub.1 X.sub.3                         X.sub.1 X.sub.2                               X.sub.1       X.sub.2 X.sub.7          X.sub.2 X.sub.6             X.sub.2 X.sub.5                X.sub.2 X.sub.4                   X.sub.2 X.sub.3                         X.sub.2    X.sub.3 X.sub.7       X.sub.3 X.sub.6          X.sub.3 X.sub.5             X.sub.3 X.sub.4                   X.sub.3 X.sub.4 X.sub.7    X.sub.4 X.sub.6       X.sub.4 X.sub.5             X.sub.4   X.sub.5 X.sub.7 X.sub.5 X.sub.6       X.sub.5X.sub.6 X.sub.7 X.sub.6X.sub.7__________________________________________________________________________ 
    
     Diagonal partial product terms having a non-diagonal partial product term in the same column are combined with the non-diagonal partial product term resulting in a sum value that replaces the non-diagonal partial product term and provides a carry term which is placed in the otherwise blank space adjacent (as shown in Table 3 to the left) of the diagonal partial product term. As such, the sum and carry terms replace the existing diagonal partial product term and non-diagonal partial product term that are added. The total number of partial products remain the same as before the combination, but n-1 partial products are replaced by new partial products which are placed one column to the left. 
     The second term of Equation 3 represents the folded and shifted partial product terms. The folded and shifted partial product terms can be factored into two components as shown in Equation 4. ##EQU4## 
     The sum of x j  and x j  x j-1  results in a sum of x j  x j-1  and a carry of x j  x j-1  in the general case, as shown by Equations 5, 6 and 7. ##EQU5## Combining Equations 7 and 4 results in Equation 8. ##EQU6## 
     In Equation 8, Z represents the square of an n-bit number. The first component term represents the least significant bit. The second component term of Equation 8 represents the sum and carry terms resulting from combining the diagonal partial product terms with the folded and shifted array of partial product terms. The third component term in Equation 8 represents the remaining partial product terms of the folded and shifted array of partial products. The resultant new folded array of partial products is represented in Table 4. 
     
                                           TABLE 4__________________________________________________________________________                X.sub.0 X.sub.7                   X.sub.0 X.sub.6                      X.sub.0 X.sub.5                         X.sub.0 X.sub.4                            X.sub.0 X.sub.3                               X.sub.0 X.sub.2                                  X.sub.0 X.sub.1                                     X.sub.0             X.sub.1 X.sub.7                X.sub.1 X.sub.6                   X.sub.1 X.sub.5                      X.sub.1 X.sub.4                         X.sub.1 X.sub.3                            X.sub.1 X.sub.2                               X.sub.0 X.sub.1          X.sub.2 X.sub.7             X.sub.2 X.sub.6                X.sub.2 X.sub.5                   X.sub.2 X.sub.4                      X.sub.2 X.sub.3                         X.sub.1 X.sub.2       X.sub.3 X.sub.7          X.sub.3 X.sub.6             X.sub.3 X.sub.5                X.sub.3 X.sub.4                   X.sub.2 X.sub.3    X.sub.4 X.sub.7       X.sub.4 X.sub.6          X.sub.4 X.sub.5             X.sub.3 X.sub.4 X.sub.5 X.sub.7    X.sub.5 X.sub.6       X.sub.4 X.sub.5   X.sub.6 X.sub.7 X.sub.5 X.sub.6X.sub.6 X.sub.7__________________________________________________________________________ 
    
     FIG. 1 illustrates a circuit including combination logic 10 for combining the n-bit inputs to generate the partial products shown in Table 4 from a bit representation of the number being squared. One skilled in the art would know how to generate each of the partial product terms from the bit inputs. For example, the partial product x 1  x 0  could be generated by a logical AND combination of the x 0  and x 1  inputs. Similarly, the x 1  x 0  partial product can be generated as an AND combination of the x 1  input and the inverse of the x 0  input. 
     FIG. 2 is a circuit 20 illustrating how the partial products of Table 4 are combined to result in the square of the n-bit number. Each of the two input adders 22 are half adders and each of the three input adders 24 are full adders. Adders 26 combine the terms of the resultant partial product array and provide outputs to adders 28. Adders 26 are configured as carry-save adders. 
     Adders 28 combine the inputs received from adders 26 to produce the 2-n bit representation of the square of the n-bit number being squared. Adders 28 are preferably carry-propagate adders comprising a carry-ripple adder. 
     The technique of the present invention may be used where the representation of a number being squared is an unsigned integer or is represented in two&#39;s complement form. 
     Equation 9 represents the squaring operation of a two&#39;s complement form of a number. ##EQU7## 
     Table 5 represents the partial product array obtained when squaring a two&#39;s complement form n-bit number, for example where n is 8. 
     
                                           TABLE 5__________________________________________________________________________             1  X.sub.0 X.sub.7                   X.sub.0 X.sub.6                      X.sub.0 X.sub.5                         X.sub.0 X.sub.4                            X.sub.0 X.sub.3                               X.sub.0 X.sub.2                                  X.sub.0 X.sub.1                                     X.sub.0 X.sub.0             X.sub.1 X.sub.7                X.sub.1 X.sub.6                   X.sub.1 X.sub.5                      X.sub.1 X.sub.4                         X.sub.1 X.sub.3                            X.sub.1 X.sub.2                               X.sub.1 X.sub.1                                  X.sub.1 X.sub.0          X.sub.2 X.sub.7             X.sub.2 X.sub.6                X.sub.2 X.sub.5                   X.sub.2 X.sub.4                      X.sub.2 X.sub.3                         X.sub.2 X.sub.2                            X.sub.2 X.sub.1                               X.sub.2 X.sub.0       X.sub.3 X.sub.7          X.sub.3 X.sub.6             X.sub.3 X.sub.5                X.sub.3 X.sub.4                   X.sub.3 X.sub.3                      X.sub.3 X.sub.2                         X.sub.3 X.sub.1                            X.sub.3 X.sub.0    X.sub.4 X.sub.7       X.sub.4 X.sub.6          X.sub.4 X.sub.5             X.sub.4 X.sub.4                X.sub.4 X.sub.3                   X.sub.4 X.sub.2                      X.sub.4 X.sub.1                         X.sub.4 X.sub.0 X.sub.5 X.sub.7    X.sub.5 X.sub.6       X.sub.5 X.sub.5          X.sub.5 X.sub.4             X.sub.5 X.sub.3                X.sub.5 X.sub.2                   X.sub.5 X.sub.1                      X.sub.5 X.sub.0   X.sub.6 X.sub.7 X.sub.6 X.sub.6    X.sub.6 X.sub.5       X.sub.6 X.sub.4          X.sub.6 X.sub.3             X.sub.6 X.sub.2                X.sub.6 X.sub.1                   X.sub.6 X.sub.0X.sub.7 X.sub.7   X.sub.7 X.sub.6 X.sub.7 X.sub.5    X.sub.7 X.sub.4       X.sub.7 X.sub.3          X.sub.7 X.sub.2             X.sub.7 X.sub.1                X.sub.7 X.sub.0__________________________________________________________________________ 
    
     When combining x i  x j  terms with x j  x i  terms, the resultant array of partial products is shown in Table 6. 
     
                                           TABLE 6__________________________________________________________________________             1             X.sub.0 X.sub.7                X.sub.0 X.sub.6                   X.sub.0 X.sub.5                      X.sub.0 X.sub.4                         X.sub.0 X.sub.3                            X.sub.0 X.sub.2                               X.sub.0 X.sub.1                                  X.sub.0          X.sub.1 X.sub.7             X.sub.1 X.sub.6                X.sub.1 X.sub.5                   X.sub.1 X.sub.4                      X.sub.1 X.sub.3                         X.sub.1 X.sub.2                               X.sub.1       X.sub.2 X.sub.7          X.sub.2 X.sub.6             X.sub.2 X.sub.5                X.sub.2 X.sub.4                   X.sub.2 X.sub.3                         X.sub.2    X.sub.3 X.sub.7       X.sub.3 X.sub.6          X.sub.3 X.sub.5             X.sub.3 X.sub.4                   X.sub.3 X.sub.4 X.sub.7    X.sub.4 X.sub.6       X.sub.4 X.sub.5             X.sub.4   X.sub.5 X.sub.7 X.sub.5 X.sub.6       X.sub.5X.sub.6 X.sub.7 X.sub.6X.sub.7__________________________________________________________________________ 
    
     Observing that the addition of terms x j  and x i  x j  results in a sum of x i  x j  and a carry of x i  x j , and the sum of x j , x i  x j   and two ones results in a sum of  and a carry of , the partial product array of Table 6 can be rewritten as the partial product array of Table 7. 
     
                                           TABLE 7__________________________________________________________________________                1                X.sub.0 X.sub.7                   X.sub.0 X.sub.6                      X.sub.0 X.sub.5                         X.sub.0 X.sub.4                            X.sub.0 X.sub.3                               X.sub.0 X.sub.2                                  X.sub.0 X.sub.1                                     X.sub.0             X.sub.1 X.sub.7                X.sub.1 X.sub.6                   X.sub.1 X.sub.5                      X.sub.1 X.sub.4                         X.sub.1 X.sub.3                            X.sub.1 X.sub.2                               X.sub.0 X.sub.1          X.sub.2 X.sub.7             X.sub.2 X.sub.6                X.sub.2 X.sub.5                   X.sub.2 X.sub.4                      X.sub.2 X.sub.3                         X.sub.1 X.sub.2       X.sub.3 X.sub.7          X.sub.3 X.sub.6             X.sub.3 X.sub.5                X.sub.3 X.sub.4                   X.sub.2 X.sub.3    X.sub.4 X.sub.7       X.sub.4 X.sub.6          X.sub.4 X.sub.5             X.sub.3 X.sub.4 X.sub.5 X.sub.7    X.sub.5 X.sub.6       X.sub.4 X.sub.5   X.sub.6 X.sub.7 X.sub.5 X.sub.6X.sub.6 X.sub.7__________________________________________________________________________ 
    
     In comparing Table 7 to Table 6, the number of partial products to be reduced has decreased by one in the column having the greatest number of partial product terms. 
     FIG. 3 illustrates a circuit including combination logic 50 for combining the n-bit inputs representing a two&#39;s complement form number to generate the partial products shown in Table 7. 
     FIG. 4 is a circuit 60, similar to FIG. 2, for combining the partial products shown in Table 7 to produce the 2n bit squared output of the two&#39;s complement form representation of the number being squared. The two input adders 22 are half-adders and the three input adders 24 are full-adders. Adders 62 combine the partial product terms from each column and provide outputs to adders 64. Adders 62 are preferably carry-save adders. 
     Adders 64 receive the outputs from adders 62 and provide the 2 n bit squared representation of the n-bit two&#39;s complement form number being squared. 
     The invention may be fabricated using any known VLSI process in one or more integrated circuits. The integrated circuit, for example, may be for example a microcontroller, a microprocessor or a digital signal processor. Squarers in accordance with the present invention provide partial products in an array having fewer partial products in the critical path than known squarers, thereby reducing the time required to complete a squaring operation. The largest number of partial products in any given column for numbers represented as unsigned integers is .right brkt-top.n/2.left brkt-top.; for numbers represented in two&#39;s, complement form is .right brkt-top.n/2.left brkt-top.+1, where the number being squared is an n-bit number. 
     While the illustrative embodiment of the invention has been described illustrating an example having eight bits, the invention is not limited thereto. 
     While the illustrative embodiment of the invention has not been described as incorporating pipelining, one skilled in the art would recognize the enhanced computation efficiency available by utilizing pipelining in the design. Pipelining is achieved by initiating computation with a new dataset before completing computations with a previous set of data. The more latches used in pipelining, the greater the depth of pipelining. Pipelining causes an initial latency in computation time required to fill the pipeline, but maximizes the use of resources such as adders and multipliers.