Proposed Designs
6.1.1 Carry Free Addition
In the conventional carry free addition algorithm, to obtain the transfer digit Ti+1, the operands Xi and Yi have to be added together and compared with the threshold value.
A carry chain in this process limits the performance of the carry free adder. To improve it, a speculative method could be used (e.g., [51], [53] and [54]). In this method, all possible results which depend on different transfer digits Ti and Ti+1 are calculated simultaneously and the correct one is selected by the value of the transfer digits. The redundancy on hard-ware in aforementioned designs implies the bigger area and higher power consumption. On the other hand, the nonspeculative method for maximally redundant SD addition (e.g., [55])
provided a faster design in binary world (i.e., radix-2h). In this section, a new nonspeculative decimal SD addition which directly calculates the result without the hardware redundancy is introduced. The proposed adder which works in digit set [−9, 9] has a simple range division logic. Moreover, the operands and result are encoded in 5-bit two’s complement to reuse the binary circuit as much as possible.
The Algorithm
To unify the addition and subtraction, a new operand Y opi is defined in equation (6.1).
Hence, the adder and subtractor could be represented by a unified model as shown in equa-tion (6.2).
Y opi =
Yi if operation is add
−Yi if operation is sub
(6.1)
Xi± Yi = Xi+ Y opi (6.2)
In the traditional carry free algorithm, the transfer digit Ti+1 and the temporary sum Wi are generated from the position sum Pi. The process could be represented by equation (6.3).
Ti+1= f (Pi) = f (Xi+ Y opi) Wi = g(Pi) = g(Xi+ Y opi)
(6.3)
To reduce the timing delay and parallelize the transfer digit generation with the position sum calculation, the temporary sum Wiand transfer digit Ti+1could also be directly expressed in terms of Xi and Y opi as shown in equation (6.4).
Ti+1= f′(Xi, Y opi) Wi = g′(Xi, Y opi)
(6.4)
In decimal sign digit number system,±9 should be avoided in temporary sum, otherwise, an incoming transfer digit could lead to a carry to the next digit. The position sum which is equal to ±9 is called an exception in the proposed design. Furthermore, the exception detection will pull down the performance of the decimal SD adder compared with its binary counterpart. Hence, the less number of exceptional cases, the better it is.
Table6.1:Rangedivisiondirectlybasedonoperands RangeofTi+1WiSiCorrectionSignal XiandYopiTi=−1=“11”Ti=0/1=“00/1”cor4...1 = case1Xi≥1,Yopi≥11Pi−10Pi+(−11)=Pi+(−10)/(−9)=1010,ifT1 i=1 and(0,9),(9,0)Pi+10101Pi+10110/11011,ifT1 i=0 case2Xi≥0,Yopi≤00PiPi+(−1)=Pi+0/1=1111,ifT1 i=1 Xi≤0,Yopi≥0Pi+11111Pi+00000/10000,ifT1 i=0 exclude(0,±9),(±9,0) case3Xi≤−1,Yopi≤−1-1Pi+10Pi+9=Pi+10/11=0100,ifT1 i=1 and(0,−9),(−9,0)Pi+01001Pi+01010/10101,ifT1 i=0
To implement the range division and exception detection efficiently, a scheme to divide the cases for generating different values of transfer digit Ti+1 is proposed in Table 6.1. In this method, there are four pairs of Xi and Y opi need to be detected as an exception.
Therefore, only six multi-input gates are applied to implement the exception detecting circuit.
Furthermore, these gates could be reused to decide the transfer digits. Consequently, besides the exception detecting logic, only the most significant bits for Xi and Y opi and simple logic are needed to determine the transfer digit.
In Algorithm I, once the transfer digit is obtained, Wi is generated by adding a correction value to Pi, and then, the result Si is calculated by adding Wi with Ti. In this process, those two serial computations cause a limit on speed. To combine these two additions into one computation efficiently (i.e., the three operands addition Si = Pi− r × Ti+1+ Ti), an analysis for the effect of the input range and incoming transfer bits on the decimal correction value is provided in Table 6.1.
To generate the correction signal, the transfer digit Ti from the last digit is used. There-fore, the decimal correction signal can be decided directly by Ti1 and the range of input operands Xi and Y opi, then the further computation for adding Ti is removed. The bold numbers in Table 6.1 show that the least significant bit of the correction signal is equal to Ti0.
The Hardware Implementation
To reuse the well optimized circuits in binary world as much as possible, the operands Xi and Yi are encoded in 2’s complement. Therefore, the Y opi is obtained by inverting Yi with XOR gates controlled by the operation signal op which is the penalty of the subtraction. The increment on the least significant bit could be added as an incoming carry to the right most full adder.
In this design, the exception logic is minimized to four pairs of operands detection, and to improve the speed, the operands Xi and Yi are directly used for the exception handling.
In equation (6.5), the signals Ep and En are for positive exception (i.e., (0, 9) or (9, 0)) and negative exception (i.e., (0,−9) or (−9, 0)) respectively.
FA* FA FA FA FA
* The two full adders only contain the logic for sum
SDDA
Figure 6.1: Proposed n-digit signed digit decimal adder
Ep =
In Table 6.1, the operands’ range division for generating Ti+1 is not right on zero, thus, the zero input should be excluded for some cases. The zero detection logic in equation (6.5) could be reused, and the range division logic is given in equation (6.6).
The transfer digit only depends on the range division, and it can be obtained at the same time as Pi is ready. Thus, the critical path only passes one of the two units for transfer digit generation and position sum addition. Equation (6.7) shows the logics to generate the
transfer bits.
Ti+11 = case3
Ti+10 = case1∨ case3
(6.7)
According to the analysis in Table 6.1, the decimal correction signals are decided by operands range and incoming transfer bits. The conditional adder with multiplexor which is controlled by Ti and casei could be applied. Nevertheless, to reduce the area, combinational logics shown in equation (6.8) are used to directly generate the correction signal and to connect it to the second level of binary full adders. An example of the process of the proposed adder is shown in Fig. 6.1.
cor4 = case1∨ (Ti1∧ case2) cor3 = case3∨ (Ti1∧ case2) cor2 = cor4
cor1 = Ti1⊕ case2
cor0 = Ti0
(6.8)
Since the critical path passes through the second level of full adders, to further improve the performance of the proposed design, a simplified carry chain which is similar to the prefix network is applied as shown in Fig. 6.1.
Finally, the hardware implementation of the proposed decimal SD adder is given in Fig. 6.1. The bold dash line is the critical path which passes through the transfer and correction logic and an optimized carry chain. The full adders with the asterisk only contain the logics for sum. Furthermore, in the second level of full adders, the critical path only pass through one XOR gate in the left most full adder.