Abstract:
Disclosed is a signed multiplier for use in a data processing system that handles 2&#39;s complement operands. The signed multiplier operates to form a preliminary product independently of the signs of the multiplier and multiplicand. While the multiplication is in progress, the signs of the multiplier and multiplicand are checked. For multiplications where either one of the operands (multiplier or multiplicand) is negative, the preliminary product is modified by one or two correction factors. The correction factors are multiplies of the 2&#39;s complements of the operands. The correction factor or factors are added to the preliminary product to form the final product.

Description:
CONTINUATION DATA 
     The present invention is a continuation of U.S. patent application entitled SIGNED MULTIPLIER, Ser. No. 06/526,106, filed Aug. 24, 1983, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     The present invention relates to multipliers for use in data processing systems. 
     Low performance computers frequently perform multiplication by a sequence of additions using an adder. Such approach takes many cycles of operation and thus is slow. High performance computers cannot tolerate long routines for multiplication. Therefore, high performance data processing systems generally include special functional units and/or special high speed routines to handle multiplication. 
     In multiplication, multipliers and multiplicands can both be positive and negative. Frequently, 2&#39;s complement form is employed to accommodate negative numbers. There are many ways to design multipliers to handle 2&#39;s complement multipliers and multiplicands. In one approach, the signs of both operands (multiplier and multiplicand) can be checked prior to commencing the multiplication. Depending upon the signs of the operands, the appropriate multiplication routine is executed to give the correct, final product. While such a method is satisfactory for many applications, it has the detriment that the multiplication routine cannot commence until after the signs have been checked. Such a procedure always requires a delay before the multiplication commences and such delay is wasteful of processing time. In another approach, sign extension hardware is used which operates in parallel with other multiplication hardware thereby avoiding extra processing time. The sign extension hardware, however, has the detriment of adding extra cost and complexity to the computer. 
     In accordance with the above background, there is a need for an improved multiplier and method of multiplication in a data processing system which avoids the extra cost required with sign extension hardware and which avoids the delays required for sign checking prior to the time that multiplication begins. 
     In general, multipliers for high-performance systems must be able to multiply relatively large operands. For example, a typical multiplier should be large enough to multiply 32-bit signed operands to form a 64-bit signed product, and to multiply 56-bit unsigned operands to form 112-bit unsigned products. However, the physical size of the multiplier must be minimized, by taking advantage, for example, of hardware provided for other purposes. 
     SUMMARY OF THE INVENTION 
     The present invention is a signed multiplier for use in a data processing system that handles 2&#39;s complement operands. The signed multiplier operates to form a preliminary product independently of the signs of the multiplier and multiplicand. While the multiplication is in progress, the signs of the multiplier and multiplicand are checked. For multiplications where either one of the operands (multiplier or multiplicand) is negative, the preliminary product is modified by one or two correction factors. The correction factors are multiples of the 2&#39;s complement of the operands. The correction factor or factors are added to the preliminary product to form the final product. 
     In one particular embodiment of the present invention a three-port adder is employed to add simultaneously three terms as part of the multiplication. When both operands are negative, the three-port adder simultaneously adds two correction factors to the preliminary product in order to form the final product. 
     The present invention achieves the objective of providing an improved multiplier and method for multiplying which has improved speed of multiplication and which does not require sign extension hardware. 
     The foregoing and other objects, features and advantages of the invention will be apparent from the following detailed description set forth in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 depicts a block diagram of the signed multiplier of the present invention. 
     FIG. 2 depicts a dual microprogram control store which forms part of the FIG. 1 apparatus. 
     FIG. 3 depicts a block diagram of the operand processing unit of FIG. 1. 
     FIG. 4 depicts a detailed block diagram of the signed multiplier unit of FIG. 1. 
    
    
     DETAILED DESCRIPTION 
     Signed Multiplier--FIG. 1 
     In FIG. 1, a signed multiplier for use in a data processing system is shown. The signed multiplier includes the operand processing unit 2, the multiplier unit 3 and a control unit 4. The control unit 4 can be any conventional control unit for controlling operations of hardware in a data processing system. Typically, control unit 4 is a microprogram unit which operates to control multiplication by microprogram routines. In FIG. 1, the operands to be multiplied are supplied by the operand processing unit 2 to the multiplier unit 3. In one embodiment described, the multiplier unit 3 includes a high-speed multiplier 5 and a three-port adder 6. 
     Control Unit--FIG. 2 
     In FIG. 2, the control unit 4 of FIG. 1 is shown. Typically unit 4 has two or more control stores including the E CONTROL STORE A (ECSA) 21 and the E CONTROL STORE B (ECSB) 22. The control stores 21 and 22 each store microinstructions and are initiated and controlled by a common control 20. Microinstructions are selected by a common output 23 for controlling units in a data processing system. The units 24 and 25 in FIG. 2 are typical units and, for example, can be the processing unit 2 and the multiplying unit 3 of FIG. 1. The control unit of FIG. 2, in one typical embodiment, is like that described in the application entitled, MULTIPLE MODULE CONTROL STORE FOR USE IN A DATA PROCESSING SYSTEM, Ser. No. 184,126, filed on Sept. 4, 1980, now abandoned in favor of continuation application Ser. No. 06/655,949, filed on Sept. 28, 1984, now U.S. Pat. No. 4,587,611 and assigned to the assignee of the present invention. 
     In FIG. 2, the A control store 21 provides microinstruction control words on bus 51 to the common output 23. Similarly, the B control store 22 provides microinstruction control words on bus 52 to the common output 23. The common output 23 selects a control word from either bus 51 or from bus 52 for controlling the units 24 and 25. The A control store 21 and the B control store 22 each provide control words on buses 51 and 52 for each machine cycle. 
     Each cycle, the A control store 21 also provides a branch address on bus 35 to the B control store 22. Similarly, each cycle, the B control store 22 provides a branch address on bus 45 to the A control store 21. Each cycle, the common control 20 determines for both the A and B control stores 21 and 22 whether the branch address from the other control store or the sequential address is to be selected. The sequential address is the address of the next instruction in sequence. The common control 20 receives on lines 59 an indication from the common output 23 whether or not a branch is specified by the current control word. Common control 20 senses via lines 18 and 19 the state of branch conditions within the controlled units 24 and 25 and decides whether or not any branch is to be taken. The common control 20, via lines 17, controls the common output 23 to select the microinstruction control word from the A or B control stores 21 or 22. This selected control word controls the state of the units 24 and 25. 
     In one embodiment, the common control contains latches which control the signed multiplier (not shown) and these latches include SIGN1-TRIGGER, SIGN2-TRIGGER, and ZERO-TRIGGER. The outputs of these latches assist in the determination of whether or not a branch should be taken. Common output 23 sends signals along lines 59 to common control 20 to determine which, if any, of these latches should be tested. 
     Operand Processing Unit--FIG. 3 
     In FIG. 3, apparatus useful in carrying out a fixed-point multiply operation within a data processing system is shown. 
     In FIG. 3, four 32-bit operand word registers 101, 102, 103 and 104 are provided for storing operands which are to be processed in accordance with instructions from microprogram control stores. Registers 101 and 102 provide input to the operand word register selector 105 and registers 103 and 104 provide inputs to the operand word register selector 106. Selector 105 selects an input for the LUCKH selector 107 and selector 106 provides an input to the LUCKL selector 108. The LUCKH SIGN2 line from selector 107 indicates the sign of the operand 2 selected by the selector 107. The LUCKL SIGN1 line from selector 108 indicates the sign of the operand 1 selected by the selector 108. Selectors 107 and 108 select the operands to provide inputs to the LUCK unit 109, to the A register (AR) 110 and to the B register (BR) 111. Both the AR and BR are 32 bits wide. 
     In FIG. 3, operands 1 and 2 from the selectors 108 and 107 are operated upon by unit 109 which performs logical, compare, compact, expand, and status operations. While such operations are conventional, they are not all required for the particular example being described. For the purpose of the present invention, unit 109 detects whether or not either the operand 1 from the LUCKL selector 108 or the operand 2 from the LUCKH selector 107 is equal to ZERO to provide a branch condition indication on the (LUCKH) v (LUCKL)=0 line 15. 
     In FIG. 3, a byte mover 112 selects one byte (8 bits) from the selectors 107 or 108 and moves it to appropriate locations in the data processing system. To perform additions, the byte adder 113 receives inputs from the selectors 107 and 108, shift amount register (SAR) 116, or the byte adder register (BAR) 117. The decrementor 115 is provided to decrement the contents of SAR register 116. None of the units of this paragraph except SAR are necessary for a signed multiply operation and hence can be ignored. The SAR register 116 is loaded with a shift amount to control shifter 134 and 135 of FIG. 4. 
     Multiply Unit--FIG. 4 
     In FIG. 4, selector 126 is provided for selecting the recoded copies of the operand from the AR register 110 and the BR register 111 from FIG. 3 under the control of the recode unit 140. The recoded copies of the operands are input to a carry-save adder tree 127. Outputs from the carry-save adder tree 127 are stored in a 64-bit SR register 128 and a 64-bit CR register 129. The output of the SR register 128 forms one input to a carry propagate adder (CPA) 130. The output from the CR register 129 provides a second input to the carry propagate adder 130. A shifter 134 shifts the contents of the result register 132/133 to form a third input to the carry propagate adder 130. In FIG. 4, the registers 128, 129, and 141, the recoder 140, the selector 126 and the CSA tree 127 constitute the multiplier 5 of FIG. 1. The multiplier works together with the 3-port adder and the other hardware shown in FIG. 4 to perform multiplications. The quotient register 136/137 is loaded by a quotient shifter 135. 
     The quotient shifter shifts inputs from the AR register 110 and the BR register 111 of FIG. 3, or from the quotient register 136/137. Hardware also exists in FIG. 4 to perform functions not related to multiplication. Various other control and data are indicated in connection with the FIG. 3 and FIG. 4 apparatus. Registers are represented by boxes with heavy bars at the top and such registers are clocked at the end of each machine cycle by a clock signal. 
     Description of the Multiplication Process 
     The basic hardware in FIGS. 3 and 4 includes a 56×8 bit multiplier 5, a 64-bit 3-port adder 130, a pair of registers (AR 110 and BR 111) to hold the multiplicand, a pair of registers (SR 128 and CR 129) to hold the output of the multiplier, a RR register (RRH 132 and RRL 133) to hold the partial product and the final result, and a QR register (QRH 136 and QRL 137) to hold the multiplier operand and the low-order part of a product that is longer than 64 bits. RR and QR also hold the adjustment terms if the operands are negative numbers. 
     The multiplier hardware uses the entire multiplicand (56 bits) along with the low-order 8 bits of the multiplier operand to form a 64-bit partial sum and a 64-bit partial carry which when added together form a partial product. While this operation is going on, QR is shifted 8 bits to the right so that the next 8 bits of the multiplier operand will be available for the next multiplication. 
     While the second multiplication is taking place, the partial sum and partial carry from the first multiplication are added together to form the first partial product. While the third multiplication is taking place, the partial product of the first multiplication is shifted to the right by 8 bits with the least significant 8 bits being shifted into QR and the remaining 56 bits being added together with the partial sum and partial carry of the second multiplication. This process continues until the partial sum and partial carry of the final multiplication are added together with the partial product of the previous multiplications. 
     In TABLE 1, a 56×56 unsigned multiplication is described. In TABLE 1 and TABLE 2, the symbol &#34;-:&#34; has the same meaning as the symbol &#34;-&gt;&#34; in TABLE 3 and they mean that the operand location on the right receives the data from the operand location on the left. 
     
                       TABLE 1______________________________________Steps to Perform Unsigned 56 × 56 Multiplication______________________________________1.  Multiplier -: AR(8:31) BR(0:31)    0 -: AR(0:7)2.  AR, BR -: QRSH -: QR    No shift    Multiplicand -: AR(0:31), BR(0:23)    0 -: RR3.  QR(56:63) -: IER    AR(0:31), BR(0:23) -: CAND                  Form first SUM, CARRY    Multiply Results -: SR, CR    QR -: QRSH -: QR    Shift right 84.  SR -: CPA1    CR -: CPA2         Form first partial product    RR -: RRSH -: CPA3    CPA -: RR    QR (56:63) -: IER    AR(0:31), BR(0:23) -: CAND                  Form second SUM, CARRY    Multiply Result -: SR, CR    QR -: QRSH -: QR    Shift right 85,6,7,8,9   Repeat (4) to form third to seventh SUM, CARRY   and second to sixth partial products.10. SR -: CPA1    CR -: CPA2         Final 112-bit product is    RR -: RRSH -: CPA3 in RR (0:63), QR (0:47)    CPA -: RR    Shift right 8    EXIT______________________________________ 
    
     Mathematics of Signed 32×32 Multiplication 
     Multiplication of signed numbers with negative numbers in 2&#39;s complement form consists of unsigned multiplication to form a preliminary product followed by an adjustment to form the final product. There are four cases C1, C2, C3 and C4 in which C2, C3 and C4 require adjustment. 
     C1. Multiplicand positive, multiplier positive (No adjustment) 
     C2. Multiplicand positive, multiplier negative 
     C3. Multiplicand negative, multiplier positive 
     C4. Multiplicand negative, multiplier negative 
     In 2&#39;s complement notation, the highest-order bit for negative numbers is &#34;1&#34; and that for positive numbers is &#34;0&#34;. For a 32-bit number, the positive numbers range from 0 to (2 31  -1). For a 32-bit number, the absolute value of the negative numbers range from 1 to (2 31 ). For 32-bit operands, a negative number (-Q), where Q is positive between 1 and 2 31 , is represented by the 2&#39;s complement notation [2 32  -Q]. If a negative number in 2&#39;s complement form, [2 32  -Q], is again 2&#39;s complemented, the positive value Q=2 32  -[2 32  -Q] is obtained. 
     C2. Adjustment for Multiplicand (OP1) Positive And Multiplier (OP2) Negative 
     Let the positive multiplicand equal [A]. Let the negative multiplier equal [2 32  -Q] where A and Q are greater than 0. The desired 64-bit final product is -(A)(Q) which in 2&#39;s complement notation is [2 64  -AQ]. 
     The preliminary product obtained from unsigned multiplication of the negative multiplier [2 32  -Q] and the positive multiplicand, A, is (2 32 )(A)-(A)(Q). 
     The adjustment which must be added to the preliminary product to form the final product is the quantity [2 64  -(2 32 )(A)] or (2 32 )[2 32  -A]. 
     This adjustment is achieved by adding the 2&#39;s complement, [2 32  -A], of the 32-bit operand A, in register AR, to the high-order bits 0:31 of the preliminary product in RR. 
     Since [2 32  -A] is added to the high-order bits, it is effectively multiplied by 2 32  so that the added value is the desired adjustment, (2 32 )[2 32  -A]. 
     C3. Adjustment for Multiplicand Negative, Multiplier Positive 
     Let the negative multiplicand equal [2 32  -A]. 
     Let the positive multiplier equal Q where A and Q are greater than 0. The desired product is [2 64  -(A)(Q)]. 
     The preliminary product obtained from unsigned multiplication is (2 32 )(Q)-(A)(Q). 
     The adjustment which must be added to the preliminary product to form the final product is the quantity [2 64  -(2 32 )(Q)] or (2 32 )[2 32  -Q]. 
     This adjustment is achieved by loading the 2&#39;s complement, [2 32  -Q], of Q into the low-order bits of register RR (32:63) at the start of the multiplication. At the same time, zero is loaded into the high-order bits of QR (0:31). As the multiplication proceeds, the 2&#39;s complement of Q, [2 32  -Q], shifts right until it ends up in the high-order bits of QR (0:31) thereby multiplying [2 32  -Q] by 2 32  and forming the adjustment [2 64  -(2 32 )Q] in register QR. At this time, zero is in the low-order bits QR (32:63). The adjustment is completed by adding the adjustment in QR to the preliminary product in RR. 
     C4. Adjustment for Multiplicand Negative, Multiplier Negative 
     Let the negative multiplicand equal [2 32  -A]. 
     Let the negative multiplier equal [2 32  -Q] where A and Q are greater than 0. The desired product is (A)(Q). 
     The product obtained from unsigned multiplication is [2 32  -A][2 32  -Q] or [2 64  -(2 32 )(A)]-(2 32 )(Q)+(AQ) The adjustment which must be added to the preliminary product to form the final product is the quantity (2 32 )(A)+(2 32 )(Q). 
     This adjustment is achieved by loading the 2&#39;s complement of [(2 32  -Q)], the multiplier, into RR (32:63) at the start of the multiplication. At the same time, zero is loaded into QR (0:31), and multiplicand [2 32  -A] is loaded into AR. As the multiplication proceeds, Q shifts right until it ends up in QR (0:31) thereby forming (2 32 )(Q). At this time, zero is in QR (32:63) and [2 32  -A] is still in Ar. The adjustment is completed by adding QR to RR and by subtracting [2 32  -A] in AR from RR (0:31). The subtraction is implemented by gating the 1&#39;s complement of [2 32  -A] in AR into the adder and adding +1 to form the 2&#39;s complement, +A. The 2&#39;s complement, +A, is added to the high-order bits RR (0:31) and hence is effectively (2 32 )(A). This adjustment is done in one step with the three-port adder. 
     The apparatus of FIGS. 3 and 4 is typically used to perform a high-speed multiply. In a fixed-point multiplication, the product of the multiplier (the second operand) and the multiplicand (the first operand) is found and replaces the original multiplicand. The multiplicand and the multiplier typically are x-bit operands and the product is a 2x-bit operand. The final product is formed in each case by adding one or two adjustment factors to an unsigned preliminary product. The adjustment for each negative operand is equal to 2 X  times the other operand. 
     A 32×32 fixed-point multiply operation is carried out in accordance with the microprogram summarized in the following TABLE 2. 
     
                       TABLE 2______________________________________Fixed Point Steps to Perform Signed 32 × 32 Multiply______________________________________$1. Multiplicand -: AR    Multiplier -: BR    Test for either operand to be zero    (This test allows for quick completion if the product    is zero.)$2. 0, BR -: QRSH -: QR    No shift    0 -: CPA1    0 -: CPA2H    BR --INV -: CPA2L    0 -: CPA3    1 -: Adder --Carry In (Bit 63)    CPA -: RR (Zero is in RR (0:31) if multiplier    nonzero)    0 -: BR    Branch to (8) if either operand is zero$3. QR (56:63) -: IER    AR (0:31), BR (0:23) -: CAND                  Form first SUM, CARRY    Multiply result -: SR, CR    QR -: QRSH -: QR    Shift right 8$4. SR -: CPA1    CR -: CPA2         Form first partial product    RR -: RRSH -: CPA3    CPA -: RR    QR (56:63) -: IER    AR (0:31), BR (0:23) -: CAND                  Form second SUM,                  CARRY    Multiply result -: SR, CR    QR -: QRSH -: QR    Shift right 8$5. SR -: CPA1    CR -: CPA2         Form second partial                  product    RR -: RRSH -: CPA3    CPA -: RR    QR (56:63) -: IER    AR (0:31), BR (0:23) -: CAND                  Form third SUM, CARRY    Multiply results -: SR, CR    QR -: QRSH -: QR    Shift right 8Branch to (10) if either operand negative$6. SR -: CPA1    CR -: CPA2         Form third partial product    RR -: RRSH -: CPA3    CPA -: RR    QR (56:63) -: IER    AR (0:31), BR (0:23) -: CAND                  Form fourth SUM,                  CARRY    Multiply result -: SR, CR    QR -: QRSH -: QR    Shift right 8$7. SR -: CPA1    CR -: CPA2         Form the final product    RR -: RRSH -: CPA3    CPA -: RR    Shift right 8    EXIT$8. 0 -: CPA1    0 -: CPA2    0 -: CPA3    CPA -: RR    EXIT$10.    SR -: CPA1    CR -: CPA2         Form third partial product    RR -: RRSH -: CPA3    CPA -: RR    QR (56:63) -: IER    AR (0:31), BR (0:23) -: CAND                  Form fourth SUM,                  CARRY    Multiply result -: SR, CR    QR -: QRSH -: QR    Shift right 8Branch to (15) if multiplier operand negative$11.    SR -: CPA1    CR -: CPA2         Form fourth partial product    RR -: RRSH -: CPA3    CPA -: RR    Shift right 8    Hold QR$12.    QR -: CPA1    0 -: CPA2          Adjust    RR -: CPA3    CPA -: RR    EXIT$15.    SR -: CPA1    CR -: CPA2         Form fourth partial                  product    RR -: RRSH -: CPA3    CPA -: RR    Shift right 8    Hold QRBranch to (18) if multiplicand negative$16.    0 -: CPA1    AR --INV -: CPA2H    All Ones -: CPA2L  Adjust    RR -: CPA3    1 -: Adder Carry In (Bit 63)    CPA -: RR    EXIT$18.    QR -: CPA1    AR --INV -: CPA2H    All Ones -: CPA2L  Adjust    RR -: CPA3    1 -: Adder Carry In (Bit 63)    CPA -: RR    EXIT______________________________________ 
    
     A detailed microprogram for implementing the TABLE 2 summary is set forth in the following TABLE 3. ##SPC1##