Abstract:
A subtractor for an N-bit digital number comprising N cascaded cells, each cell being adapted to effect subtraction by two&#39;s complement arithmetic and to provide a carry-out signal in accordance with the level of two bits being processed and a carry-in signal.

Description:
BACKGROUND OF THE INVENTION 
     This invention pertains generally to CMOS very large scale integrated (VLSI) circuits formed on semiconductor chips and particularly to a CMOS binary difference cell. 
     The most common method of performing a subtraction of two binary numbers (A-B) is to invert the subtrahend (B) and add it to the minuend (A) in a binary adder, the carry-in input being set to a logic level one. When the binary numbers being processed are N-bit numbers (where &#34;N&#34; is an integer greater than one), N+1 inverter and binary adder stages are required. Each inverter stage occupies space on the semiconductor chip, consumes power and slows operation. Furthermore, the complexity of the design of each binary adder stage is increased to be sure that the carry-in input is at a logic level one when subtraction is being carried out. Finally, it will be appreciated that the N+1 binary adder stage is required for subtraction utilizing two&#39;s complement arithmetic on two N-bit numbers to allow sign information of the difference to be provided. 
     SUMMARY OF THE INVENTION 
     With the foregoing background of the invention in mind, it is a primary object of this invention to provide a CMOS binary difference cell wherein an extra stage is not required to take care of a sign bit. 
     It is another object of this invention to provide a CMOS binary difference cell wherein the speed of subtraction of two binary numbers is increased. 
     The foregoing and other objects of this invention are generally attained by providing an N-stage subtractor, each stage being a CMOS binary cell that produces an output in two&#39;s complement form which represents the difference (A-B) where A is the minuend and B is the subtrahend of corresponding bits in two binary numbers being processed. Each binary cell operates on three inputs A i , B i  and X i  (where A i  and B i  are two binary digits and X i  is a borrow input signal) to provide a difference output, D i , and a borrow output, X i+1 , that, when N cells are combined, form an N-bit subtractor. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     For a more complete understanding of this invention, reference is now made to the following description of the accompanying drawings, wherein: 
     FIG. 1 is a schematic diagram of a CMOS binary difference cell according to this invention; and 
     FIG. 2 is a sketch illustrating how N binary difference cells of FIG. 1 may be combined to form an N-bit subtractor. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring now to FIG. 1, a CMOS binary difference cell 10 according to this invention is shown to receive A i , B i  and X i  input signals and to provide a difference, D i , and a borrow-out, X i+1 , output signals. The truth table for the binary difference cell 10 is presented in TABLE 1. 
     
                       TABLE 1______________________________________A.sub.i   B.sub.i           X.sub.i     D.sub.i                           X.sub.i + 1______________________________________0         0     0           0   00         0     1           1   10         1     0           1   10         1     1           0   11         0     0           1   01         0     1           0   01         1     0           0   01         1     1           1   1______________________________________ 
    
     From an inspection of the truth table of Table 1, it will be apparent to one of skill in the art that the difference output, D i , of the binary difference cell 10 can be described by the following Boolean equation: 
     
         D.sub.i =A.sub.i ⊕B.sub.i ⊕X.sub.i                 (1) 
    
     The borrow-out output, X i+1 , of the binary difference cell 10 may be defined as follows: 
     
         X.sub.i+1 =(A.sub.i ⊕B.sub.i)X.sub.i +A.sub.i B.sub.i  (2 ) 
    
     It should now be appreciated by those of skill in the art that if the borrow-in input, X i , of Equation (1) were replaced with a carry-in input, C i , then Equation (1) would provide the sum of A i , B i  and C i . The borrow-out term, X i+1 , defined by Equation (2) is, however, substantially different from the equation defining the carry-out output, C OUT , of a full adder. In a co-pending application (Ser. No. 648,930 filed Sept. 10, 1984 and assigned to the same assignee as the present invention) a high speed CMOS full adder was described and claimed, and in that application the carry-out output, C OUT , of the full adder was defined as follows: 
     
         C.sub.OUT =(A.sub.i ⊕B.sub.i)C.sub.i +A.sub.i B.sub.i  (3) 
    
     It follows, therefore, that the implementation of the borrow-out output defined by the Equation (2) is essentially different from the implementation of the carry-out output defined by Equation (3). 
     Before proceeding with a detailed explanation of the operation of the CMOS binary difference cell 10, it should be noted that the device is partially fabricated from transmission gates that represent a manner of connecting MOS transistors that is unique to CMOS logic. In general, the transmission gate is effective to pass the signal on its input terminal to the output terminal when the n-channel terminal is at a logic level 1 and the p-channel terminal is at a logic level 0. Conversely, when the n-channel terminal is at a logic level 0 and the p-channel terminal is at a logic level 1, the transmission gate is in its OFF condition and there is no transmission through the device. 
     Inverters I 1  and I 2  together with transmission gates T 1  and T 2  are effective to form an exclusive-OR gate that provides an A i  ⊕B i  output that is hereinafter referred to as the P signal. Inverter I 3  then provides the exclusive-NOR output A i  ⊕B i , referred to hereinafter as the P signal. The P and P signals are used to control the transmission gates T 3 , T 4  and T 5 . It will be appreciated that the transmission gates T 3  and T 4  together with the inverter I 4  are effective to form an exclusive-OR gate that produces the difference output, D i . Thus, when the P signal is a logic level 0 (indicating that the A i  and B i  inputs are the same, i.e., at either a logic level 0 or 1), transmission gate T 4  is OFF, transmission gate T 3  is ON and the borrow-in input, X i , is the difference output, D i . Conversely, when the P signal is a logic level 1 (indicating) that the A i  and B i  inputs are dissimilar) transmission gate T 3  is OFF, transmission gate T 4  is ON, and the borrow-in signal, after inversion in inverter I 4 , is the difference output, D i . 
     The borrow-out output, X i+1 , is formed by transmission gate T 5 , the p-channel field effect transistors (FETS) P1 and P2, and the n-channel FETS N3 and N4. The p-channel FET, P1, and the n-channel FET, N4, are both gated by the A i  input, while the p-channel FET, P2, and the n-channel FET, N3, are gated by the inverse B i  input, B i , out of the inverter I 2 . The p-channel FETS P1 and P2 generate the borrow output when the A i  and B i  inputs are, respectively, a logic level 0 and 1. Thus, when A i  is a logic level 0, n-channel FET, N4, is gated OFF and p-channel FET is gated ON; and when B i  is a logic level 1, the inverter I 2  is effective to provide a logic level 0 to the gate terminals of n-channel FET N3 and p-channel FET P2, turning those devices OFF and ON, respectively. With the p-channel FETS P1 and P2 ON and the n-channel FETS N3 and N4 OFF, a logic level 1 is provided as the borrow-out output, X i+1 . From the foregoing, it should now be appreciated that the n-channel FETS N3 and N4 are effective to kill the borrow output (i.e., provide a logic level 0 as the borrow-out output, X i+1 ) when the A i  and B i  inputs are, respectively, a logic level 1 and 0. 
     Finally, when the A i  and B i  inputs are both either a logic level 0 or 1, neither the p-channel FETS P1 and P2 nor the n-channel FETS N3 and N4 are both simultaneously ON or OFF and, therefore, the borrow-in input, X i , is provided, via the transmission gate T 5 , as the borrow-out output, X i+1 . 
     From the truth table presented in Table 1 and the foregoing description of the operation of the CMOS binary difference cell 10, it will now be appreciated by those of skill in the art that if A i  and B i  are bits of the minuend and the subtrahend, respectively, and if A i  =0 and B i=1 , there will be a borrow-out, X i+1  to the bits of next higher numerical significance. In subtracting multibit numbers, therefore, one must take account of the borrow-out, X i , from the immediately previous stage. 
     Referring now to FIG. 2, the CMOS binary difference cell 10 can be cascaded (repeated) N times, as shown, to form an N-bit subtractor 20. It should be noted that the N-bit subtractor 20 is effective to perform the subtraction of two N-bit numbers with a total of N stages (cells) as opposed to two&#39;s complement arithmetic wherein N+1 stages are required, the extra stage providing for the sign bit. Here the sign bit information is provided by the borrow-out output of the N th  stage. In order to illustrate the operation of the N-bit adder 20, consider the case where the minuend, A, is seven, the subtrahend, B, is five and the least significant borrow-in, X 0 , is set to zero. The minuend, A, as a four-bit word is (0111) and the subtrahend, B, as a four-bit word is (0101). From Table 1, it follows that D=(0010) and X N+1  =0, meaning that the difference is two and that there is no borrow-out output. If, on the other hand, the minuend, A, were 5(0101) and the subtrahend, B, were 7(0111) and the least significant borrow-in, X 0 , were set to zero, then from Table 1, the difference D=1110 and the borrow-out output X N+1  =1, which may be interpreted as indicating that the difference is negative. If this is the case, it will be recognized that the difference, D=1110, is indeed the two&#39;s complement form of -2. 
     Having described a preferred embodiment of this invention, it will now be apparent to those of skill in the art that many changes may be made without departing from the inventive concepts described. It is felt, therefore, that this invention should not be limited to the disclosed embodiment, but rather by the spirit and scope of the appended claims.