Patent Document

CLAIM OF PRIORITY 
       [0001]    This application is a continuation of U.S. patent application Ser. No. 12/020,486, titled “FUSED MULTIPLY-ADD ROUNDING AND UNFUSED MULTIPLY-ADD ROUNDING IN A SINGLE MULTIPLY-ADD MODULE”, filed Jan. 25, 2008, which application is herein incorporated by reference. 
     
    
     COPYRIGHT NOTICE 
       [0000]    
       
         
           
             A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever. 
           
         
       
     
       BACKGROUND OF THE INVENTION 
       [0003]    1. Field of the Invention 
         [0004]    The present invention relates to computer systems. More particularly, the present invention relates to computer processors. 
         [0005]    2. Description of Related Art 
         [0006]    In the computation of the multiply-add operation A*B+C, where A, B, and C are floating point numbers, rounding is accomplished utilizing one of two techniques. The first technique is termed fused multiply-add rounding, and the second technique is termed unfused multiply-add rounding. 
         [0007]      FIG. 1  illustrates a conventional floating point multiply-add (FMA) module  100  utilizing conventional fused multiply-add rounding. In  FIG. 1 , a mantissa of an operand A is input to a carry save adder (CSA)  104  at an input  104 _ 1 , and a mantissa of an operand B is input to CSA  104  at an input  104 _ 2 . The partial products of the operation A*B are formed and reduced in CSA  104  until two partial products, term S and term T, remain. In the present example, term S is output from CSA  104  at output  104 _ 3 , and term T is output from CSA  104  at output  104 _ 4 . 
         [0008]    In parallel with the operation of CSA  104 , a mantissa of an operand C is input to an alignment module  102  at an input  102 _ 1 , and the binary point of the mantissa of operand C is aligned with a position of a binary point of the product of A*B. The resultant aligned C term is output from alignment module  102  at output  102 _ 2 . 
         [0009]    Term S, term T, and the portion of the aligned C term that is not larger than the product of A*B, are input to a full adders module (FA)  106 , respectively at inputs  106 _ 2 ,  106 _ 3  and  106 _ 1 , and combined in full adders of FA module  106  to produce two resulting new terms, term X and term Y. Term X is output from FA module  106  at output  106 _ 4 , and term Y is output from FA  106  at output  106 _ 5 . 
         [0010]    Term X and term Y are next input to a carry lookahead adder (CLA)  108 , respectively at inputs  108 _ 1 , and  108 _ 2 . Term X and term Y are added in CLA  108  to produce two resultant sums, a first sum for a carry-in of zero, herein termed Sum C 0 , and a second sum for a carry-in of 1, herein termed Sum C 1 . Sum C 0  is output from CLA  108  at output  108 _ 4  and Sum C 1  is output from CLA  108  at output  108 _ 3 . 
         [0011]    The portion of the aligned C mantissa that is larger than the product of A*B, output from alignment module  102  at output  102 _ 2 , is input to an increment module  110  at input  110 _ 1  and incremented in increment module  110 . The incremented term output from increment module  110  at output  110 _ 2  is input to mux  114  at input  114 _ 1  together with the unincremented aligned C term input to mux  114  at input  114 _ 2 . 
         [0012]    The Sum C 0  term output from CLA  108  is input to mux  112  at input  112 _ 2  together with the Sum C 1  term input at input  112 _ 1 . Initially, the value of zero is used as input at input  112 _ 3 . The resultant carry out of mux  112  at output  112 _ 4  is then input to mux  114  at input  114 _ 3  and is used to select the incremented or unincremented high order bits, i.e., the bits that are in positions larger than the positions for the product of A and B, in mux  114 . The initially selected high order bits are then output from mux  114  at output  114 _ 4 . 
         [0013]    The resultant carry out from mux  114  is termed the end around carry. The end around carry is then used as the carry in to CLA  108 , which is accomplished by replacing the initial input of zero at input  114 _ 3  to mux  114  with the end around carry value. After this replacement, the output from mux  112  at output  112 _ 4  becomes the input to normalizer module  116  at input  116 _ 2 . The carry out from mux  112  at output  112 _ 4  is input to mux  114  at input  114 _ 3  and used to select the incremented or unincremented high order bits. 
         [0014]    The selected high order bits output from mux  114  are then input to normalizer  116  at input  116 _ 1  together with the resultant carry out of mux  112  input to normalizer  116  at input  116 _ 2 . 
         [0015]    Normalizer  116  normalizes the values and outputs the normalized value at output  116 _ 3 . The normalized value is input to a rounding module  118  at input  118 _ 1  where the normalized value is rounded and the fused multiply-add rounding result output from rounding module  118  at output  118 _ 2 . The above fused multiply-add rounding method is well known to those of skill in the art and is not further described herein in detail to avoid detracting from the principles of the invention. 
       SUMMARY OF THE INVENTION 
       [0016]    In accordance with one embodiment of the invention, a computer processor including a single fused-unfused floating point multiply-add (FMA) module computes the result of the operation A*B+C for floating point numbers for fused multiply-add rounding operations, when in a fused multiply-add rounding mode, and for unfused multiply-add rounding operations, when in an unfused multiply-add rounding mode. In one embodiment, a fused multiply-add rounding implementation is augmented with additional hardware which calculates an unfused multiply-add rounding result without adding additional pipeline stages. In one embodiment, a computation by the fused-unfused floating point multiply-add (FMA) module is initiated using a single opcode to compute a fused multiply-add rounding result and using a different single opcode to compute an unfused multiply-add rounding result. 
         [0017]    Embodiments described herein are best understood by reference to the following detailed description when read in conjunction with the accompanying drawings. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0018]      FIG. 1  illustrates a conventional floating point multiply-add (FMA) module utilizing conventional fused multiply-add rounding. 
           [0019]      FIG. 2  illustrates a single fused-unfused floating point multiply-add (FMA) module which generates both fused multiply-add rounding and unfused multiply-add rounding results in accordance with one embodiment of the invention. 
           [0020]      FIG. 3  illustrates a computer system having a computer processor including the single fused-unfused floating point multiply-add (FMA) module of  FIG. 2  in accordance with one embodiment of the invention. 
       
    
    
       [0021]    Common reference numerals are used throughout the drawings and detailed description to indicate like elements. 
       DETAILED DESCRIPTION 
       [0022]    Nearly all conventional computer processors, whether or not they provide a fused multiply-add operation, have both floating point multiply instructions and add instructions. An unfused multiply-add operation can be carried out by executing a multiply operation followed by an add operation. As each operation applies a rounding operation, the result obtained is the unfused multiply-add rounding result. 
         [0023]    Herein the symbol “*” in an equation, such as A*B+C, represents the mathematical operation of multiplication, unless otherwise noted. Further, herein the symbol “+” in an equation, such as A*B+C, represents the mathematical operation of addition, unless otherwise noted. Additionally, herein the symbol “=” in an equation, such as A*B+C=(A*B)+C, represents the mathematical expression “equals” unless otherwise noted. Also, herein the symbol “˜” in an equation, such as ((A*B)+˜C), represents the mathematical expression “complement”, unless otherwise noted. 
         [0024]    Further herein for purposes of description, operands A, B, and C refer to the mantissa portions of floating point numbers, unless otherwise specified. Further, although the operations described herein are primarily described with reference to single precision calculation, e.g., 24 bit mantissa, those of skill in the art can recognize the embodiments are applicable to double precision, quad precision, or other precision operations as well. 
         [0025]    In the examples provided herein, floating point values with a mantissa of 24 bits are used; however, those of skill in the art can recognize that embodiments of the invention are applicable to mantissas of other bit counts, and that the invention is not limited to the examples detailed herein. 
         [0026]      FIG. 2  illustrates a single fused-unfused floating point multiply-add (FMA) module  200  which generates both fused multiply-add rounding and unfused multiply-add rounding results in accordance with one embodiment of the invention. 
         [0027]    In one embodiment, fused-unfused FMA module  200  receives operands from a computer processor (see  FIG. 2 ). In one embodiment, when an opcode provided is a fused multiply-add opcode, fused-unfused FMA module  200  generates a fused multiply-add rounding result, and when an opcode provided is an unfused multiply-add opcode, fused-unfused FMA module  200  generates an unfused multiply-add rounding result. In another embodiment, fused-unfused FMA module  200  receives a single opcode with a deterministic mode bit. If the mode bit is set a first way, e.g., set to one, a fused multiply-add rounding result is generated, and if the mode bit is set a second way, e.g., set to zero, an unfused multiply-add rounding result is generated. 
         [0028]    Referring now to  FIG. 2 , in one embodiment fused-unfused FMA module  200  includes: an alignment module  202 , a carry save adder (CSA) module  204 , and a sticky bit module  212 , which selectively receive input operands. For example, fused-unfused FMA module  200  receives an input operand C, an addition term, at input  200 _ 1 , an input operand A, a first multiply term, at input  200 _ 2 , and an input operand B, a second multiply term, at input  200 _ 3 . 
         [0029]    Alignment module  202  receives inputs, such as input operand C, at input  202 _ 1 . Alignment module  202  is connected, at output  202 _ 2 , to: an increment module  224 , at input  224 _ 1 ; a mux module  232 , at input  232 _ 2 ; a full adders module  206 , at input  206 _ 1 ; and, a rounding and speculation module  216 , at input  216 _ 1 . 
         [0030]    Increment module  224  is connected, at output  224 _ 2 , to mux module  232 , at input  232 _ 1 . Outputs from mux module  232 , at output  232 _ 4 , are input to a normalizer  240 , at input  240 _ 1 . 
         [0031]    CSA module  204  receives inputs, such as input operand A, at input  204 _ 1 , and input operand B, at input  204 _ 2 . CSA module  204  is further connected, at output  204 _ 3 , to full adders module  206 , at input  206 _ 2 , and to a product bit module  214  at input  214 _ 2 . 
         [0032]    CSA module  204  is further connected, at output  204 _ 4 , to full adders module  206 , at input  206 _ 3 , and to product bit module  214 , at input  214 _ 1 . CSA module  204  is further connected, at output  204 _ 5 , to an early propagate and generate (p&amp;g) module  210 , at input  210 _ 1 ; and, also connected, at output  204 _ 6 , to input  210 _ 2 . Early p&amp;g module  210  is further connected, at output  210 _ 3 , to product bit module  214 , at input  214 _ 3 . 
         [0033]    Sticky bit computation module  212  also receives input of operand A, at input  212 _ 2 , and input of operand B, at input  212 _ 1 . Sticky bit computation module  212  is further connected, output  212 _ 3 , to rounding and speculation module  216 , at input  216 _ 5 . 
         [0034]    Full adders module  206  is further connected to half adders module  208 . For example, although not shown, full adders module  206  is connected, at output  206 _ 4 , to half adders module  208 , at input  208 _ 1 , and also connected, at output  206 _ 5  to half adders module  208 , at input  208 _ 2 . 
         [0035]    Half adders module  208  is further connected to carry look-ahead adders (CLAs)  218 ,  220 , and  222 , and to rounding and speculation module  216 . More particularly, half adders module  208  is connected, at output  208 _ 3 , to: input  218 _ 1  of CLA  218 ; to input  220 _ 1  of CLA  220 ; and, to input  222 _ 1  of CLA  222 ; and to input  216 _ 6  of rounding and speculation module  216 . Further, half adders module  208  is connected at output  208 _ 4 , to: input  218 _ 2  of CLA  218 ; to input  220 _ 2  of CLA  220 ; and, to input  222 _ 2  of CLA  222 ; and to input  216 _ 7  of rounding and speculation module  216 . 
         [0036]    CLA  218  is further connected, at output  218 _ 3 , to mux module  226 , at input  226 _ 1 , and, at output  218 _ 4  to mux module  226 , at input  226 _ 2 . Mux module  226  is further connected at output  226 _ 4  to mux module  228  at input  228 _ 3 , and to normalizer  240  at input  240 _ 4 . 
         [0037]    CLA  220  is further connected, at output  220 _ 3 , to mux module  228 , at input  228 _ 1 , and, at output  220 _ 4  to mux module  228 , at input  228 _ 2 . Mux module  228  is further connected at output  228 _ 4  to mux module  230 , at input  230 _ 3 , and to normalizer  240  at input  240 _ 3 . 
         [0038]    CLA  222  is further connected, at output  222 _ 3 , to mux module  230 , at input  230 _ 1 , and, at output  222 _ 4  to mux module  230 , at input  230 _ 2 . Mux module  230  is further connected at output  230 _ 4  to mux module  232 , at input  232 _ 3 , and to normalizer  240  at input  240 _ 2 . 
         [0039]    Product bit module  214  is further connected to rounding and speculation module  216 . More particularly, in one embodiment, product bit module  214  is connected, at output  214 _ 4  to rounding and speculation module  216 , at input  216 _ 2 . Product bit module  214  is further connected, at output  214 _ 5 , to rounding and speculation module  216 , at input  216 _ 3 . Product bit module  214  is also connected, at output  214 _ 6 , to rounding and speculation module  216 , at input  216 _ 4 . 
         [0040]    In one embodiment, rounding and speculation module  216  is connected, at output  216 _ 11  to mux module  226 , at input  226 _ 2 , and also connected at output  216 _ 10 , to mux module  226 , at input  226 _ 1 . 
         [0041]    Rounding and speculation module  216  is connected, at output  216 _ 9 , to mux module  228 , at input  228 _ 2 , and also connected at output  216 _ 8 , to mux module  228 , at input  228 _ 1 . 
         [0042]    Normalizer module  240  is connected at output  240 _ 5 , to rounding module  250 , at input  250 _ 1 . The result of rounding module  250  is output, at output  250 _ 2 , and further output from fused-unfused FMA  200 , at output  200 _ 8 . 
         [0043]    In the present embodiment, fused-unfused FMA module  200  receives an input, such as a single unfused multiply-add rounding opcode, which initiates an unfused multiply-add rounding operation, also termed herein an unfused multiply-add rounding mode, or receives an input, such as a single fused multiply-add rounding opcode, which initiates a fused multiply-add rounding operation, also termed herein a fused multiply-add rounding mode. 
         [0044]    Unfused Multiply-Add Rounding Mode 
         [0045]    Referring now to  FIG. 2 , in unfused multiply-add rounding mode, in one embodiment, operand C is input to alignment module  202 , and operand A and operand B are input to carry save adder (CSA)  204 . For example, in  FIG. 2 , operand C, an addition term, is input to alignment module  202  at input  202 _ 1 , operand A, a first multiply term, is input to CSA  204  at input  204 _ 1 , and operand B, a second multiply term, is input to CSA  204  at input  204 _ 2 . 
         [0046]    In one embodiment, carry save adder  204  is composed of 4:2 compressors, 3:2 compressors (also known as full adders), 5:3 compressors, and/or half adders, and contains either AND gates or Booth encoders. Carry save adders and alignment modules are well known to those of skill in the art and are not further described herein in detail to avoid detracting from the principles of the invention. 
         [0047]    In CSA  204 , the partial products of operand A and B are computed and added until two partial products remain, term S and term T. Herein the remaining two partial products are also termed terminal partial products, where term S is the first terminal partial product and term T is the second terminal partial product. Term S and term T, if added together, would produce the product of A*B; however, in unfused multiply-add rounding mode, the terms S and T are not added together, and the product value is not available. 
         [0048]    From CSA module  204 , term S and term T are input to a row of full adders, full adders module  206 . For example, term S is output from output  204 _ 3  of CSA  204  and input to full adders  206  at input  206 _ 2 ; and, term T is output from output  204 _ 4  of CSA  204  and input to full adders module  206  at input  206 _ 3 . 
         [0049]    In one embodiment, each full adder in full adders module  206  is a 3:2 compressor. Full adders are well known to those of skill in the art and not further described herein to avoid detracting from the principles of the invention. 
         [0050]    Concurrently, with the operations of CSA  204 , the value of operand C is aligned in alignment module  202  to align the binary point of C with the binary point of the product of operand A and operand B. Binary points and the alignment of floating point numbers are terms well known to those of skill in the art and not further described in detail herein to avoid detracting from the principles of the invention. The aligned C value, also termed the aligned addition term and C(al), is output from alignment module  202 , for example, at output  202 _ 2 , and the part of the aligned C value that has positions in common with the product of operand A and operand B is input to full adders module  206 , for example at input  206 _ 1 . 
         [0051]    If operand A and operand B, are values between 1 and 2, the product of A*B is between 1 and 4. Example 1 shows a representation of terms S and T output from CSA  204 , where X represents a bit having a value of 0 or 1. 
         [0000]    
       
         
           
             S 
             = 
             
               
                 XX 
                 . 
                 XXXXXXXX_XXXXXXXX 
               
                
               _XXXXXXXX 
                
               _XXXXXXXX 
                
               _XXXXXX 
             
           
         
       
       
         
           
             T 
             = 
             
               
                 XX 
                 . 
                 XXXXXXXX_XXXXXXXX 
               
                
               _XXXXXXXX 
                
               _XXXXXXXX 
                
               _XXXXXX 
             
           
         
       
     
       Example 1 
       [0052]    If the product of A*B is between 1 and 2, the rounded 24 bit mantissa is located one bit to the right of the rounded 24 bit mantissa if the product of A*B is between 2 and 4, as shown in Example 2. 
         [0000]    
       
         
           
             
               between 
                
               
                   
               
                
               1 
                
               
                   
               
                
               and 
                
               
                   
               
                
               2 
             
             = 
             
               
                 X 
                 . 
                 XXXXXXXX_XXXXXXXX 
               
                
               _XXXXXXX 
             
           
         
       
       
         
           
             
               between 
                
               
                   
               
                
               2 
                
               
                   
               
                
               and 
                
               
                   
               
                
               4 
             
             = 
             
               
                 XX 
                 . 
                 XXXXXXXX_XXXXXXXX 
               
                
               _XXXXXX 
             
           
         
       
     
       Example 2 
       [0053]    In one embodiment, term S and term T are truncated in full adders module  206  before being combined with the aligned C term in full adders module  206 . In one embodiment, the truncation is implemented so that later formed terms X and Y do not contain data from terms S and/or T that do not contribute to an unfused multiply-add rounding result. In one embodiment, the truncation is implemented by zeroing the last 24 bits, i.e., the rightmost 24 bits, of term S and term T to produce a truncated term S, also termed herein the truncated first terminal partial product, S(tr), and a truncated term T, also termed herein the truncated second terminal partial product, T(tr). 
         [0054]    At the time of the truncation, the value of the most significant bit (msb) of the product is unknown. If the product is between 1 and 2, the msb of the product is 0; and if the product is between 2 and 4, the msb of the product is 1. In one embodiment, the term S and term T are truncated as if the msb is 1, as shown in Example 3. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 3 
       [0055]    If the msb of the product is 1, then 2 bits need to be added with the truncated S and T terms if the rounded product were to be obtained. The rounded product itself need not be obtained, but the value of the sum of the rounded product and the aligned C term is obtained. Hence these two bits do need to be added with the sum of the truncated S and T terms and the aligned C term. Herein the 2 bits that need to be added with the truncated values of S and T and the aligned C terms are termed bit K and bit R, as shown in Example 4. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 4 
       [0056]    Bit K is the carry-in from the sum of the 24 bits of terms S and T that were replaced with zeros in truncation. Bit R is the rounding bit for the rounded product value. If the product A*B is to be rounded up, instead of truncated down, then the product is incremented if the truncated product is not exact. Thus, the function of the bit R is to increment the product, and may be 1 if rounding up or to the nearest. Rounding up and rounding to the nearest are rounding conventions well known to those of skill in the art and not further described herein to avoid detracting from the principles of the invention. Further, carry-in bits and rounding bits are well known to those of skill in the art and are not further described in detail to avoid detracting from the principles of the invention. 
         [0057]    Since the mantissa of any value is positive (the sign is kept elsewhere), if subtraction is called for, there are two cases to obtain a positive mantissa for the final result. In the first case, if A*B&gt;C, then (A*B)−C is computed by (A*B)+˜C+1. However, in the second case, if A*B&lt;C, then C−(A*B) is computed. In the second case, note that 
         [0000]    
       
         
           
             
               
                 
                   
                     C 
                     - 
                     
                       ( 
                       
                         A 
                         * 
                         B 
                       
                       ) 
                     
                   
                   = 
                     
                    
                   
                     - 
                     
                       ( 
                       
                         
                           ( 
                           
                             A 
                             * 
                             B 
                           
                           ) 
                         
                         - 
                         C 
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     - 
                     
                       ( 
                       
                         
                           ( 
                           
                             A 
                             * 
                             B 
                           
                           ) 
                         
                         + 
                         
                           ~ 
                           C 
                         
                         + 
                         1 
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     
                       - 
                       
                         ( 
                         
                           
                             ( 
                             
                               A 
                               * 
                               B 
                             
                             ) 
                           
                           + 
                           
                             ~ 
                             C 
                           
                         
                         ) 
                       
                     
                     - 
                     1 
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     
                       - 
                       
                         ( 
                         
                           
                             ( 
                             
                               A 
                               * 
                               B 
                             
                             ) 
                           
                           + 
                           
                             ~ 
                             C 
                           
                         
                         ) 
                       
                     
                     + 
                     1 
                     - 
                     1 
                   
                 
               
             
             
               
                 
                   = 
                     
                    
                   
                     - 
                     
                       
                         ( 
                         
                           
                             ( 
                             
                               A 
                               * 
                               B 
                             
                             ) 
                           
                           + 
                           
                             ~ 
                             C 
                           
                         
                         ) 
                       
                       . 
                     
                   
                 
               
             
           
         
       
     
         [0058]    Thus, (A*B)+˜C is computed before it is known which of the above cases is correct. The ˜C is produced in alignment module  202 . When the correct case is determined, i.e., the first case or the second case, if it is the first case, the value of 1 is added to the result, but if the correct case is the second case, the value of 1 is not added to the result. Instead, the result is complemented. The first and second cases for subtraction are also referred to herein as the two subtraction methods, i.e., the first subtraction method referring to the first case, and the second subtraction method referring to the second case. 
         [0059]    Alternatively, if the msb of the product is 0, rather than 1, then 4 bits need to be added with the truncated values of terms S and T if the rounded product is to be obtained. The rounded product itself need not be obtained, but the value of the sum of the rounded product and aligned C term is obtained. Hence these four bits do need to be added with the sum of the truncated S and T terms and the aligned C term. Herein the 4 bits that need to be added with the truncated values of S and T and the aligned C terms are termed bit W, bit Z, bit N, and bit M, as shown in Example 5. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 5 
       [0060]    Bit W is the most significant bit (msb) of the portion of the term S that was zeroed out on the assumption that the msb would be 1, rather than 0. Bit Z is the most significant bit (msb) of the portion of the term T that was zeroed out on the assumption that the msb would be 1, rather than 0. Bit N is the carry-in from the sum of the rightmost 23 bits of the 24 bits of terms S and T that were replaced with zeroes in truncation. Bit M is the rounding bit, similar to the R bit, except computed for the position one bit to the right of that instance. 
         [0061]    Again, since the mantissa of any value is positive, if subtraction is called for, there are two cases to obtain a positive mantissa for the final result. In the first case, if A*B&gt;C, then (A*B)−C is computed by (A*B)+˜C+1. However, in the second case, if A*B&lt;C, then C−(A*B) is computed. Note that C−(A*B)=˜((A*B)+˜C). Thus, (A*B)+˜C is computed before which the actual case is determined. The ˜C is produced in alignment module  202 . When the case is determined, if it is the first case, the value of 1 is added to the result, but if it is the second case, the value of 1 is not added; instead, the result is complemented. 
         [0062]    In determining the unfused multiply-add rounding of the product, a determination is made whether or not one bit is to be added for rounding, i.e., the R bit (or M bit) earlier discussed. More particularly, a determination is made whether the R bit (or M bit) is equal to 0 or 1. 
         [0063]    To determine the value of the K, R, N, and M bits, all of the values of the terms S and T do not need to be added up; however, a few of the values of the sum of the terms S and T need to be determined. 
         [0064]    The value of the most significant bit (msb) of the product is determined; also, the value of the least significant bit (lsb) of what would be the truncated sum of the product is determined, herein termed bit L. Further, the value of the next lower bit of the product before truncation is determined, referred to as the guard bit, herein termed bit G, and the sticky bit is determined. 
         [0065]    For 24 bit precision, if the msb bit of the product is 1, then the representation of the sum of the terms S and T is as shown in Example 6. 
         [0000]    
       
         
           
             1 
              
             
               X 
               . 
               XXXXXXXX_XXXXXXXX 
             
              
             _XXXXXXLGI 
              
             _IIIIIIII 
              
             _IIIIIIII 
              
             
               _IIIIIII 
                
               I 
             
           
         
       
     
       Example 6 
       [0066]    For 24 bit precision if the msb bit of the product is instead 0, then the representation of the sum of the terms S and T is as shown in Example 7. 
         [0000]    
       
         
           
             0.1 
              
             XXXXXXXX_XXXXXXXX 
              
             _XXXXXXXLG 
              
             _IIIIIIII 
              
             _IIIIIIII 
              
             _IIIIIII 
           
         
       
     
       Example 7 
       [0067]    In the above examples, the sticky bit is the “OR” of all the I bits, where I represents bits in less significant positions than the guard bit. Sticky bits are well known to those of skill in the art and are usually determined by actually taking the OR of the I bits specified above. 
         [0068]    In the present embodiment, however, that approach would require implementing enough of the adder to determine all the I bits, which otherwise are not needed. Thus, the sticky bits are not obtained in the above manner. Instead, in one embodiment, the sticky bit for the case where the msb bit is 0 is obtained by adding the counts of the trailing zeros in the operands A and B in module sticky bit  212 . If the sum is large enough, e.g., 23 or more for single precision and 52 or more for double precision, the sticky bit is 0; otherwise, the sticky bit is 1. The sticky bit for the case where the msb bit is 1 is obtained by ORing the sticky bit for the case where the msb bit is 0 and the G bit for the case where the msb bit is 0. 
         [0069]    In one embodiment, a portion of a carry lookahead adder for the terms S and T is implemented in early p&amp;g module  210  and product bit module  214 , in order to obtain the msb bit, the carry-in bits K and N, and the values of bit L and bit G for either value of the msb bit, i.e., 0 or 1. These bits are also termed herein respectively j, u, v, and f, where: j represents the most significant bit of the product; u represents the least significant bit of the product when the msb bits is 1, i.e., bit L when the msb bit is 1; v represents the guard bit value when the msb bit is 1, i.e., bit G, and also the least significant bit of the product when the msb bit is 0, i.e., bit L when the msb bit is 0; f represents the guard bit when the msb bit is 0, i.e., bit G when the msb bit is 0. The bits j, u, v, and f for products having an msb of 1 and 0 are illustrated in Example 8 for msb of 1 and msb of 0. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 8 
       [0070]    If more than one precision is to be determined, then each of the bits j, u, v, and f, is obtained for each precision. 
         [0071]    With the values of j, u, v and f, and the value of the sticky bit, the sign of the product, the rounding mode, the value of bits R and M, the rounding bits, are obtained in accordance with the IEEE standard for Binary Bloating-Point Arithmetic (ANSI/IEEE STD 754-1985). 
         [0072]    An example of a table for obtaining the value of bits R and M in accordance with the above IEEE standard is shown in Table 1 (an asterisk * means the value can be either 0 or 1 in Table 1). 
         [0000]    
       
         
               
               
               
               
               
               
               
             
           
               
                   
                 TABLE 1 
               
               
                   
                   
               
               
                   
                 juvf 
                 sticky bit 
                 sign 
                 rounding mode 
                 R 
                 M 
               
               
                   
                   
               
             
             
               
                   
                 **** 
                 * 
                 * 
                 truncate 
                 0 
                 0 
               
               
                   
                 1*0* 
                 * 
                 * 
                 nearest 
                 0 
                 * 
               
               
                   
                 1010 
                 0 
                 * 
                 nearest 
                 0 
                 * 
               
               
                   
                 1110 
                 0 
                 * 
                 nearest 
                 1 
                 * 
               
               
                   
                 1*10 
                 1 
                 * 
                 nearest 
                 1 
                 * 
               
               
                   
                 1*11 
                 * 
                 * 
                 nearest 
                 1 
                 * 
               
               
                   
                 1*00 
                 0 
                 0 
                 plus infinity 
                 0 
                 * 
               
               
                   
                 1*00 
                 1 
                 0 
                 plus infinity 
                 1 
                 * 
               
               
                   
                 1*01 
                 * 
                 0 
                 plus infinity 
                 1 
                 * 
               
               
                   
                 1*1* 
                 * 
                 0 
                 plus infinity  
                 1 
                 * 
               
               
                   
                 1*** 
                 * 
                 1 
                 plus infinity  
                 0 
                 * 
               
               
                   
                 1*00 
                 0 
                 1 
                 minus infinity 
                 0 
                 * 
               
               
                   
                 1*00 
                 1 
                 1 
                 minus infinity 
                 1 
                 * 
               
               
                   
                 1*01 
                 * 
                 1 
                 minus infinity 
                 1 
                 * 
               
               
                   
                 1*1* 
                 * 
                 1 
                 minus infinity 
                 1 
                 * 
               
               
                   
                 1*** 
                 * 
                 0 
                 minus infinity 
                 0 
                 * 
               
               
                   
                 0**0 
                 * 
                 * 
                 nearest 
                 * 
                 0 
               
               
                   
                 0*01 
                 0 
                 * 
                 nearest 
                 * 
                 0 
               
               
                   
                 0*11 
                 0 
                 * 
                 nearest 
                 * 
                 1 
               
               
                   
                 0**1 
                 1 
                 * 
                 nearest 
                 * 
                 1 
               
               
                   
                 0**0 
                 0 
                 0 
                 plus infinity 
                 * 
                 0 
               
               
                   
                 0**0 
                 1 
                 0 
                 plus infinity 
                 * 
                 1 
               
               
                   
                 0**1 
                 * 
                 0 
                 plus infinity 
                 * 
                 1 
               
               
                   
                 0*** 
                 * 
                 1 
                 plus infinity 
                 * 
                 0 
               
               
                   
                 0**0 
                 0 
                 1 
                 minus infinity 
                 * 
                 0 
               
               
                   
                 0**0 
                 1 
                 1 
                 minus infinity 
                 * 
                 1 
               
               
                   
                 0**1 
                 * 
                 1 
                 minus infinity 
                 * 
                 1 
               
               
                   
                 0*** 
                 * 
                 0 
                 minus infinity 
                 * 
                 0 
               
               
                   
                   
               
             
          
         
       
     
         [0073]    In one embodiment, the process of finding the values of j, u, v, and f begins as soon as part of the values of terms S and T are known. Thus, in one embodiment, the values of K, N, j, u, v, and f are determined in parallel with the operations of full adders module  206  and half adders module  208 , which are determining the values X and Y, and also in parallel with the early portion of the addition of values X and Y in carry look-ahead adders  218 ,  220 , and  222 . Additionally, in one embodiment, the process of finding the correct sum of the product begins before the value of bits R and M are known. 
         [0074]    In one embodiment, as further described herein, in order to determine the correct sum from carry-look-ahead adders  218 ,  220 , and  222 , the msb bits W and Z, as well as the K bit, N bit, R bit, and M bit are computed in rounding and speculation module  216  while full adders module  206 , half adders module  208 , and carry-look-ahead adders  218 ,  220 , and  222 , are in progress. 
         [0075]    Example 9 shows truncated term S and truncated term T and the aligned C term prior to combination in full adders module  206 . The arrow indicates the least significant possible non-zero carry out (lspc) bit. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 9 
       [0076]    The resultant sum output and the carry output from full adders module  206  are shown in Example 10. The arrow indicates the least significant possible non-zero carry out (lspc) bit. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 10 
       [0077]    In one embodiment, to avoid too large a carry from where the extra bits are added in, a row of half adders, half adders module  208  is inserted after full adders module  206  and before the values, later termed herein X and Y, are passed to carry look ahead adders  218 ,  220 , and  222 . Half adders are well known to those of skill in the art and not further described herein to avoid detracting from the principles of the invention. Further a sum output and a carry output from a full adder are well known to those of skill in the art and are not further described herein to avoid detracting from the principles of the invention. 
         [0078]    The sum output, SumOut, and the carry output, CarryOut, of full adders module  206  are then output from full adders module  206  (for example, respectively at outputs  206 _ 4  and  206 _ 5 , not shown) and input to a half adders module  208  (for example, respectively, at inputs  208 _ 1  and  208 _ 2 , not shown) with resultant terms X and Y calculated as shown in Example 11. Where X represents the sum output and Y represents the carry output from half adders module  208 , respectively at outputs  208 _ 3  and  208 _ 4 . The arrow indicates the least significant possible non-zero carry out (lspc) bit. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 11 
       [0079]    Note that the position of the least significant possible non-zero carry-out (lspc) bit, indicated with an “↑” in Examples 9, 10 and 11, shifts to the left one bit after processing by full adders module  206  and another bit after processing by half adders module  208 . 
         [0080]    As shown in  FIG. 2 , in the present embodiment, the row of half adders, i.e., half adders module  208 , eliminates a carry out value of 2, resulting in a carry out value of at most 1, from each of the carry look-ahead adder sections  218  and  220  due to the addition of the extra bits K and R, or W, Z, N, and M, as further described herein. 
         [0081]    In one embodiment, the sum output, X, and the carry output, Y are obtained and output from half adders module  208 , for example, respectively at outputs  208 _ 3  and  208 _ 4 , and input in sections to respective carry-look-ahead adders  218 ,  220 , and  222 . In one embodiment, the terms X and Y output from half adders module  208  are divided into three sections as shown in  FIG. 2  in order to provide both double and single precision results. 
         [0082]    In Example 12, the terms X and Y are divided into two sections where the numbers over the terms X and Y, i.e., 2 and 1, indicate the respective section, i.e., section  2  and section  1 . In one embodiment, section  1  corresponds to the least significant bit sections of terms X and Y, and section  2  corresponds to the most significant bit sections of terms X and Y. If more than one precision is possible, in one embodiment, more than two sections can be used, as for example in  FIG. 2  in which three sections are used because both single and double precision are provided for. 
         [0000]    
       
                 
         
             
             
         
       
     
       Example 12 
       [0083]    Thus, in one embodiment, the respective portions of terms X and Y identified for section  1  are input to carry look-ahead adder  218 ; the respective portions of the sum output and the carry output identified for section  2  are input to carry look-ahead adder  220 ; and the sum output and the carry output identified for section  3  are input to carry look-ahead adder  222 . The carry-look-ahead adders  218 ,  220 , and  222 , each sum a respective section independently, for both a carry-in value of 0 and a carry-in value of 1. 
         [0084]    Thus, for example, section  1  bits of term Y output from half adders module  208  at output  208 _ 4  are input to CLA  218  at input  218 _ 1 . 
         [0085]    Section  2  bits of term Y output from half adders module  208  at output  208 _ 4  are input to CLA  220  at input  220 _ 1 . Section  3  bits of term Y output from half adders module  208  at output  208 _ 4  are input to CLA  222  at input  222 _ 1 . 
         [0086]    Further, section  1  bits of term X output from half adders module  208  at output  208 _ 3  are input to CLA  218  at input  218 _ 2 . Section  2  bits of term X output from half adders module  208  at output  208 _ 3  are input to CLA adder  220  at input  220 _ 2 . Section  3  bits of term X output from half adders module  208  at output  208 _ 4  are input to CLA  222  at input  222 _ 2 . 
         [0087]    First, the msb of the output of section  1 , e.g., the msb output of mux  226 , corresponding to a carry-in of 0 to mux select  226 _ 3  is the carry-in to be used for section  2 , e.g., CLA  220 , by being the mux select input  228 _ 3  to mux  228 . The msb of the output of section  2 , e.g., the msb output of mux  228  is the carry-in to be used for section  3 , e.g., CLA  222 , by being the mux select input  230 _ 3  to mux  230 . The msb of the output of section  3 , e.g., the msb output of mux  230  is the carry-in to be used for the last section, e.g., incrementer  224 , by being the mux select input  232 _ 3  to mux  232 . Note that the last section utilizes an incrementer, e.g., increment module  224  is not a full addition. Increment module  224  increments; if an unincremented value is needed, e.g., if the msb output of mux  230  is zero, then the unincremented value from alignment module  202  is selected by mux  232 . 
         [0088]    In one embodiment, the msb output of the last section, e.g., the msb output of mux  232 , is herein termed value E, the end around carry. If the computation is addition, E=0. However, if the computation is subtraction, E=1 indicates that |A*B|&gt;|C|, and (A*B)+˜C+1 is computed. Alternatively, if the computation is subtraction, E=0 indicates that |A*B|&lt;|C|, and thus ˜((A*B)+C) is computed. 
         [0089]    Thus, each section is viewed again. This time, the carry-in chosen for section  1  is the value of E. This provides the proposed output for the bits in section  1  except that the three high order bits of the section may yet need K and R, or N, M, W, and Z, to be added in if a double precision result is required. If a single precision result is required, no bits are added in for section  1 , but the three high order bits of section  2  may yet need K and R, or N, M, W, and Z to be added in. 
         [0090]    Thus, while the operations of full adders  206 , half adders module  208 , and most of the operations of CLAs  218 ,  220  and  222  are being performed, the possible sums for the high order 3 replacement bits are obtained for the precision needed. The 3 high order replacement bits are the three msb bits of the section with K and R, or N, M, W, and Z added in. In one embodiment, the replacement values are calculated by rounding and speculation module  216 . The replacement carry out bit is the carry out of the section after K and R, or N, M, W, and Z added in. Once the carry-in to the three high order positions, which is the carry out of the previous section, are known for the appropriate value of E, then those three high order bits, are replaced with the correct values, i.e., the replacement values, and their replacement carry-out is then used for the carry-in of the next section, i.e., the next section is section  2  for double precision and is section  3  for single precision. 
         [0091]    In order to compute the replacement values for the msb of a carry look-ahead adder section, that is, modules  218  and  220 , in one embodiment, computations are performed in rounding and speculation module  216  as shown in Examples 13-26. These examples are for a double precision result where positions  62  is the lsb double precision replacement position,  63  is the middle double precision replacement position,  64  is the msb double precision replacement position, and  65  is the double precision replacement carry-out position. Position  61  is the position to the right of position  62 . Thus, result [64:62] are the double precision replacement values and result [65] is the double precision replacement carry-out value. These positions place the lsb of the double precision value for A*B in column  10 , embedded within a 64×64 integer multiply array. The corresponding single precision positions would be result [93:91] for the single precision replacement values and result [94] would be the single precision replacement carry-out value. 
         [0092]    In Examples 13-26, sum [63:61] is the value of carry save adder  218  output  218 _ 4  in columns  61 ,  62 , and  63 ; carry [63:61] is the value of carry save adder  218  output  218 _ 3  in columns  61 ,  62 , and  63 ; and G represents the carry-in value to position  61  using inputs before full adders  206  and half adders  208 . 
         [0093]    For msb=0 and G=0 and R=0 and no carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               AND 
                
               
                 
                     
                 
                  
                 
                     
                 
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             c 
             , 
             
               b 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             f 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 62 
                 ] 
               
             
             = 
             
               a 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               b 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   b 
                 
                 ) 
               
                
               XOR 
                
               
                   
               
                
               c 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               d 
             
           
         
       
       
         
           
             g 
             = 
             
               
                 ( 
                 
                   c 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   d 
                 
                 ) 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   b 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   
                     ( 
                     
                       c 
                        
                       
                           
                       
                        
                       OR 
                        
                       
                           
                       
                        
                       d 
                     
                     ) 
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
               + 
               h 
             
           
         
       
     
       Example 13 
       [0094]    For msb=0 and G=1 and R=0 and no carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               OR 
                
               
                 
                     
                 
                  
                 
                     
                 
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             c 
             , 
             
               b 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             f 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 62 
                 ] 
               
             
             = 
             
               a 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               b 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   b 
                 
                 ) 
               
                
               XOR 
                
               
                   
               
                
               c 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               d 
             
           
         
       
       
         
           
             g 
             = 
             
               
                 ( 
                 
                   c 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   d 
                 
                 ) 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   b 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   
                     ( 
                     
                       c 
                        
                       
                           
                       
                        
                       OR 
                        
                       
                           
                       
                        
                       d 
                     
                     ) 
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
               + 
               h 
             
           
         
       
     
       Example 14 
       [0095]    For msb=0 and G=0 and R=1 and no carry-in and for msb=0 and G=0 and R=0 and carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               AND 
                
               
                 
                     
                 
                  
                 
                     
                 
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             c 
             , 
             
               b 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             f 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 62 
                 ] 
               
             
             = 
             
               a 
                
               
                   
               
                
               XNOR 
                
               
                   
               
                
               b 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                 
                 ) 
               
                
               XOR 
                
               
                   
               
                
               c 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               d 
             
           
         
       
       
         
           
             g 
             = 
             
               
                 ( 
                 
                   c 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   d 
                 
                 ) 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   
                     ( 
                     
                       c 
                        
                       
                           
                       
                        
                       OR 
                        
                       
                           
                       
                        
                       d 
                     
                     ) 
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
               + 
               h 
             
           
         
       
     
       Example 15 
       [0096]    For msb=0 and G=1 and R=1 and no carry-in and for msb=0 and G=1 and R=0 and carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             c 
             , 
             
               b 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             f 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 62 
                 ] 
               
             
             = 
             
               a 
                
               
                   
               
                
               XNOR 
                
               
                   
               
                
               b 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                 
                 ) 
               
                
               XOR 
                
               
                   
               
                
               c 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               d 
             
           
         
       
       
         
           
             g 
             = 
             
               
                 ( 
                 
                   c 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   d 
                 
                 ) 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 ( 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   
                     ( 
                     
                       c 
                        
                       
                           
                       
                        
                       OR 
                        
                       
                           
                       
                        
                       d 
                     
                     ) 
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
               + 
               h 
             
           
         
       
     
       Example 16 
       [0097]    For msb=1 and G=0 and R=0 and no carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             b 
             = 
             
               ( 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                  
                 
                     
                 
                  
                 AND 
                  
                 
                     
                 
                  
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
               ) 
             
           
         
       
       
         
           
             c 
             = 
             
               a 
                
               
                   
               
                
               OR 
                
               
                   
               
                
               b 
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     C 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
               
             
           
         
       
       
         
           
             g 
             , 
             
               
                 result 
                  
                 
                   [ 
                   63 
                   ] 
                 
               
               = 
               
                 c 
                 + 
                 d 
               
             
           
         
       
       
         
           
             h 
             = 
             
               
                 e 
                  
                 
                     
                 
                  
                 XOR 
                  
                 
                     
                 
                  
                 f 
                  
                 
                   
 
                 
                  
                 
                   result 
                    
                   
                     [ 
                     
                       65 
                        
                       
                         : 
                       
                        
                       64 
                     
                     ] 
                   
                 
               
               = 
               
                 g 
                 + 
                 h 
               
             
           
         
       
     
       Example 17 
       [0098]    For msb=1 and G=1 and R=0 and no carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             
               b 
               = 
               
                 
                   
                     ( 
                     
                       
                         sum 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                        
                       
                           
                       
                        
                       AND 
                        
                       
                           
                       
                        
                       
                         carry 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                     
                     ) 
                   
                    
                   
                     
 
                   
                    
                   c 
                 
                 = 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                     
 
                   
                    
                   e 
                 
               
             
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     g 
                   
                 
               
             
             , 
             
               
                 result 
                  
                 
                   [ 
                   63 
                   ] 
                 
               
               = 
               
                 
                   c 
                   + 
                   
                     d 
                      
                     
                       
 
                     
                      
                     h 
                   
                 
                 = 
                 
                   
                     e 
                      
                     
                         
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     f 
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         
                           65 
                            
                           
                             : 
                           
                            
                           64 
                         
                         ] 
                       
                     
                   
                   = 
                   
                     g 
                     + 
                     h 
                   
                 
               
             
           
         
       
     
       Example 18 
       [0099]    For msb=1 and G=0 and R=1 and no carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             b 
             = 
             
               ( 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                  
                 
                     
                 
                  
                 AND 
                  
                 
                     
                 
                  
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
               ) 
             
           
         
       
       
         
           
             c 
             = 
             
               a 
                
               
                   
               
                
               OR 
                
               
                   
               
                
               b 
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     C 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
               
             
           
         
       
       
         
           
             g 
             , 
             
               
                 result 
                  
                 
                   [ 
                   63 
                   ] 
                 
               
               = 
               
                 c 
                 + 
                 d 
                 + 
                 1 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 64 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               h 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 65 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
                
               AND 
                
               
                   
               
                
               h 
             
           
         
       
     
       Example 19 
       [0100]    For msb=1 and G=1 and R=1 and no carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             
               b 
               = 
               
                 
                   
                     ( 
                     
                       
                         sum 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                        
                       
                           
                       
                        
                       AND 
                        
                       
                           
                       
                        
                       
                         carry 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                     
                     ) 
                   
                    
                   
                     
 
                   
                    
                   c 
                 
                 = 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                     
 
                   
                    
                   e 
                 
               
             
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     g 
                   
                 
               
             
             , 
             
               
                 result 
                  
                 
                   [ 
                   63 
                   ] 
                 
               
               = 
               
                 c 
                 + 
                 d 
                 + 
                 1 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 64 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               h 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 65 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
                
               AND 
                
               
                   
               
                
               h 
             
           
         
       
     
       Example 20 
       [0101]    For msb=0 and G=0 and R=1 and carry in 
         [0000]    
       
         
           
             c 
             , 
             
               b 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                     
                 
                  
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                  
                 
                     
                 
                 + 
                 
                   ( 
                   
                     
                       sum 
                        
                       
                         [ 
                         61 
                         ] 
                       
                     
                      
                     
                         
                     
                      
                     AND 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         61 
                         ] 
                       
                     
                   
                   ) 
                 
               
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                  
                 
                     
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             f 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             m 
             , 
             
               
                 result 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
               = 
               
                 b 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             g 
             , 
             
               n 
               = 
               
                 c 
                 + 
                 d 
                 + 
                 1 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               m 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               n 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 64 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               h 
                
               
                   
               
                
               
                 XOR 
                  
                 
                   ( 
                   
                     m 
                      
                     
                         
                     
                      
                     AND 
                      
                     
                         
                     
                      
                     n 
                   
                   ) 
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 65 
                 ] 
               
             
             = 
             
               
                 ( 
                 
                   g 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   h 
                 
                 ) 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 ( 
                 
                   
                     ( 
                     
                       g 
                        
                       
                           
                       
                        
                       OR 
                        
                       
                           
                       
                        
                       h 
                     
                     ) 
                   
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   m 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   n 
                 
                 ) 
               
             
           
         
       
     
       Example 21 
       [0102]    For msb=0 and G=1 and R=1 and carry-in 
         [0000]    
       
         
           
             c 
             , 
             
               b 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                 + 
                 
                     
                 
                  
                 
                   carry 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
                  
                 
                     
                 
                 + 
                 
                   ( 
                   
                     
                       sum 
                        
                       
                         [ 
                         61 
                         ] 
                       
                     
                      
                     
                         
                     
                      
                     OR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         61 
                         ] 
                       
                     
                   
                   ) 
                 
               
             
           
         
       
       
         
           
             e 
             , 
             
               d 
               = 
               
                 
                   sum 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                  
                 
                     
                 
                 + 
                 
                   carry 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
                 + 
                 
                   C 
                    
                   
                     [ 
                     63 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             f 
             = 
             
               
                 sum 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
                
               XOR 
                
               
                   
               
                
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             m 
             , 
             
               
                 result 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
               = 
               
                 b 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             g 
             , 
             
               n 
               = 
               
                 c 
                 + 
                 d 
                 + 
                 1 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               m 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               n 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 64 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               h 
                
               
                   
               
                
               
                 XOR 
                  
                 
                   ( 
                   
                     m 
                      
                     
                         
                     
                      
                     AND 
                      
                     
                         
                     
                      
                     n 
                   
                   ) 
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 65 
                 ] 
               
             
             = 
             
               
                 ( 
                 
                   g 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   h 
                 
                 ) 
               
                
               
                   
               
                
               OR 
                
               
                   
               
                
               
                 ( 
                 
                   
                     ( 
                     
                       g 
                        
                       
                           
                       
                        
                       OR 
                        
                       
                           
                       
                        
                       h 
                     
                     ) 
                   
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   m 
                    
                   
                       
                   
                    
                   AND 
                    
                   
                       
                   
                    
                   n 
                 
                 ) 
               
             
           
         
       
     
       Example 22 
       [0103]    For msb=1 and G=0 and R=0 and carry in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             
               b 
               = 
               
                 
                   
                     ( 
                     
                       
                         sum 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                        
                       
                           
                       
                        
                       AND 
                        
                       
                           
                       
                        
                       
                         carry 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                     
                     ) 
                   
                    
                   
                     
 
                   
                    
                   c 
                 
                 = 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                     
 
                   
                    
                   e 
                 
               
             
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     NOT 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             g 
             , 
             
               
                 result 
                  
                 
                   [ 
                   63 
                   ] 
                 
               
               = 
               
                 c 
                 + 
                 d 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
               + 
               h 
             
           
         
       
     
       Example 23 
       [0104]    For msb=1 and G=1 and R=0 and carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             
               b 
               = 
               
                 
                   
                     ( 
                     
                       
                         sum 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                        
                       
                           
                       
                        
                       AND 
                        
                       
                           
                       
                        
                       
                         carry 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                     
                     ) 
                   
                    
                   
                     
 
                   
                    
                   c 
                 
                 = 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                     
 
                   
                    
                   e 
                 
               
             
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     NOT 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               c 
               + 
               d 
               + 
               
                 C 
                  
                 
                   [ 
                   62 
                   ] 
                 
               
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
               + 
               
                   
               
                
               h 
             
           
         
       
     
       Example 24 
       [0105]    For msb=1 and G=0 and R=1 and carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 sum 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 carry 
                  
                 
                   [ 
                   61 
                   ] 
                 
               
             
           
         
       
       
         
           
             
               b 
               = 
               
                 
                   
                     ( 
                     
                       
                         sum 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                        
                       
                           
                       
                        
                       AND 
                        
                       
                           
                       
                        
                       
                         carry 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                     
                     ) 
                   
                    
                   
                     
 
                   
                    
                   c 
                 
                 = 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                     
 
                   
                    
                   e 
                 
               
             
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     NOT 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             g 
             , 
             
               p 
               = 
               
                 c 
                 + 
                 d 
                 + 
                 
                   C 
                    
                   
                     [ 
                     62 
                     ] 
                   
                 
               
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 63 
                 ] 
               
             
             = 
             
               NOT 
                
               
                 
                     
                 
                  
                 
                     
                 
               
                
               p 
             
           
         
       
       
         
           
             h 
             = 
             
               e 
                
               
                   
               
                
               XOR 
                
               
                   
               
                
               f 
             
           
         
       
       
         
           
             
               result 
                
               
                 [ 
                 
                   65 
                    
                   
                     : 
                   
                    
                   64 
                 
                 ] 
               
             
             = 
             
               g 
                
               
                   
               
               + 
               
                   
               
                
               h 
               + 
               p 
             
           
         
       
     
       Example 25 
       [0106]    For msb=1 and G=1 and R=1 and carry-in 
         [0000]    
       
         
           
             a 
             = 
             
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                     
                         
                     
                      
                     
                         
                     
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       62 
                       ] 
                     
                   
                 
                 ) 
               
                
               
                   
               
                
               AND 
                
               
                   
               
                
               
                 ( 
                 
                   
                     sum 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   
                     carry 
                      
                     
                       [ 
                       61 
                       ] 
                     
                   
                 
                 ) 
               
             
           
         
       
       
         
           
             
               b 
               = 
               
                 
                   
                     ( 
                     
                       
                         sum 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                        
                       
                           
                       
                        
                       AND 
                        
                       
                           
                       
                        
                       
                         carry 
                          
                         
                           [ 
                           62 
                           ] 
                         
                       
                     
                     ) 
                   
                    
                   
                     
 
                   
                    
                   c 
                 
                 = 
                 
                   a 
                    
                   
                       
                   
                    
                   OR 
                    
                   
                       
                   
                    
                   b 
                    
                   
                     
 
                   
                    
                   e 
                 
               
             
             , 
             
               d 
               = 
               
                 
                   
                     sum 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     carry 
                      
                     
                       [ 
                       63 
                       ] 
                     
                   
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     f 
                   
                 
                 = 
                 
                   
                     
                       sum 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       carry 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     XOR 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                   
                   = 
                   
                     NOT 
                      
                     
                         
                     
                      
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     g 
                   
                 
               
             
             , 
             
               p 
               = 
               
                 
                   c 
                   + 
                   d 
                   + 
                   
                     
                       C 
                        
                       
                         [ 
                         62 
                         ] 
                       
                     
                      
                     
                       
 
                     
                      
                     
                       result 
                        
                       
                         [ 
                         63 
                         ] 
                       
                     
                   
                 
                 = 
                 
                   NOT 
                    
                   
                       
                   
                    
                   p 
                 
               
             
           
         
       
       
         
           
             h 
             = 
             
               
                 e 
                  
                 
                     
                 
                  
                 XOR 
                  
                 
                     
                 
                  
                 f 
                  
                 
                   
 
                 
                  
                 
                   result 
                    
                   
                     [ 
                     
                       65 
                        
                       
                         : 
                       
                        
                       64 
                     
                     ] 
                   
                 
               
               = 
               
                 g 
                  
                 
                     
                 
                 + 
                 
                     
                 
                  
                 h 
                 + 
                 p 
               
             
           
         
       
     
       Example 26 
       [0107]    The replacement bit values generated in rounding and speculation module  216  are output, for example at outputs  216 _ 8  and  216 _ 9  (for single precision), or  216 _ 10  and  216 _ 11  (for double precision). 
         [0108]    A sum for a carry in of 0 and a sum for a carry in of 1 are generated and output from CLA  222  at outputs  222 _ 3  and  222 _ 4 ; these sums are input to mux  230  at inputs  230 _ 1  and  230 _ 2 . A sum for a carry in of 0 and a sum for a carry in of 1 are generated and output from CLA  220  at outputs  220 _ 3  and  220 _ 4 ; these sums and together with the replacement bits from rounding and speculation module  216  (for unfused rounding single precision only) are input to mux  228  at inputs  228 _ 1  and  228 _ 2 . A sum for a carry in of 0 and a sum for a carry in of 1 generated and output from CLA  218  at outputs  218 _ 3  and  281 _ 4 ; these sums together with the replacement bits from rounding and speculation module  216  (for unfused rounding double precision only) are input to mux  226  at inputs  226 _ 1  and  226 _ 2 . The carry-out from mux module  230  is used to select the incremented or unincremented value in mux  232 . 
         [0109]    The selected sums of each muxs  226 ,  228 ,  230  and  232  are input to normalizer  240 . For example, in one embodiment, the selected sum generated and output from mux  226  at output  226 _ 4  is input to normalizer  240  at input  240 _ 4 . The selected sum generated and output from mux  228  at output  228 _ 4  is input to normalizer  240  at input  240 _ 3 . The selected sum generated and output from mux  230  at output  230 _ 4  is input to normalizer  240  at input  240 _ 4 . The selected value output from mux  232  at output  232 _ 4  is input to normalizer  240  at input  240 _ 1 . 
         [0110]    Normalizer  240  normalizes the input values, and generates a normalized sum which is the normalized sum of operand C and the rounded value of the product of operand A and operand B. The normalized sum is generated and output from normalizer  240  at output  240 _ 5  and input to rounding module  250  at input  250 _ 1 . 
         [0111]    Rounding module  250  rounds the normalized sum to generate the output unfused multiply-add result. The unfused multiply-add result is output from rounding module  250  at output  250 _ 2  and can be further output from fused-unfused FMA module  200  at an output  200 _ 4 . 
         [0112]    Fused Multiply-Add Rounding Mode 
         [0113]    Alternatively, in fused multiply-add rounding mode, in one embodiment, operand C is input to alignment module  202 , and operand A and operand B are input to carry save adder (CSA)  204 . In CSA  204 , the partial products of operand A and operand B are formed and summed to produce two terms, term S and term T. Early p&amp;g module  210 , sticky bit module  212 , product bit module  214 , and rounding and speculation module  216  are not used for fused multiply-add rounding. Term S and term T, if added together, would form the product of A*B. While the computations of CSA  204  are being carried out, operand C is aligned in alignment module  202  to align the binary point of C with the position of the binary point for the product A*B. Binary points and the alignment of floating point numbers are terms well known to those of skill in the art and not further described in detail herein to avoid detracting from the principles of the invention. 
         [0114]    If subtraction is needed, instead of addition, for example, operands A and B are positive and operand C is negative, or as another example, operands A, B, and C are all positive and (A*B)−C is requested, then the aligned C is complemented. Herein the term aligned C is used whether or not C has been complemented. 
         [0115]    Terms S and T are not truncated. Terms S, T and the aligned C term are then input to full adders  206  where the aligned C term is summed with the terms S and T to produce two terms, X and Y. The terms X and Y are then input to half adders module  208  resulting in terms X′ and Y′, which are the sum output and the carry output of module  208 , respectively. The terms X′ and Y′ are then input to carry look-ahead adder modules  218 ,  220 , and  222  that calculate the sum of (A*B)+C for a carry-in of 1 and for a carry-in of 0. The carry-out of CLA modules  218 ,  220 , and  222  is used to select the incremented or unincremented value in mux  232 . This result is the end around carry for a sum that is negative. No replacement values are used. The result sum is normalized in normalizer  240  and then rounded in rounding module  250 . 
         [0116]    In subtraction, if the absolute value of (A*B) is greater than the absolute value of C, then (A*B)+˜C+1 is computed. Alternatively, if the absolute value of (A*B) is less than the absolute value of C, then ˜((A*B)+˜C) is computed. 
         [0117]      FIG. 3  illustrates a computer system  300  having a computer processor including the single fused-unfused floating point multiply-add (FMA) module  200  of  FIG. 2  in accordance with one embodiment of the invention. In  FIG. 3 , host computer system  300 , sometimes called a client or user device, typically includes a central processing unit (CPU)  302 , hereinafter processor  302 , an input/output (I/O) interface  308 , a memory  306 , and an operating system  304 . 
         [0118]    Host computer system  300  may further include standard devices like a keyboard  310 , a mouse  314 , a printer  212 , and a display device  316 , as well as, one or more standard input/output (I/O) devices  316 , such as a compact disk (CD) or DVD drive, floppy disk drive, or other digital or waveform port for inputting data to and outputting data from host computer system  300 . In one embodiment, computer processor  302  performs one or more operations on input floating point operands initiated by one or more opcodes generated during the processing of computer code being executed on computer system  300 . 
         [0119]    In one embodiment, a single opcode, herein termed an unfused multiply-add rounding opcode, input to computer processor  302  is used to initiate an unfused multiply-add rounding operation by single fused-unfused FMA module  200  with the generation of an unfused multiply-add rounding result as earlier described herein with reference to  FIG. 2 . In one embodiment, a different single opcode, herein termed a fused multiply-add rounding opcode, input to computer processor  302  is used to initiate a fused multiply-add rounding multiply-add operation by single fused-unfused FMA module  200  with the generation of a fused multiply-add rounding result as earlier described herein with reference to  FIG. 2 . 
         [0120]    In another embodiment, a single opcode with a deterministic mode bit is input to computer processor  302  to indicate generation of a fused multiply-add rounding result or an unfused multiply-add rounding result. If the mode bit is set a first way, e.g., set to one, a fused multiply-add rounding result is generated, and if the mode bit is set a second way, e.g., set to zero, an unfused multiply-add rounding result is generated. 
         [0121]    This disclosure provides exemplary embodiments. The scope of the various embodiments described herein is not limited by these exemplary embodiments. Numerous variations, whether explicitly provided for by the specification or implied by the specification or not, may be implemented by one of skill in the art in view of this disclosure.

Technology Category: g