Abstract
Devices for adding floating point numbers, devices for multiplying floating point numbers, devices for floating-point fused multiply-add operations, devices for performing fixed point number operations, and associated converters thereof. A preprocessed fixed point format is a fixed point format wherein the LSD of all numbers exactly represented in said format is equal to B/2 (i.e. one for binary radix), and the rest are rounded to one of these numbers. A preprocessed floating point format is a floating point format wherein the significand is a preprocessed fixed point number.
Claims
1. A device for performing a desired addition or subtraction operation of at least two preprocessed floating point numbers to generate a third preprocessed floating point number, each number having a preprocessed significand of m+2 digits, the device comprising: an exponent data path; and a significand data path, comprising a first input arranged to receive at most the m+1 Most Significant Digits (MSDs) of the preprocessed significand of the first number, a second input arranged to receive at most the m+1 MSDs of the preprocessed significand of the second number, wherein the significand data path is arranged to generate at most the m+1 MSDs of the preprocessed significand of the third number, whereas the Least Significant Digit (LSD) of all preprocessed significands is equal to B/2, B being the base of the numerical system.
2. A device for performing a multiplication operation of at least two preprocessed floating point numbers to generate a third preprocessed floating point number, each number having a preprocessed mantissa of m+2 digits, the device comprising: an exponent data path; and a significand data path, the significand data path comprising a first input arranged to receive at most the m+1 MSDs of the preprocessed significand of the first number, a second input arranged to receive at most the m+1 MSDs of the preprocessed significand of the second number, wherein the significand data path is arranged to generate at most the m+1 MSDs of the significand of the third preprocessed number, whereas the LSD of all preprocessed significands is equal to B/2, B being the base of the numerical system.
3. A device for performing a floating point fused multiply-add operation between three floating point preprocessed numbers to generate a fourth floating point preprocessed number, each number having a preprocessed significand of m+2 digits, the device comprising: an exponent data path arranged to receive the exponents of the three preprocessed input numbers, and to generate the exponent of the result of the floating point fused multiply-add operation; and a significand data path, comprising: a multiplication path comprising a first input arranged to receive at most the m+1 MSDs of the preprocessed significand of the first number, a second input arranged to receive at most the m+1 MSDs of the preprocessed significand of the second number, the multiplication path arranged to multiply said preprocessed significands of the first and second numbers and generate a multiplication result in an output an adding path, configured to receive at most the m+1 MSDs of the preprocessed significand of the third number in a first input and the multiplication result in a second input, and to generate the at most m+1 MSDs of the significand of the fourth preprocessed number, whereas the LSD of all preprocessed significands is equal to B/2, B being the base of the numerical system.
4. A device configured to be connected to an arithmetic unit, said arithmetic unit arranged to process at least a first preprocessed floating point number to generate at least a second preprocessed floating point number, said preprocessed floating point numbers having a significand with an LSD equal to B/2, B being the base of the numerical system, said device being configured to convert one input number to said at least first preprocessed floating point number or said at least second preprocessed floating point number to an output number.
5. A device for performing a desired operation of at least a first preprocessed fixed point number having n+1 digits to generate at least a second preprocessed fixed point number having z+1 digits, the device comprising at least one arithmetic unit having a first input for receiving the n MSDs of said at least first preprocessed fixed point number, wherein the at least one arithmetic unit is arranged to generate the z MSDs of the at least second preprocessed fixed point number, whereas the Least Significant Digit (LSD) of all preprocessed fixed point numbers is equal to B/2, B being the base of the numerical system.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0189] Particular embodiments of the present invention will be described in the following by way of non-limiting examples, with reference to the appended drawings, in which:
[0190] FIG. 1 illustrates the significand data path of a floating point (FP) adder according to an example wherein rounding may produce some bias;
[0191] FIG. 1a shows in detail an example of a special conditional bit inverter;
[0192] FIG. 2 illustrates another example implementation of the significand data path of a FP adder which eliminates some sources of bias;
[0193] FIG. 2a illustrates an example implementation of a special left-shifter;
[0194] FIG. 3 illustrates another example implementation of the significand data path of a FP adder which eliminates some sources of bias in a more simplify way;
[0195] FIG. 3a illustrates an example implementation of a two's complement adding module;
[0196] FIG. 4 illustrates an example implementation of a FP adder which avoids the bias due to rounding;
[0197] FIG. 4a illustrates an example implementation of a close rounding module;
[0198] FIG. 4b illustrates an example implementation of a far rounding module;
[0199] FIG. 5 illustrates the significand data path of a dual-path floating point (FP) adder according to an example;
[0200] FIGS. 6 and 6b illustrate the significand data path of a floating point (FP) multiplier according to two examples;
[0201] FIG. 7 illustrates a floating point fused multiply-add (FMAD) circuit according to an example
[0202] FIG. 8 illustrates a floating point FMAD circuit according to another example which eliminates bias and it is optimized on speed.
[0203] FIGS. 9 and 10 illustrate example implementations of the left shifting module of an floating point FMAD circuit;
[0204] FIG. 11 shows an example of an arithmetic unit connected to an input converter and an output converter;
[0205] FIG. 12 illustrates an example implementation of a preprocessed-fixed-point-to-preprocessed-floating-point numbers converter;
[0206] FIG. 13a illustrates an example implementation of a preprocessed left-shifter;
[0207] FIG. 14 illustrates an example implementation of an unprocessed-fixed-to-preprocessed-floating-point numbers converter;
[0208] FIGS. 14a and 14b illustrate example implementations of the normalization module of an unprocessed-fixed-to-preprocessed-floating-point numbers converter;
[0209] FIGS. 15a, 15b and 15c illustrate example implementations of a preprocessed-floating-point-to-preprocessed-floating-point numbers converter;
[0210] FIGS. 16, 17a and 17b illustrate example implementations of a preprocessed-floating-point-to-preprocessed-fixed-point numbers converter;
[0211] FIG. 18, 19a, 19b illustrate example implementations of the significand data path of a unprocessed-floating-point-to-preprocessed-floating-point numbers converter;
[0212] FIG. 20 illustrates an example implementation of a preprocessed-floating-point-to-unprocessed-floating-point numbers converter;
[0213] FIG. 20a illustrates an example implementation of the rounding module of a preprocessed-floating-point-to-unprocessed-floating-point numbers converter;
[0214] FIG. 21 illustrates an example implementation of a preprocessed-floating-point-to-unprocessed-fixed-point numbers converter;
[0215] FIG. 22a, 22b, 22c, 22d y 22e illustrate implementation examples of a fixed point adding module;
[0216] FIG. 23 illustrates the implementation of a fixed-point subtractor circuit for preprocessed numbers according to an example;
[0217] FIG. 24 illustrates an implementation of a fixed-point adder/subtractor circuit for preprocessed numbers according to an example;
[0218] FIG. 25a illustrates an implementation example of a fixed point multiplication module for preprocessed numbers;
[0219] FIG. 25b illustrates implementation examples of a fixed point multiplication module for preprocessed numbers;
[0220] FIGS. 26a and 26b illustrate implementation examples of a redundant multiplier for preprocessed numbers;
[0221] FIG. 27a, 27b y 27c illustrate implementation examples of a fixed point squaring module for preprocessed numbers;
[0222] FIG. 28 illustrates the implementation of a redundant squaring module for preprocessed numbers according to an example;
[0223] FIG. 29 illustrates an implementation example of a squaring module for preprocessed signed numbers;
[0224] FIG. 30a, 30b y 30c illustrate implementation examples of a fixed point constant multiplication module for preprocessed numbers;
[0225] FIG. 31 illustrates the implementation of a redundant constant multiplication module for preprocessed numbers according to an example;
[0226] FIG. 32 illustrates an implementation example of a left-shifter for preprocessed numbers;
[0227] FIG. 33a, 33b y 33c illustrate implementation examples of converters for converting preprocessed fixed-point numbers to preprocessed fixed-point numbers;
[0228] FIG. 34 illustrates an implementation example of a converter for converting preprocessed fixed-point numbers to unprocessed fixed-point numbers;
[0229] FIG. 35 illustrates an implementation example of a converter for converting preprocessed fixed-point numbers to unprocessed fixed-point numbers by rounding to nearest;
[0230] FIG. 36 illustrates an implementation example of a converter for converting preprocessed fixed-point numbers to preprocessed floating-point numbers;
[0231] FIG. 37 illustrates an implementation example of a converter for converting preprocessed fixed-point numbers to unprocessed floating-point numbers;
[0232] FIG. 38 illustrates an implementation example of a converter for converting unprocessed floating-point numbers to preprocessed fixed-point numbers;
DETAILED DESCRIPTION OF EMBODIMENTS
[0233] FIG. 1 illustrates the significand data path of a floating point (FP) adder according to an example. The output of the adder 100 illustrated in FIG. 1 is always positive. FP adder 100 receives m bits from a first Significand Mx and from a second Significand My, respectively. Both significands belong to preprocessed floating point numbers. Significands Mx and My both have m+1 digits. However, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the adder at the input. In the example of FIG. 1 the two floating point numbers are normalized. However, to simplify the description, both the MSB of the normalized number and the sign bit are included in the m bits that are introduced in the adder 100. In an alternative implementation, these bits may be introduced after the swap module. FP adder 100 comprises a swap module 105 and a comparator 110, both having a first and second input for receiving the m bits of the significands. The swap module 105 has a first output and a second output and is arranged so that the number with the lower exponent is output at the first output and the number with the higher exponent is output at the second output. Swap module 105 further comprises a third input for receiving the sign of the exponent difference. This shall be calculated by an exponent comparator (not shown). Comparator module 110 further comprises a third input for receiving a control signal in case the numbers have the same exponents and the effective operation is subtraction. The comparator module 110 generates a first control signal at a first output and a second control signal at a second output to instruct a negation of one of the significands when the effective operation is subtraction. As mentioned before, this negation may be implemented by only inverting all bits but the LSB. FP adder 100 further comprises a right shifter 115 having a first input coupled at a first output of swap module 105 and a second input for receiving the shift amount (depicted in FIG. 1 as the absolute value of the difference of the exponents). The first output of swap module 105 carries the m MSBs of the significand with the lowest exponent. The right shifter 115 may further comprise a third input coupled to a logical 1. This introduces the LSB of the significand to the right shifter 115 so that it receives the m+1 bits of the significand. The right shifter 115 shall right shift this m+1 number according to the shift amount received and generate a right shifted m+1 bit number. The right shifter 115 is coupled to a special conditional bit inverter 120. Special conditional bit inverter 120 shall receive the first control signal from the comparator module 110 to carry out a bit-wise inversion of all the m+1 received right shifted bits except if the numbers have the same exponents. In that case the LSB is forced to 1.
[0234] FIG. 1a shows in detail the special conditional bit inverter 120. It comprises a standard conditional bit inverter 120a receiving m MSBs of the input and performing a bit-wise inversion of the m bits. The LSB is introduced in a XOR gate 122a along with the output of a two input AND gate 121a that receives the effective operation at the first input and a signal indicating if the exponents are equal at the second input. Therefore the output of the special conditional bit inverter comprises m+1 bits, wherein the LSB of the m+1 bits is the output of the XOR gate 122a.
[0235] Accordingly, FP adder further comprises a conditional bit inverter 125 having a first input coupled to a second output of the swap module 105 for receiving the m MSBs of the significand that is not input to the right shifter 115 and a second input coupled to the second output of the comparator module. The conditional bit inverter 125 is a conventional conditional bit inverter with no special cases as the LSB of the significand is not introduced at its input. Now, the conditional bit inverter 125 generates an m bit number. When the effective operation is subtraction and d=0, the comparator module 110 compares the input significands and instructs either the conditional bit inverter 120 or the conditional bit inverter 125 to negate the lower one. If d< >0, the conditional bit inverter 120 always negates the input to perform an effective subtraction. The FP adder 100 further comprises a two's complement adding module 130 having a first input coupled to the output of the conditional bit inverter 125 and a second input coupled to the output of the special conditional bit inverter 120. The first input receives m bits while the second input receives m+1 bits. Therefore, the two's complement adding module 130 further comprises a third input coupled to 1, so that the m bits at the output of the conditional bit inverter 125 are augmented to the right by 1 bit. However, in alternative implementations, the introduction of the additional one may be performed internally to the module 130 without the need for a special input. It is merely illustrated in the example of FIG. 1 and in subsequent examples, to indicate the need for the functional introduction of the implicit LSB. The two's complement adding module 130 performs an addition of the two signed numbers and generates a result at a first output. The two's complement adding module 130 further comprises a second output for generating an overflow bit. The first output of the two's complement adding module 130 is coupled to a leading one detector (LOD) module 135 and to shifter 140. The LOD module 135 is arranged to calculate the number of bits to be left shifted by the shifter 140. In other implementations this module may alternatively be a leading zero anticipator (LZA) or similar circuit. The shifter 140 shifts one position to the right if there is an overflow. Otherwise it shifts as many positions to the left as indicated by the LOD module 135. The shifter 140 generates m MSBs of the significand Mz that is the sum or difference of significands Mx and My after aligning them. The LSB of the significand Mz is implicit and it is equal to 1. Therefore, the rounding to nearest is performed by truncating. However, this rounding produces bias in the aligned addition and in the close path case if left shifting is performed.
[0236] It should be noted that in this implementation the m MSBs of the significand include the sign bit and the integer bit. In an alternative implementation, the sign bit may be discarded after the addition, since it is always zero and, similarly, the integer bit may be discarded after normalization, since it is always one.
[0237] FIG. 2 illustrates the significand data path of a floating point (FP) adder according to another example. In this example, bias is produced due to rounding, only in the close path case if d=1, or if the sum is aligned. In case d=0 and effective subtraction then a “tie to away” rounding takes place. In this example there is no comparator module as in the example of FIG. 1. Therefore the output of the adder may also be negative. FP adder 200 receives m bits from a first Significand Mx and from a second Significand My, respectively. Both significands belong to preprocessed floating point numbers. Significands Mx and My both have m+1 bits. However, again, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the adder at the input. Therefore, again, as in the example of FIG. 1, only m bits from each significand Mx and My are input to FP adder 200. Furthermore, the two floating point numbers are again normalized. Again, to simplify the description, both the MSB of the normalized number and the sign bit are included in the m bits that are introduced in the adder 200, although, in an alternative implementation, they may be introduced just before they are required. FP adder 200 comprises a swap module 205 having a first and second input for receiving the m bits of the significands. Swap module 205, which has a function similar to the swap module 105 of FIG. 1, further comprises a third input for receiving the sign of the exponent difference. This shall be calculated by an exponent comparator (not shown). FP adder further comprises a conditional bit inverter 210 having a first input coupled to a first output of the swap module 205 for receiving the m bits of the significand with the lowest exponent and a second input for receiving a bit indicative of the effective operation (op). Conditional bit inverter 205 shall carry out a bit-wise inversion of the m bits, if the effective operation is a subtraction. FP adder 200 further comprises a right shifter 215 having a first input coupled at an output of the conditional bit inverter and a second input coupled to a logical 1. This introduces the LSB of the significand to the R-shifter so that the right shifter receives the m+1 bits. The right shifter 215 shall right shift this m+1-bit number according to the shift amount received at a third input and generate a right shifted m+1-bit number. The FP adder 200 further comprises a two's complement adding module 220 having a first input coupled to the output of the right shifter 215 and a second input coupled to a second output of the swap module 205. The first input receives m+1 bits while the second input receives m bits. Therefore, the two's complement adding module 220 further comprises a third input coupled to 1, so that the m bits at the second output of the swap module 205 are augmented by 1 bit. Again, in alternative implementations, the introduction of the additional one may be performed internally to the module 220 without the need for a special input. The two's complement adding module 220 performs an addition of the two signed numbers and generates an m+1-bit result at a first output. The two's complement adding module 220 further comprises a second output for generating an overflow bit. The two's complement adding module 220 is coupled to one-position right shifter 235 of normalization module 230. A control input of right shifter 235 is coupled to the second output of the two's complement adding module 220 and a right shift is performed if an overflow occurs. The FP adder 200 further comprises leading zero anticipation (LZA) module 225 having a first input coupled to the second output of swap module 205 and a second input coupled to the output of right shifter 215. The value 1 is also inserted at the input of the LZA module 225 so that the m bits at the second output of swap module 205 are augmented to the right by 1 bit corresponding to the implicit LSB. However, in other implementations the introduction of the additional one may be performed internally to the LZA module 225 without the need for a special input. Now the normalization module 230 further comprises a conditional bit inverter 240 having an input coupled to the first output of two's complement adding module 220 and a special left shifter 245 having a first input coupled at the output of conditional bit inverter 240. A second input of special left shifter 245 is coupled to the output of LZA module 225. The number of bits to be shifted by the special left shifter 245 is provided by the LZA module 225. This is a special shifter in such a way that in a left shift, the vacant positions are filled with a bit that comes from a third input of the special shifter which is coupled to the sign of the result of the two's complement adding module 220. An implementation of the special left-shifter 245 based on the classic barrel shifter implementation is illustrated in FIG. 2a.
[0238] The special left-shifter 245, shown in FIG. 2a, is implemented using several two-to-one multiplexors (ceil(log 2 of the maximum amount of shift required)) connected serially, such as the output of one shifter is used in the input of the next one. The data inputs of the first multiplexor are coupled to the first input of the left-shifter, no shifted and shifted one (2̂0) position, respectively, whereas the control bit is coupled to the LSB of the shift amount (second input). The data inputs of the second multiplexor are coupled to output of the first one, no shifted and shifted 2 (2̂1) positions, respectively, whereas the control bit is coupled to the second LSB of the shift amount (second input). The rest of the multiplexor are connected accordingly. In conventional left shifters the vacant position are always filled with zero. In this proposal, the vacant position is filled with the third input (new input L). In this example, the maximum shift amount is m−1. The output of special left shifter 245 comprises the m MSBs of the shifted value. The normalization module 230 further comprises a multiplexer 250 having a first input coupled to the output of right shifter 235 and a second input coupled to the output of special left shifter 245. The output of the multiplexer is either the output of the right shifter 235 or the output of the special left shifter 245 and comprises the m MSBs of the significand Mz that is the sum or difference of significands Mx and My after aligning them. Accordingly, the significand is normalized by the normalization module 230. Again, the LSB of the significand Mz is implicit and it is equal to 1.
[0239] It should be noted that in this implementation the m MSBs of the significand include the sign bit and the integer bit. In an alternative implementation, the sign bit may be extracted after the addition and, similarly, the integer bit may be discarded.
[0240] FIG. 3 illustrates the significand data path of a floating point (FP) adder according to yet another example. The example according to FIG. 3 has a different LZA module, a different two's complement adding module and a more simplified normalization module compared with the example according to FIG. 2. FP adder 300 receives m bits from a first Significand Mx and from a second Significand My, respectively. Both significands belong to preprocessed floating point numbers. Significands Mx and My both have m+1 digits. Again, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the adder at the input. Furthermore, the two floating point numbers are also normalized. Again, to simplify the description, both the MSB of the normalized number and the sign bit are included in the m bits that are introduced in the adder 300. Therefore, again, as in the examples of FIGS. 1 and 2, only m bits from each significand Mx and My are input to FP adder 300. FP adder 300 comprises a swap module 305, similar to swap modules 105 and 205, having a first and second input for receiving the m bits of the significands. Swap module 305 further comprises a third input for receiving the sign of the exponent difference. This shall be calculated by an exponent comparator (not shown). FP adder 300 further comprises a conditional bit inverter 310 having a first input coupled to a first output of the swap module 305 for receiving the m bits of the significand with the lowest exponent. Conditional bit inverter 310 shall carry out a bit-wise inversion of the m bits if the effective operation is a subtraction. FP adder 300 also, as in the FP adder of FIG. 2, further comprises a right shifter 315 having a first input coupled at an output of the conditional bit inverter and a second input coupled to a logical 1. The FP adder 300 also further comprises a two's complement adding module 320 having a first input coupled to the output of the right shifter 315 and a second input coupled to a second output of the swap module 305. Similarly to the FP adder of FIG. 2, the first input receives m+1 bits while the second input receives m bits. However, in this example the two's complement adding module 320 may add internally the implicit LSB of the second input. The two's complement adding module 320 performs an addition of the two signed numbers and generates an m+1 bit result at a first output. The two's complement adding module 320 further comprises a second output for generating an overflow bit. An implementation of the two's complement adding module 320 considering the implicit LSB set to one of the second input is illustrated in FIG. 3b. A standard adder 320b of m bits is used to generate the m MSBs of the first output and the overflow signal, whereas the LSB of the first input is coupled to the carry input of said standard adder and it generates the LSB of the first input by inverting it.
[0241] The first output of two's complement adding module 320 is coupled to a first input to shifter 335 of normalization module 330. A second input of shifter 335 is coupled to the output of LZA module 325. The FP adder 300 further comprises LZA module 325 having a first and a second input coupled to the first and second output of swap module 305, respectively, and a third input coupled to the LSB of the exponent difference. Similar to the LZA module of FIG. 2, the value 1 is also inserted at the input of the LZA module 325. Again, in other implementations the introduction of the additional one may be performed internally to the LZA module 325 without the need for a special input. Now, the normalization module 330 further comprises a conditional bit inverter 340 having an input coupled to the output of shifter 335. The output of the conditional bit inverter 340 comprises the m bits of the significand Mz that is the sum of significands Mx and My after aligning them. Again, the LSB of significand Mz is implicit, in the same way discussed with reference to FIGS. 1 and 2, as it is equal to 1. Accordingly, the significand is normalized by the normalization module 330.
[0242] FIG. 4 illustrates a floating point (FP) adder according to an example. The example illustrated in FIG. 4 avoids any sources that may produce bias during rounding. FP adder 400 comprises a significand data path 400m and an exponent data path 400e. The significand data path 400m receives m bits from a first Significand Mx and from a second Significand My, respectively. Both significands belong to preprocessed floating point numbers. Significands Mx and My both have m+1 digits. Again, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the adder at the input. Therefore, again, as in the examples of FIGS. 1 and 2, only m bits from each significand Mx and My are input to significand data path 400m. Furthermore, the two floating point numbers are also normalized. Again, to simplify the description, both the MSB of the normalized number and the sign bit are included in the m bits that are introduced in the adder 400. Significand data path 400m comprises a swap module 405, similar to swap modules 105, 205 and 305, having a first and second input for receiving the m bits of the significands. Swap module 405 further comprises a third input for receiving the sign of the exponent difference. This shall be calculated by the exponent data path 400e. Significand data path 400m further comprises a conditional bit inverter 410 having a first input coupled at a first output of swap module 405 for receiving the m bits of the significand with the lowest exponent. The conditional bit inverter 410 shall carry out a bit-wise inversion of the m bits if the effective operation is a subtraction. The conditional bit inverter 410 has a second input for receiving a control bit indicating the effective operation. The significand data path 400m further comprises a right shifter 415 having a first input coupled to the output of conditional bit inverter 410 and a second input for receiving the shift amount (|d|). The right shifter 415 may further comprise a third input coupled to a logical 1. The right shifter 415 shall right shift this m+1 number according to the shift amount received and generate a right shifted m+1 bit number. The significand data path 400m also further comprises a two's complement adding module 420 having a first input coupled to the output of the right shifter 415 and a second input coupled to a second output of the swap module 405. Similarly to the FP adder of FIGS. 1, 2 and 3, the first input receives m+1 bits while the second input receives m bits. Therefore, the two's complement adding module 420 further comprises a third input coupled to 1, so that the m bits at the output of the swap module 405 are augmented by 1 bit. The two's complement adding module 420 performs an addition of the two signed numbers and generates an m+1 bit result at a first output. The two's complement adding module 420 further comprises a second output for generating an overflow bit.
[0243] The first output of two's complement adding module 420 is coupled to a first input of close rounding module 425 of normalization module 430. The normalization module 430 further comprises a special shifting module 435 having a first input coupled to the first output of close rounding module 425 for receiving m+2 bits. This is a special shifter in such a way that in a left shift of the first input, the vacant positions are filled with a third input which is coupled to a second output of close rounding module 425 for receiving 1 bit. The close rounding module 425 provides the adequate values to the special shifter module 435 to obtain correctly rounded and no biased results after normalization if the effective operation is a subtraction and the difference of exponents is less or equal to one (op=1,d={0,1}, close path case). FIG. 4a shows the close rounding module 425 in detail. The conditional bit inverter module 425a performs a bit-wise inversion of the m+1 input bits if the output of the adding module 420, is negative, i.e., the MSB of the input is equal to one (sign(c)=1). Otherwise the output of the conditional bit inverter module 425a, which produces the m+1 MSBs of the first output of the close rounding module 425, is equal to the input. Furthermore, the close rounding module 425 comprises logic that is arranged such that, if the operands have the same exponent (d=0), then the LSB of the first output and the second output of the close rounding module 425 are equal to the sign of the output of the adding module 420. If the exponents are different, this LSB of the first output is equal to the LSB of the output of the adding module 420 and the second output is equal to its inverse. However, when not in a close path case, then these two bits do not affect the output of the normalization module 430, as no left shifting greater than 1 position shall take place. In alternative implementations, the LSB of the first output may be any bit or combination of bits with adequate random characteristics, and the second output, its inverse.
[0244] The shifting module 435 provides an m+1-bit output corresponding to the MSBs of the first input (m+2 bits) after shifting it one bit to the right (overflow) or shifting it to the left according to the second input, which is coupled to the output of LZA module 445. The FP adder 400 further comprises LZA module 445 having a first input coupled to the second output of swap module 405 and a second input coupled to the output of right shifter 415. Similar to the LZA module of FIG. 2, the value 1 is also inserted at the input of the LZA module 445, to augment the second output value of the swap module 405 by one bit. Again, in other implementations the introduction of the additional one may be performed internally to the LZA module 445 without the need for a special input.
[0245] The significand data path 400m further comprises a far rounding module 440 having an input coupled to the output of the shifting module 435. The far rounding module 440 prevents rounding with bias in the aligned sum. The far rounding module 440 provides a m-bit bus at the output from a m+1-bit at the input. FIG. 4b illustrates in detail the far rounding module 440. The output is equal to the m+1 MSBs of the input, except if the effective operation is an addition (op=0), the exponent are equal (d=0) and the LSB of the input is zero. In this case, the LSB of the output is set to zero. The output of far rounding module 440 comprises the m bits of the significand Mz that is the sum or difference of significands Mx and My after aligning them. The LSB of significand Mz is implicit, in the same way discussed with reference to FIGS. 1, 2 and 3, as it is equal to 1. Accordingly, the significand is normalized by the normalization module 430.
[0246] The exponent data path comprises an exponent difference module 450 having a first input for receiving the first exponent Ex and a second input for receiving the second exponent Ey and generating, at an output, a value representing the difference of the exponents d. This value includes information relevant to the sign of the difference and the magnitude of the difference. A multiplexer 455 receives the exponents at a first and second input, respectively, and the sign of the difference of the exponents at a third input. The exponent data path further comprises an exponent update module 460 having a first input receiving the output of multiplexer 455, a second input receiving the output of LZA module 445 and a third input receiving the overflow bit from two's complement adder 420. The exponent update module generates the exponent Ez of the result of the effective operation. Further, a sign module 465 receives the sign bits Sx and Sy of the operands, the sign of the difference of the exponents (sign(d)) and the sign (sign(c)) of the difference of the significands, and generates the bit indicative of the effective operation (op) and the sign bit Sz of the result of the FP operation.
[0247] FIG. 5 illustrates the significand data path of a FP adder with a double path according to an example. The example illustrated in FIG. 5 avoids any sources that may produce bias during rounding. FP adder 500 receives m bits from a first Significand Mx and from a second Significand My, respectively. Both significands belong to preprocessed floating point numbers. Significands Mx and My both have m+1 bits. However, again, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the adder at the input. Therefore, again, as in the example of FIG. 1, only m bits from each significand Mx and My are input to FP adder 500. Furthermore, the two floating point numbers are again normalized. Again, to simplify the description, both the MSB of the normalized number and the sign bit are included in the m bits that are introduced in the adder 500. FP adder 500 comprises a swap module 505 having a first and second input for receiving the m bits of the significands. Swap module 505 further comprises a third input for receiving the sign of the exponent difference.
[0248] FP adder 500 further comprises conditional bit inverter 510 having a first input coupled at a first output of swap module 505 for receiving the m bits of the significand with the lowest exponent. The conditional bit inverter 510 shall carry out a bit-wise inversion of the m bits if the effective operation is a subtraction. The conditional bit inverter 510 has a second input for receiving a control bit indicating the effective operation. The FP adder 500 further comprises a right shifter 515 having a first input coupled to the output of conditional bit inverter 510 and a second input for receiving the shift amount (|d|). The right shifter 515 may further comprise a third input coupled to a logical 1 to receive the LSB of the significand. The right shifter 515 shall right shift this m+1 significand according to the shift amount received and generate a right shifted m+1 bit number. The FP adder 500 also further comprises a two's complement adding module 520 having a first input coupled to the output of the right shifter 515 and a second input coupled to a second output of the swap module 505. Similarly to the two's complement adding modules of FIGS. 1, 2, 3 and 4, the first input receives m+1 bits while the second input receives m bits. Therefore, the two's complement adding module 520 further comprises a third input coupled to 1, so that the m bits at the output of the swap module 505 are augmented by 1 bit. The two's complement adding module 520 performs an addition of the two signed numbers and generates an m+1 bit result at a first output. The two's complement adding module 520 further comprises a second output for generating an overflow bit.
[0249] The FP adder 500 further comprises a second right shifter 525 having a first input coupled to the output of conditional bit inverter 510. The second right shifter 525 further comprises a second input coupled to a logical 1, so that the m bits at the output of the conditional bit inverter 510 are augmented by 1 bit. The second right shifter 525 shall right shift at most one position this m+1 number generating a right shifted m+1 bit number.
[0250] The FP adder 500 further comprises a second two's complement adding module 530 having a first input coupled to the output of second right shifter 525 and a second input coupled to the second output of swap module 505. Similarly to the adding module 520, the first input receives m+1 bits while the second input receives m bits. Therefore, the second two's complement adding module 530 further comprises a third input coupled to 1, so that the m bits at the output of the swap module 505 are augmented by 1 bit. The two's complement adding module 530 performs an addition of the two signed numbers and generates an m+1 bit result at an output.
[0251] The output of two's complement adding module 530 is coupled to a first input of close rounding module 550 of normalization module 540.
[0252] The normalization module 540 further comprises a special left shifter 555. The special left shifter is equal to the one described with reference to FIG. 2. A first and a third input of left shifter 555 are coupled to the first and second output of close rounding module 550, respectively, while a second input of left shifter 555 is coupled to the output of LZA module 535. The close rounding module 550 provides the adequate values to the special left shifter 555 to obtain correctly rounded and no biased results after normalization if the effective operation is a subtraction and the difference of exponents is less or equal to one (op=1,d={0,1}, close path case). Furthermore, the close rounding module 550 comprises logic that is arranged such that, if the operands have the same exponent (d=0), then the LSB of the first output and the second output of the close rounding module 550 are equal to the sign of the output of the adding module 530. If the exponents are different, this LSB of the first output is equal to the LSB of the output of the adding module 530 and the second output equal to its inverse. The FP adder 500 further comprises LZA module 535 having a first input coupled to the second output of swap module 505 and a second input coupled to the output of right shifter 525. Similar to previous LZA modules, the value 1 is also inserted at the input of the LZA module 535, to augment the second output value of the swap module 505 by one bit. Again, in other implementations the introduction of the additional one may be performed internally to the LZA module 535 without the need for a special input.
[0253] The m-bit output of special left shifter 555, which is the output of normalization module 540, is introduced as a first input in multiplexer 565. The second input of multiplexer 565 is coupled to the output of far rounding module 560. Far rounding unit 560 is coupled to the m+1 bit output of shifting module 545 which, in turn, has an input coupled to the output of two's complement adding module 520. The shifting module 545 produces a right or left shifting of maximum one position to normalize the result of the far path. The far rounding unit 560 is equal to the one described with reference to FIG. 4b.
[0254] The multiplexer 565 receives the effective operation and the difference of the exponents and generates the m bits of the significand Mz that is the sum or difference of significands Mx and My after aligning them. The LSB of significand Mz is implicit, in the same way discussed with reference to FIGS. 1, 2, 3 and 4, as it is equal to 1. Accordingly, the significand is normalized by the normalization module 540. The multiplexer 565 selects either the close path, if the effective operation is subtraction and the difference of exponents is less than 2, op=1,d<2, or the far path in the rest of the cases.
[0255] FIG. 6 illustrates the significand data path of a floating point (FP) multiplier according to an example. FP multiplier 100M receives m bits from a first Significand Mx and from a second Significand My, respectively. Both significands belong to preprocessed floating point numbers. Significands Mx and My both have m+1 bits. However, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the FP multiplier at the input. Furthermore, in the example of FIG. 6 the two floating point numbers are normalized. However, to simplify the description, the MSB of the normalized number, the integer bit, is included in the m bits that are introduced in the FP multiplier 100M. In an alternative implementation, this bit may be introduced either before the fixed point multiplier or internally to said fixed point multiplier. FP multiplier 100M comprises a fixed point multiplier 105M and a normalization module 115M. Normalization module 115M may be a one position right shifter. The fixed point multiplier 105M receives the m MSBs of the significands Mx and My. Fixed point multiplier 105M multiplies the significands and generates the m+1 MSBs of the result of said multiplication. Then, the normalisation module 115M displaces said result one position to the right if the MSB of said result is equal to one. The output of the normalisation module 115M is an m-bit number that corresponds to the m MSBs of the m+1 bit significand of the FP result of the multiplication of the FP input numbers. In the example of FIG. 6 the LSB of the input significands is implicit and is introduced within the fixed point multiplier. Alternatively, it may be introduced as a separate input of the fixed point multiplier, as shown in the fixed point multiplier 105b of FIG. 6b. The LSB of the significand Mz is implicit and it is equal to 1.
[0256] It should be noted that in this implementation the m MSBs of the significand include the integer bit. In an alternative implementation, the integer bit of the output significand may be discarded after normalization, since it is always one.
[0257] Implementation examples of fixed point multipliers are commented later in the text.
[0258] FIG. 7 illustrates a floating point fused multiply-add (FMAD) circuit according to an example. FMAD 100F receives three preprocessed floating point numbers X, Y and Z, and generates a result S that is the sum of the third floating point number with the product of the other two (S=Z+X*Y). The LSB of the significands is equal to 1. FMAD 100F comprises an exponent data path 105F and a significand data path 110F. The exponent data path 105F comprises an exponent logic 107F for receiving the exponents Ex, Ey and Ez of the three FP numbers and generates an intermediate exponent number at an output, according to the maximum value between Ez and Ex+Ey. The output of the exponent logic 107F is coupled to a first input of exponent update module 109F. A second input of exponent update module 109F is coupled to the significand data path 110F for receiving the number of leading zeros of the result of the addition operation or the number of the leading ones if said result is negative. A third input is coupled to the significand data path 110F for receiving an overflow (ovf) bit. In an alternative implementation, the two last inputs, i.e. the number of leading non-significant bits and the overflow bit, could be combined in only one value. The exponent update module 109F is configured to generate the exponent Es of the floating point number S by increasing or decreasing the intermediate exponent value according to the number of leading non-significant bits and the overflow signal. Besides, a sign logic circuit, (not shown), computes the effective operation signal (op) for the final sum and the sign of the result in a standard way based on the sign of the inputs and the sign of the result of the final sum.
[0259] The significand data path 110F comprises a multiplication module 115F for receiving the m MSBs of the significands of the preprocessed FP numbers X and Y. The significands are represented by symbols Mx and My in FIG. 7. Significands Mx and My (as well as Mz) both have m+1 bits. However, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the FMAD at the input. Furthermore, in the example of FIG. 7 the three floating point numbers are normalized. However, to simplify the description, the MSB of the normalized number, the integer bit, is included in the m bits that are introduced in the FMAD 100F. In an alternative implementation, this bit may be omitted at the inputs and introduced either before the multiplication module 115F or internally to said multiplication module 115F for Mx and My, and either before the first shifting module 120F or internally to said module for Mz. In the example of FIG. 7 the LSB of the input significands is introduced as a separate input of the multiplication module 115F. Alternatively, it may be implicit and be introduced within the multiplication module 115F. It is merely illustrated in the example of FIG. 9 and in other subsequent examples, to indicate the need for the functional introduction of the implicit LSB. The multiplication module 115F receives the m MSBs of the significands Mx and My and generates the 2*m+1 MSBs of the product of the significands of X and Y (including their implicit LSB) at an output value. The LSB of said product is always one and it is not required explicitly. Said in a different way, if the m MSBs of Mx are represented by A, and the m MSBs of My are represented by B, then the 2*m+1 bit value at the output is equal to A*B+1/2A+1/2B.
[0260] FIG. 8 illustrates a floating point (FP) fused multiply-add (FMAD) circuit according to another example configured to eliminate the bias for rounding and to improve the speed of the significant data path. FMAD 200F receives three preprocessed floating point numbers X, Y and Z, and generates a result S that is the sum of the third floating point with the product of the other two (S=Z+X*Y). The LSB of the significands is equal to 1. FMAD 200F comprises an exponent data path 205F and a significand data path 210F. The exponent data path 205F is similar to the exponent data path 105F discussed with reference to FIG. 1. The exponent data path 205F comprises an exponent logic 207F for receiving the exponents Ex, Ey and Ez of the three FP numbers and generates an intermediate exponent number at an output, according to the maximum value between Ez and Ex+Ey. The output of the exponent logic 207F is coupled to a first input of exponent update module 209F. A second input of exponent update module 209F is coupled to the significand data path 210F for receiving the number of leading zeros of the result of the addition operation (or the number of the leading ones, if said result is negative). A third input is coupled to the significand data path 210F for receiving an overflow (ovf) bit. Similarly to the previous example, in an alternative implementation, the two last inputs, i.e. the number of leading zeros and the overflow bit, could be combined in only one value. The exponent update module 209F is configured to generate the exponent Es of the floating point number S by increasing or decreasing the intermediate exponent number according to the number of leading non-significant bits and the overflow signal. Besides, a sign logic circuit, (not shown), computes the effective operation signal (op) for the final sum and the sign of the result in a standard way based on the sign of the inputs and the sign of the result of the final sum.
[0261] The significand data path 210F comprises a multiplication module 215F for receiving the m MSBs of the significands of the preprocessed numbers X and Y. Again, the significands are represented by symbols Mx and My in FIG. 8. The significands Mx and My (as well as Mz) both have m+1 bits. However, as both significands pertain to preprocessed numbers, the LSB of both significands is equal to one (1) and does not need to be introduced in the FMAD at the input. Furthermore, as in the example of FIG. 7, the three floating point numbers are normalized. However, to simplify the description, the MSB of the normalized number, the integer bit, is included in the m bits that are introduced in the FMAD 200F. In an alternative implementation, this bit may be omitted at the inputs and introduced either before the multiplication module 215F or internally to said multiplication module 215F for Mx and My, and either before the first shifting module 220F or internally to said module for Mz. In the example of FIG. 8 the LSB of the input significands is introduced as a separate input of the multiplication module 215F. Alternatively, it may be implicit and be introduced within the multiplication module 215F. The multiplication module 215F receives the m MSBs of the significands Mx and My and generates, in a redundant representation format, the 2+m+2 corresponding to the multiplication operation between said X and Y significands (including their implicit bit). The LSD of said value is always one but, although it is not required explicitly and it could be omitted as in the example of, FIG. 7, it is included in the output signal of this example to show different alternatives. The multiplication module 215F shown in FIG. 8 generates the result in carry-save format and then said result is delivered at a first and a second 2*m+2 bit outputs, corresponding to the sum word and carry word respectively. However, one skilled in the art may appreciate that other redundant representation formats may be used with minor modifications to the disclosed circuits, such as signed digit representations. The outputs of the multiplication module 215F are coupled to adding module 230F.
[0262] In a parallel path, the m MSBs of the significand Mz of the third preprocessed number is input to first shifting module 220F that is configured to align Mz so that it can be added to the result of the multiplication. First shifting module 220F comprises a conditional bit inverter 222F that is controlled by the bit op, and an arithmetic right shifter 224F. This bit op indicates the effective operation, which depends on the sign of the input floating point numbers (XOR of the three input signs). The m-bit output of conditional bit inverter 222F, augmented to the left with the op bit as its sign bit and to the right with the LSB of Mz, is input to the arithmetic right shifter 224F. Again, the right arithmetic shifter 224F is controlled by an output of the exponent logic 207F that indicates the difference (d) of the exponent of Z and the sum of the other two exponents. The output of the first shifting module 220F is a 3*m+3 bit number and is coupled to adding module 230F. At first, said number should have 3*m+4 bits to cover all displacement cases with minimum error. However, the sign bit (MSB of the shifted value) is omitted and its second MSB is used instead, since both bits are equal, except if no shifting is performed. In this last case, no addition is really performed, since no shifting means that the two numbers are too distant (Ez>>Ex+Ey and more specifically Ez>Ex+Ey+m+1). Thus, the sign of the result of the addition is not its MSB, but the bit to indicate the effective operation (op). In an alternative implementation, the inversion in both conditional inverters 222F and 244F may be prevented when this situation (Ez>Ex+Ey+m+1) is produced, and, concordantly, the sign may always be positive in this situation. In another alternative implementations, the sign of the result of the addition may be always its MSB and the overflow signal may be avoided if 3*m+4 bits are used for representing the aligned significant and the result of the addition.
[0263] The adding module 230F generates, in a non-redundant representation, the addition between the redundant output of the multiplication module 215F and the aligned output of the first shifting module 220F. In this particular example, since carry-save is used as redundant representation, the adding module 230F comprises a 3:2 counter 232F to add the two outputs of the multiplication module 215F and the 2*m+2 LSBs of the output of the first shifting module 220F. The 3:2 counter 232F generates two 2*m+2 bit words as a carry-save output. The adding module 230F further comprises a two's complement adder 234F couples to the output of the 3:2 counter 232F and an incrementing module 235F, having a first input for receiving the m+1 MSBs of the output of the first shifting module 220F and a second input for receiving a carry out bit from the two's complement adder 234F, to produce a significand in a non-redundant representation. In an alternative implementation, both modules may be substituted by a 3*m+3 bit two's complement adder having the m+1 MSBs of one of its inputs couple to zero, or a different circuit if the redundant representation selected is other. The m+1 bit output of the incrementing module 235F and the 2*m+2 output of the two's complement adder 234F comprise a 3*m+3 bit number that corresponds to the significand of result of the fused multiply-add operation before normalization. Said 3*m+3 bit number is input to a normalization module 240F. The incrementing module 235F further produces an overflow bit at a second output. In other implementations, the overflow information may be obtained from the output of a Leading Zero Anticipator (LZA), and this explicit output may not be required.
[0264] The significand data path 210F further comprises a Leading Zero Anticipator (LZA) 237F having a first input coupled to the output of 3:2 counter 232F and a second input for receiving the m+1 MSBs of the output of the first shifting module 220F. LZA 237F also receive an instruction (not shown in the figure) about the effective operation when no shifting is performed in the first shifting module. LZA 237F calculates the required left shift to normalize the result. In an alternative implementation, the LZA may take the inputs directly from the outputs of the multiplication module 215F and the first shifting module 220F or at a later stage from the output of the adding module 230F.
[0265] One skilled in the art may appreciate that the adding module 230F and the LZA 237F may be implemented (together or separately) in many different ways without departing from the scope of the invention.
[0266] The normalization module 240F comprises a left shifting module 242F and a conditional bit inverter 244F. The left shifting module 242F receives the 3*m+3 number from the adding module 230F at a first input and generates an m+1 bit normalized and rounded preprocessed number, having the LSB implicit and equal to one. It performs this operation based on a second shift amount received from the LZA 237F at a second input. The m MSBs of said preprocessed number is then input to conditional bit inverter 244F to negate it if its MSB is zero. This last indicates a negative result of the addition, since said MSB is the integer bit and it should be one (normalized number). One skilled in the art may appreciate that different options to detect a negative result of the addition may be used. On the other hand, in an alternative implementation, the conditional bit inverter may be before the left shifting module. The m-bit output of the conditional inverter 244F corresponds to the m MSBs of the preprocessed significand of the final result of the FMAD operation. The LSB of said preprocessed significand is implicit and it is equal to 1. It should be noted that in this implementation the m MSBs of the significand include the integer bit which is always one. Therefore, in an alternative implementation, the integer bit may be discarded after the normalization.
[0267] FIG. 9 y 10 illustrate different alternative implementation of the left shifting module 242F according to other examples. The left shifting module 242F allows avoiding of the bias produced by rounding in certain cases when a standard left shifter is used, as in the example of FIG. 7. The left shifting module represented in FIG. 9 comprises a special left shifter 370F having a first input coupled to the first input of left shifting module 242F. However, the LSB is coupled to a random bit. A second input of special left shifter 370F is coupled to the shift amount from the second input of the left shifting module 242F. This is a special shifter in such a way that in a left shift, the vacant positions are filled with a bit that comes from a third input of the special shifter which is coupled to the inverse of said random bit. The random bit may be any selected bit or the result of the combination of several selected bits of the first input or any other bit with adequate statistical characteristics. The output of special left shifter 370F comprises the m MSBs of the shifted value, which is the output of the left shifting module 242F. This example of implementation of the left shifting module 242F avoids the bias produced in a FMAD operation, as in the example of FIG. 7, when the shift amount (number of non-significant leading bits) is greater than 2*m+3 (when an effective subtraction operation produces a cancellation). In an alternative implementation, since the LSB of the first input is discarded, this bit may not be generated at the output of the adding module 230F.
[0268] FIG. 11 shows an example of device according to embodiments disclosed herein. The device 100 comprises an arithmetic unit 100C configured to process preprocessed floating point numbers and generated preprocessed floating point numbers. An input converter 110C is coupled at the input of said device. The input converter 110C is configured to convert an input number to a first preprocessed floating point number. Accordingly, the device comprises an output converter 120C coupled at the output of the arithmetic unit 100C and configured to receive a second preprocessed floating point number and generate an output number. Said input and output numbers may be unprocessed or preprocessed numbers, either fixed point or floating point. Furthermore, the converter 110C and/or the converter 120c may be internal to arithmetic unit 100C. In other implementations only one converter may be present at the input or at the output of arithmetic unit 100C. In yet other implementations the device may comprise a plurality of converters at the input and/or at the output of said arithmetic unit 100C for converting, e.g. in parallel, a plurality of input numbers, respectively.
[0269] The FP arithmetic units described above require FP numbers that have been preprocessed according to the invention as described also above. These preprocessed numbers may be generated by circuits, such as the aforementioned FP adders, that are designed to function with preprocessed numbers or they may be generated by converters, designed to convert unprocessed numbers or preprocessed non-FP numbers to preprocessed numbers. Furthermore, the preprocessed numbers generated by the adders described above may, accordingly, require converters so that the numbers generated may be used by circuits that are not designed to process preprocessed numbers.
[0270] In the following examples, it is considered that floating point numbers, both unprocessed and preprocessed) are represented by a sign bit, an exponent, and a unsigned normalized significand such as the MSB is equal to one and it is explicitly included in the significand representation. In the same way, fixed point numbers, both unprocessed and preprocessed, are represented in two's complement representation, being the MSB equivalent to the sign bit. However, one skilled in the art may appreciate that other formats having a different representation may be used with minor modifications to the disclosed circuits. Some of these variations may be:
a) in FP:
[0271] implicit representation of the MSB of the significand, or [0272] fused representation of sign and significand by two's complement representation or any other representation
b) in fixed point: sign-and-magnitude representation, or natural representation
[0273] One category of such converters is converters for converting preprocessed integer numbers to preprocessed FP numbers. FIG. 12 illustrates an example of such a converter for a preprocessed integer numbers of m+2 bits and a preprocessed FP number having a significand of n+1 bits. Converter 600 comprises a normalization module 630 having a conditional bit inverter 605 in series with a preprocessed left shifter 610. The conditional bit inverter has a first input for receiving the m LSBs of an m+1 MSBs of the m+2 bits preproccesed fixed point number. The MSB of the m+2 bits number is the sign and shall be the sign of the preprocessed FP number as well as used to control the conditional bit inverter 605. The m-bit output of the conditional bit inverter 605 is input to preprocessed left shifter 610. In alternative implementations the special preprocessed left shifter 610 precedes the conditional bit inverter 605. The function of preprocessed left shifter 610 is described in more detail in FIG. 6a. The preprocessed left shifter 610 requires a special left-shifter 610a with a new third one-bit input which allows selecting the value used to fill the vacant positions after shifting. An implementation of the special left-shifter 610a may be similar to the one of the special left-shifter 245 illustrated in FIG. 2a. In this example of FIG. 13a, the maximum shift amount is m or m+1. If the fixed point number is equal to zero and the bit R in FIG. 13a is also equal to zero, it requires a maximum shift amount having an additional bit (m+1) so that the significand is normalized. Alternatively, if the integer is equal to zero, it may be treated as a special case and be converted to FP zero. Then the maximum shift amount would be equal to m.
[0274] Using this special left-shifter 610a, the input value of preprocessed left shifter 610 is augmented with an additional LSB set to any random bit (for instance, the LSB of the initial input value) and the third input of the special left-shifter is set to the inverted random value to fill both, the vacant positions required to complete the size of n if n>m+1, and the vacant positions produced after shifting. The output of preprocessed left shifter 610 comprises the n MSBs of the significand Mz of the preprocessed FP number. Said output corresponds only to the n MSBs of the shifted value if n<m. The LSB of the significand Mz is implicit and it is equal to 1.
[0275] In a parallel path, the converter 600 comprises el módulo detector de uno de cabecera (LOD) 615 having an input coupled to the output of conditional bit inverter 605 and an output for generating the shift amount for the special preprocessed left shifter 610 which is also used as input to exponent computation module 620 to generate the exponent Ez of the preprocessed FP number. Alternatively, the input of LOD module 615 may be directly coupled at the input of converter 600, but in this case it should detect the first zero, instead of the one, when the number is negative.
[0276] Compared with conventional fixed point FP converters, when M>N, there is no rounding up taking place after the shifting operation and therefore there is a reduction in components and processing. When M<N, then there is no bias produced because of the rounding with the used of the proposed converter.
[0277] Another category of converters are converters for converting unprocessed fixed point numbers to preprocessed floating point numbers. FIG. 14 illustrates such a converter. Converter 700 comprises a normalization module 705 arranged to receive the m LSBs of an m+1 bit fixed point number. The MSB of the fixed point number is the sign of the fixed point number and it is used to control the normalization module 705 and to set the sign of the preprocessed FP number. The normalization module 705 may be similar to normalization modules 230 and 330 discussed in reference to FIG. 2 y 3. Furthermore, the normalization module may be implemented according to examples described in FIG. 14a and FIG. 14b. In FIG. 14a, normalization module 705a comprises special left-shifter 706a which is similar to special left-shifter 610a described in FIG. 13a. In this case the special left-shifter 706a receives the m−1 MSBs of the m LSBs of the unprocessed fixed point number, extended to the right with a bit set to zero and the LSB of the fixed point number is used as the third input of the special left-shifter 706a. The output of the special left shifter 706a corresponds to the n MSBs of the shifted value and it is input to a conditional bit inverter 708a having a second input for receiving the sign bit of the fixed point number. The output of the conditional bit inverter 708a is the n MSBs of the significand Mz of the FP preprocessed number. The LSB of the significand is implicit and it is equal to 1. In other implementations, the MSB of the normalized significand Mz may not include the leading one. Therefore, the output of the conditional bit inverter may be one bit less.
[0278] La FIG. 14b shows an alternative implementation of normalization module 705. Normalization module 705b comprises first a conditional bit inverter 706b for receiving the m LSBs of the unprocessed fixed point number. The output of conditional bit inverter 706b is input to special left-shifter 708b. The m−1 MSBs of the output of conditional bit inverter are introduced at the input of special left-shifter 708b while the LSB is used as the third input. Further the sign bit is introduced as the LSB of the first input of the special left-shifter 708b to augment the m−1 bits. The n-bit output of the special left-shifter is the n MSBs of the significand Mz of the FP preprocessed number. The LSB of the significand is implicit and it is equal to 1.
[0279] Returning to the converter 700 in FIG. 14, a parallel path comprises LOD module 710 having an input receiving the unprocessed fixed point number and an output for generating the shift amount for the normalization module 705 which is also used as input to exponent computation module 715 to generate the exponent Ez of the preprocessed FP number. In other implementations which may use normalization modulo 705b, the input of LOD module 710 may receive the output of the conditional bit inverter 706b instead.
[0280] Another category of converters is converters for converting preprocessed FP numbers to preprocessed FP numbers of different size of significand. FIG. 15a is an example of such a converter. Converter 800a illustrates a converter adapted to convert a preprocessed FP number having an n+m+1 bit significand to an n+1 significand. The LSB of both significands is equal to 1 and is therefore not depicted. The sign (sign_x) of the original preprocessed FP number is going to remain the same in the target preprocessed FP number (depicted as sign_z). The n MSBs of the original significand shall be the n MSBs of the target preprocessed significand. That is, a simple truncation function takes place. Therefore, no overflow bit is generated and an exponent calculator 801a can generate the target exponent Ez simply based on the original exponent Ex.
[0281] FIG. 15b is another example of a preprocessed-FP-to-preprocessed-FP numbers converter. Converter 800b illustrates a converter adapted to convert a preprocessed FP number having an m+1 bit significand to an n+m+1 significand. Converter 800b is a biased version of such a converter. Again, The LSB of both significands is equal to 1 and is therefore not depicted. According to converter 800b, the sign bit remains the same, exponent calculator 801b computes the new exponent, and a circuit to expand the significand size by adding to the right a lagging one bit and as many zeros as required to complete the new significand size. Alternatively, it may be used a zero followed by ones.
[0282] FIG. 15c is yet another example of a preprocessed-FP-to-preprocessed-FP numbers converter. Converter 800c illustrates a converter adapted to convert a preprocessed FP number having an n+1 bit significand to an n+m+1 significand. Converter 800c is a unbiased version of such a converter. Again, The LSB of both significands is equal to 1 and is therefore not depicted. According to converter 800c, the sign bit remains the same, exponent calculator 801c computes the new exponent, and a circuit to expand the significand size by adding (to the right) a randomly selected bit value and as many bits with the inverse value as required to complete the new significand size. The random bit could be any of the initial significand one or combination of them, such as the second LSB, as shown in FIG. 8c.
[0283] Another category of converters is converters for converting preprocessed FP numbers to preprocessed fixed point number numbers. FIG. 16 illustrates such a converter for converting an FP number having an n+m+1 bit significand and a d-bit exponent to an fixed point number of n+2 bits. The n MSBs of the significand are input to conditional bit inverter 905. The LSB of the significand is equal to 1 and is not introduced. The sign of the preprocessed FP number is used to control the conditional bit inverter 905. The output of the conditional bit inverter 905 along with the sign (sign_x) is input to right shifter 910. Right shifter 910 has another input for receiving the shift amount from shift amount calculator 915. Shift amount calculator 915 receives the exponent of the preprocessed FP number and generates the shift amount. The output of the right shifter 910 is the n+1 MSBs of the preprocessed fixed point number. The LSB is similarly equal to 1 and is neither generated nor depicted.
[0284] FIG. 17a illustrates a biased converter for converting a preprocessed FP number having an n+1 bit significand and a d-bit exponent to a preprocessed fixed point number of n+m+2 bits. The n MSBs of the significand are input to conditional bit inverter 1005a. The LSB of the significand is equal to 1 and is not introduced. The sign of the preprocessed FP number is used to control the conditional bit inverter 1005a. The output of the conditional bit inverter 1005a along with the sign (sign_x) is input to right shifter 1010a. The output of the conditional bit inverter is expanded by adding to the right a lagging 1 and as many zeros as required to complete the new size. In an alternative implementation, this expansion may be performed with a bit to zero and as may bits to one as necessary. This expanded number is input to the right shifter 1010a. Right shifter 1010a has another input for receiving the shift amount from shift amount calculator 1015a. Shift amount calculator 1015a receives the exponent of the preprocessed FP number and generates the shift amount. The output of the right shifter 1010a is the n+m+1 MSBs of the preprocessed fixed point number. The LSB is similarly equal to 1 and is neither generated nor depicted.
[0285] FIG. 17b illustrates an unbiased converter for converting a preprocessed FP number having an n+1 bit significand and a d-bit exponent to a preprocessed fixed point number of n+m+2 bits. The n MSBs of the significand are input to conditional bit inverter 1005b. The LSB of the significand is equal to 1 and is not introduced. The sign of the preprocessed FP number is used to control the conditional bit inverter 1005b. The output of the conditional bit inverter 1005b along with the sign (sign_x) is input to right shifter 1010b. The output of the conditional bit inverter is expanded by adding to the right a randomly selected bit value and as many bits with the inverse value as required to complete the new size. The random bit could be any of the initial significand or a combination of them. This expanded number is input to the right shifter 1010b. Right shifter 1010b has another input for receiving the shift amount from shift amount calculator 1015ab. Shift amount calculator 1015b receives the exponent of the preprocessed FP number and generates the shift amount. The output of the right shifter 1010b is the n+m+1 MSBs of the preprocessed fixed point number. The LSB is similarly equal to 1 and is neither generated nor depicted.
[0286] In other implementations of the examples in FIG. 16, 17a y 17b, the MSB of the normalized significand may not include the bit 1 header. Therefore, this ibt to 1 may be added in the conditional bit inverter.
[0287] Another category of converters is converters for converting unprocessed FP numbers to preprocessed FP numbers. In a first case, the significand of the original FP number is larger than the significand of the target FP number. The converter discussed with reference to FIG. 15a may be used but some bias is introduced. In case of unbiased rounding, the new significand is calculated with the circuit illustrated in FIG. 18. For an n+m+1 bit significand, the n−1 MSBs remain the same in the original and in the target FP numbers. The nth MSB of the new significand is set to zero if the m+1 LSBs of the original significand are all zero, and to the nth MSB of the original significand in other case. The LSB of new significand shall be 1, as the FP number is a preprocessed FP number.
[0288] When the significand of the FP preprocessed number shall have more bits (n+m+1) than the significand of the unprocessed FP number (n), then:
a) in the case of biased rounding, the significand of the unprocessed number is expanded with as many zeros as necessary. This is illustrated in FIG. 19a. The LSB shall be equal to 1 and it is implicit.
b) in the case of unbiased rounding, the n−1 MSBs are the same. The nth bit is forced to zero. The m+1 bits to the right are set equal to the LSB of the unprocessed significand. This is illustrated in FIG. 19b. The LSB of the preprocessed significand shall be 1, as the FP number is a preprocessed number.
[0289] Another category of converters is converters for converting preprocessed FP numbers to unprocessed FP numbers. When the significand of the preprocessed FP number has more bits (n+m+1) than the significand of the unprocessed one (n), then the circuit illustrated in FIG. 20 may be used. The sign remains the same. The n+1 MSBs of the preprocessed significand are rounded to n by the rounder 1310. Rounder 1310 also generates an overflow bit that is used by exponent calculator 1320 to generate the exponent of the unprocessed FP number. The rounder 1310 is explained in FIG. 20a. An adder 1310a is used to increment by one the n MSBs of the preprocessed significand if the n+1th MSB is one. In alternative implementations different rounding units performing different rounding modes may be used. When the significand of the preprocessed FP number has less bits (m+1) than the significand of the unprocessed (m+n), then the circuit illustrated in la FIG. 15b may be used.
[0290] In an alternative implementation, the rounder may perform another type of rounding.
[0291] Yet another category of converters is converters for converting preprocessed FP numbers to unprocessed fixed point numbers. FIG. 21 illustrates such a converter where the number of bits of the input significand is greater than the number of bits of the output fixed point number. It comprises a sub-converter 1410 which corresponds to a preprocessed-FP-to-preprocessed-fixed point number converter 900 as discussed with reference to FIG. 16. The sub-converter 1410 receives the exponent Ex, the bit of the sign of the FP number (sign_x) and the significand Mx that comprises n+m bits. It generates a preprocessed fixed point number of n+2 bits at an output. Coupled to the output of said sub-converter 1410 is a rounding unit 1415 that includes an incrementer 1420 similar to the adder 1310a described with reference to FIG. 13a, to increment the n+1 MSBs of said output if the LSB is one. The output of the adder 1420 and consequently of the rounding unit 1415 is an unprocessed fixed point number of n+1 bits. In an alternative implementation, the rounder may perform another type of rounding.
[0292] If the number of bits of the input significand is lower than the number of bits of the output fixed point number, such a converter may be identical to the converter 1000a described in FIG. 10a.
[0293] FIGS. 22a to 22e illustrate the implementations of a fixed point adding module according to different examples. A fixed point adding module 300SFJ, or 400SFJ, receives the n MSBs of a first preprocessed fixed point number of n+1 bits and the n+m+1 MSBs of a second preprocessed fixed point number of n+m+2 bits, at a first and second input, respectively, being m≧0. The fixed point adding module 300SFJ, or 400SFJ generates the z MSBs of a third preprocessed fixed point number of z+1 bits corresponding to the addition of both input numbers. The LSB of the preprocessed fixed point numbers is equal to 1 and is not required to be introduced or generated explicitly in the adding module. The fixed point adding module 300SFJ or 400SFJ comprises an n-bit adder 320SFJ, or 420SFJ, having the first and second n-bit inputs couple to the n MSBs of the first and the second preprocessed fixed point numbers, respectively, and the carry input coupled to the (n+1)th MSB of said second preprocessed fixed point number. The adder 320SFJ, or 420SFJ, generates the n MSBs of the third preprocessed fixed point number. FIG. 1b shows the boundary case wherein z=n. In the case that z>n, the (n+1)th MSB of the third preprocessed fixed point number is set to the inverse of the (n+1)th MSB of the second preprocessed fixed point number while the z−n−1 LSBs of said third preprocessed number are set equal to the z−n−1 LSBs of the second preprocessed fixed point number. FIG. 22a shown the boundary case wherein z=n+m+1. On the other hand, if z<n, the n-bit adder 320SFJ may be substitute for a z-bit adder to add the z MSBs of the first and second preprocessed input numbers, and a carry net module to generate the carry input of said z-bit adder, taking into account the n+1−z LSBs of the n+1 MSBs of said first and second input numbers. The LSB of the third preprocessed number is equal to 1, it doesn't need to be generated, and it is implicit in these examples.
[0294] FIG. 22c y 22d illustrate a fixed point adding module according to other examples wherein input numbers have the same size which provokes that the exact result of addition may not be a preprocessed number. A fixed point adding module 100SFJ or 200SFJ receives the n MSBs of a first and second preprocessed fixed point number at a first and second input, respectively, each preprocessed fixed point number having n+1 bits. The LSB of the preprocessed fixed point numbers is equal to 1. The fixed point adding module 100SFJ or 200SFJ generate a third preprocessed fixed point number corresponding to the addition of both input numbers rounded without bias. A fixed point adding module 100SFJ or 200SFJ comprises an adder 120SFJ or 220SFJ, which generates the n−1 MSBs of the third preprocessed fixed point number. The nth MSB is set to 0 while the LSB is again equal to 1 and needs not be generated or outputted. In FIG. 22c the adder 120SFJ may produce n bits, but only the n−1 MSBs of its output is used, whereas the carry input Cin is coupled to 1. In FIG. 22d the adder 220SFJ has n−1 bits and the carry input is coupled to an OR gate 225SFJ having the two inputs coupled to the nth MSB of the first and second preprocessed fixed point number, respectively. In an alternative implementation, if bias is not a problem, the nth MSB of the third preprocessed fixed point number may be generated by the adder instead of setting it to zero. In another alternative implementation, shown in FIG. 22e, the adding module may be arranged to produce the exact result of the addition, which is an unprocessed number, by outputting explicitly the LSB set to zero along with the output of adder 120SNFXFJ.
[0295] On the other hand, there are two different cases when one of the input numbers is an unprocessed number. When the size of the unprocessed input number is equal or greater than the size of the preprocessed number, the exact result of the addition may be an unprocessed number. The implementation of a fixed point adding module arranged to receive the N MSBs of a first preprocessed fixed point number of n+1 bits and the n+m+1 bits of a second unprocessed fixed point number, may be similar to the circuit shown in FIG. 22a. However, in this case, there is no implicit LSB at the output, which is an unprocessed fixed point number of n+m+1 bits. If a preprocessed output number is desired, an unprocessed to preprocessed converter, similar to the ones described subsequently herein, may be used. On the other hand, when the size of the unprocessed input number is lower than the size of the preprocessed one, the exact result of the addition is a preprocessed number. In this case, the fixed point adding module is arranged to receive the n bits of a first unprocessed fixed point number and the n+m MSBs of a second preprocessed fixed point number of n+m+1 bits. The n MSBs of the result is obtained by adding the n bits of the first number and the n MSBs of the second number, whereas the m+1 LSBs are the m+1 LSBs of the second number. This last includes the LSB which is implicit and equal to one. Since the result is a preprocessed number, a rounded to nearest output with fewer bits may be obtained just by truncating said result.
[0296] FIG. 23 illustrates a fixed point subtractor according to an example. A preprocessed fixed point subtracting module 100SUBFJ receives the m MSBs and the n MSBs of a first and a second preprocessed fixed point number, of m+1 and n+1 bits, at a first and a second input, respectively, and generates a third preprocessed fixed point number of z+1 bits corresponding to the first input number minus the second one. The LSB of the preprocessed fixed point numbers is equal to 1 and need not be introduced or generated. Preprocessed fixed point subtracting module 100SUBFJ comprises a preprocessed fixed point adding module 120SUBFJ, similar to the ones presented before, arranged to receive said first input and the bit-wise inversion of said second input with bit inverter 125SUBFJ, which in practice negates the second preprocessed number. The z-bit output of said preprocessed adding module corresponds to the z MSBs of the result of subtraction, whereas its LSB is implicit and equal to one. A very similar implementation is shown in FIG. 24, which corresponds to a preprocessed fixed point adding/subtraction module 100ADDSUBFJ. The bit-wise inverter is substituted by a conditional bit inverter 105ADDSUBFJ, to selectively invert the second input. Thus, said module produces the desired addition or subtraction of the input numbers according to a control signal c1.
[0297] In the following examples of multipliers (including squarers and constant multipliers), it is considered, unless otherwise stated, that fixed point numbers are unsigned. However, one skilled in the art may appreciate that two's complement numbers may be operated instead, by making known modifications to the disclosed circuits, such as sign extension instead of zero extension for additions.
[0298] FIG. 25a illustrates the implementation of a preprocessed fixed point multiplication module according to an example. A preprocessed fixed point multiplication module 100MFJ receives the m MSBs and the n MSBs of a first and second preprocessed fixed point number, of m+1 and n+1 bits, at a first and second input, respectively, and generates a third preprocessed fixed point number of z+1 bits corresponding to the multiplication of both input numbers. The LSB of the preprocessed fixed point numbers is equal to 1 and need not be introduced at the input of said module. Preprocessed fixed point multiplication module 100MFJ comprises a fixed point multiplier 110MFJ arranged to receive said first and second inputs augmented to the right with the LSB of the preprocessed numbers and generates the n+m+1 MSBs of the multiplication of both numbers. The introduction of this additional one may be performed internally to the multiplier without the need for a special input. They are merely illustrated to indicate that the multiplier shall take them into account when performing the multiplication operation. The z MSBs of the output of the multiplier 110MFJ corresponds to the z MSB of the third preprocessed fixed point number. The LSB is equal to 1 and needs not be stored or generated. In alternative implementations the fixed point multiplier may just generate the product of the first and second input of the multiplication module, and said product may be added with said first and second input shifted one bit to the right to produce the correct result, corresponding to the product of the (full) input numbers.
[0299] Since, only the z MSBs of the multiplication are delivered, the multiplier circuit may be optimized by avoiding the computation of the LSBs.
[0300] FIG. 25b illustrates an implementation example of a preprocessed fixed point multiplier which avoids the generation of said LSBs. Fixed point multiplier 200MFJ comprises a redundant multiplier 205MFJ, a carry net module 207MFJ and a conversion module 209MFJ. The redundant multiplier 205MFJ receives, at a first and a second input, the m MSBs and the n MSBs of the first and second preprocessed fixed numbers, of m+1 and n+1 bits, respectively, and two additional inputs coupled to 1, so that the m bits at the input of each fixed point number are augmented to the right by 1 bit. However, in alternative implementations, the introduction of the additional one may be performed internally to the module 205MFJ without the need for a special input. It is merely illustrated in the example of FIG. 25b, and in other subsequent examples, to indicate the need for the functional introduction of the implicit LSB. The redundant multiplier 205MFJ generates, in a redundant representation format, the n+m+1 MSDs of a value corresponding to the multiplication operation between said preprocessed fixed point numbers. The LSD of said result is always one and it is not required explicitly. The redundant multiplier 205MFJ shown in FIG. 25b generates the result in carry-save format and then said result is delivered at a first and a second n+m+1 bit outputs, corresponding to the sum word and carry word respectively. However, one skilled in the art may appreciate that other redundant representation formats may be used with minor modifications to the disclosed circuits, such as signed digit representations.
[0301] The carry net module 207MFJ receives the n+1 LSDs of the output, which does not include the implicit LSB of the preprocessed format, of said redundant multiplier and generates the carry bit corresponding to the conversion of said digits to a non-redundant binary representation. In this particular example, since carry-save representation is used, the carry net module 207MFJ receives the n+1 LSBs of the sum and carry words, at a first and a second input, respectively, and generates the last carry bit corresponding to the addition of both inputs.
[0302] The conversion module 209MFJ receives the m MSDs of the output of the redundant multiplier 205MFJ and the carry bit from the carry net module 207MFJ, and generates the m bits corresponding to the m MSBs of the value of the multiplication of the input fixed point numbers in a non-redundant representation. In this particular example, since carry-save representation is used, the conversion module 209MFJ receives the m MSBs of the sum and carry words at a first and a second input, respectively, and the carry bit at a third input and generates a value corresponding to the addition of both input words and the carry bit. Besides, in this particular example, the size of the output and the first input are equal, but in an alternative implementation the size of the output may be z+1 bits, being z<n+m. In this case, the carry net module 207MFJ may receive the n+m−z+1 LSDs of the output of the redundant multiplier, and the conversion module 209MFJ, the z MSDs.
[0303] FIG. 26a y 26b illustrate the implementations of a redundant multiplier for preprocessed numbers 300MFJ, y 400MFJ, respectively, in which the LSB of the input numbers is not received. The redundant multiplier for preprocessed numbers in FIG. 26a, and FIG. 26b, only receives the m MSBs, and the n MSBs, of a first, and a second, preprocessed fixed point number (X and Y) of m+1, and n+1 bits, respectively, because the LSB is constant and equal to zero. Said redundant multiplier generates, in a redundant representation, the m+n+1 MSDs of the multiplication result of both input numbers, the LSB of such result being also implicit and equal to zero. In other words, if the m MSBs of X are represented by X′, y the m MSBs of Y by Y′, so the value of the n+m+1 digits output is equal to X′*Y′+1/2X′+1/2Y′.
[0304] The redundant multiplier for preprocessed numbers represented in FIG. 26a comprises a partial products generator module 325MFJ and a compressor tree 330MFJ. The partial products generator module 325MFJ receives said m MSBs, and n MSBs, from both preprocessed fixed point numbers, in a first and in a second input, respectively, and generates the partial products corresponding to the product of the first input per each bit of the second input. In an alternative implementation, the second entry may be divided in several groups of bits and the generated partial products may correspond to the products of the first input per each group of bits.
[0305] The compressor tree 330MFJ receives the output of the partial product generator module 325MFJ and a copy of the two inputs of the partial product generator module 325MFJ and generates a m+n+1 digit redundant output corresponding to the addition of all its inputs correctly aligned. It should be noted that said copies are aligned, such that the second LSB is aligned with the LSB of the least significant partial product (the one corresponding to the LSB of the second input). In this particular example, since carry-save representation is used, two m+n+1 bit numbers are produced corresponding to the sum and carry words. In an alternative implementation, a different redundant representation format may be used. In other implementations if non redundant output is desired, a conversion module may be used to transform the output of the compressor tree 330MFJ to a non-redundant m+n+1 bit number corresponding to the m+n+1 MSBs of the product of the initial preprocessed numbers.
[0306] The preprocessed redundant multiplier represented in FIG. 26b is similar to the previous one, but the second input is recoded (for example it may be Booth recoded) before entering the partial product generator module 325bMFJ to produce less partial products, by using a recodification module 320bMFJ. The value 1 is also inserted at the input of the recodification module 320bMFJ so that the n bits at the second input are augmented to the right by 1 bit corresponding to the implicit LSB. However, in other implementations the introduction of the additional one may be performed internally to the recodification module 320bMFJ without the need for a special input. It is merely illustrated in the example to indicate the need for the functional introduction of the implicit LSB. Similarly, the LSB of the other input is also illustrated at the first input of the partial product generator module 325bMFJ.
[0307] The architectures shown with reference to FIGS. 25a-26ba, may be implemented for either unsigned or signed numbers by using the adequate modules accordingly, such as unsigned or signed fixed point multiplier. However a different approach may be utilized to implement multiplication modules for signed preprocessed numbers. This is based on using the unsigned version of any of the examples shown before and the conversion of two's complement input numbers to sign-and-magnitude format. This conversion may easily be implemented for preprocessed numbers using a conditional bit inverter to invert the n−1 LSBs of the n MSBs of a preprocessed number of n+1 bits, if it is negative Then, the magnitude may be operated by the unsigned multiplier module while the sign may be processed apart. Finally, a conversion from the sign-and-magnitude result to two's complement number, which is similar to the previous one, is required. Besides, one skilled in the art may appreciate that it may be easy to modify this design to support both formats at the same unit.
[0308] FIGS. 27a and 27b illustrate the implementations of a preprocessed fixed point squaring module according to two examples, considering unsigned input. A preprocessed fixed point squaring module 100SQFJ or 100bSQFJ receives the m MSBs of a first preprocessed fixed point number of m+1 bits, at a first input and generates a second preprocessed fixed point number of z+1 bits corresponding to the squaring of the input number. The LSB of the preprocessed fixed point numbers is equal to 1 and need not be introduced at the input of said module. Preprocessed fixed point squaring module 100SQFJ of FIG. 27a comprises a fixed point squarer 110SQFJ arranged to receive said first input augmented to the right with the LSB of the preprocessed number and generates the 2m MSBs of the squaring of said number. The introduction of this additional one may be performed internally to the squarer without the need for a special input. They are merely illustrated to indicate that the squarer shall take them into account when performing the multiplication operation. The output of the squarer 110SQFJ is augmented to the right with a bit set to zero, corresponding to the second LSB of the result of the squaring operation. Said zero bit may be outputted by the squarer (or even avoided if z<2m+1). It is illustrated apart merely to indicate that its calculation is not required. The z MSBs of said augmented output of the squarer corresponds to the z MSB of the second preprocessed fixed point number. The LSB is equal to 1 and needs not be stored or generated.
[0309] Alternatively, preprocessed fixed point squaring module 100bSQFJ of FIG. 27b comprises a fixed point squarer 110bSQFJ arranged to receive just said first input and generate the 2*m bits of the squaring of said input. An adder 120bSQFJ is utilized to incorporate the effect of the implicit LSB of the input number by adding the n MSBs of said input preprocessed number, aligned to the right, to the output of the squarer 110bSQFJ. In other implementations, said addition may be performed within the squarer 110bSQFJ or the zero extension may be performed within the adder. Similarly to example of FIG. 27a, the output of the adder 120bSQFJ may be augmented to the right with a zero bit if z>2*m. The z MSBs of the output of the adder 120bSQFJ (augmented if it is required) corresponds to the z MSB of the second preprocessed fixed point number. The LSB is equal to 1 and needs not be stored or generated.
[0310] Since, only the z MSBs of the squaring are delivered, the squarer circuit may be optimized by avoiding the computation of the LSBs. FIG. 27c illustrates an implementation example of a preprocessed fixed point squarer which avoids the generation of said LSBs. Fixed point squarer 300SQFJ comprises a redundant squaring module 305SQFJ, a carry net module 307SQFJ and a conversion module 309SQFJ. The redundant squaring module 305SQFJ receives, at a first input, the m MSBs of the first preprocessed fixed number of m+1 bits and an additional input coupled to 1, so that the m bits at the input are augmented to the right by 1 bit. However, in alternative implementations, the introduction of the additional one may be performed internally to the module 305SQFJ without the need for a special input. It is merely illustrated in the example of FIG. 27c, and in other subsequent examples, to indicate the need for the functional introduction of the implicit LSB. The redundant squaring module 305SQFJ generates, in a redundant representation format, the 2m MSDs of a value corresponding to the squaring of the preprocessed input number. The second LSD and the LSD of said result are always zero and one respectively and they are not required explicitly. The redundant squaring module 305SQFJ shown in FIG. 27c generates the result in carry-save format and then said result is delivered at a first and a second 2m bit outputs, corresponding to the sum word and carry word respectively. However, one skilled in the art may appreciate that other redundant representation formats may be used with minor modifications to the disclosed circuits, such as signed digit representations.
[0311] The carry net module 307SQFJ receives the 2*m−z LSDs of the output of said redundant squaring module 305SQFJ, and generates the carry bit corresponding to the conversion of said digits to a non-redundant binary representation. In this particular example, since carry-save representation is used, the carry net module 307SQFJ receives the 2*m−z LSBs of the sum and carry words, at a first and a second input, respectively, and generates the last carry bit corresponding to the addition of both inputs.
[0312] The conversion module 309SQFJ receives the z MSDs of the output of the redundant squaring module 305SQFJ and the carry bit from the carry net module 307SQFJ, and generates the z bits corresponding to the z MSBs of the value of the squaring of the input fixed point number in a non-redundant representation. In this particular example, since carry-save representation is used, the conversion module 309SQFJ receives the z MSBs of the sum and carry words, at a first and a second input, respectively, and the carry bit at a third input and generates a value corresponding to the addition of both input words and the carry bit.
[0313] FIG. 28 illustrates an implementation of a preprocessed redundant squaring module according to one example, wherein the LSB of the input number is not received. Thus, said module receives only the m MSBs of a preprocessed fixed point number (X), since the LSB is constant and equal to one. Said preprocessed redundant squaring module 405SQFJ generates, in a redundant representation, the 2*m MSDs of the result of the squaring the preprocessed input, being the second LSB and the LSB of said result implicit and equal to zero and one, respectively. Said in a different way, if the m MSBs of X are represented by X′, then the 2*m digit value at the output is equal to X′̂2+X′. The preprocessed redundant squaring module 405SQFJ comprises a partial product generator module 425SQFJ and a compressor tree 430SQFJ. The partial product generator module 425SQFJ receives said m MSBs of the preprocess fixed point number at a first input, and generates a set of partial products, which allows, by adding them, to obtain a value corresponding to the squaring of said first input (i.e., X′̂2). One skilled in the art may appreciate that there are different sets of partial products which may be utilized depending on the degree of optimization desired.
[0314] The compressor tree 430SQFJ receives the output of the partial product generator module 425SQFJ and a copy of the m MSBs of the preprocessed input number and generates a 2*m digit redundant output corresponding to the addition of all its inputs correctly aligned. We should note that said m MSBs are aligned in such a way, that, its LSB is aligned with the LSB of the least significant partial product. In an alternative implementation said m MSBs may be introduced either within the compressor tree 430SQFJ or the partial product generator module 425SQFJ. In this particular example, since carry-save representation is used, two 2*m bit numbers are produced corresponding to the sum and carry words. In an alternative implementation, a different redundant representation format may be used. In other implementations if non redundant output is desired, a conversion module may be used to transform the output of the compressor tree 430SQFJ to a non-redundant 2*m bit number corresponding to the 2*m MSBs of the squaring of the initial preprocessed number.
[0315] In the examples shown in FIGS. 27a, 27b, 27c and 28, the preprocessed input number is considered unsigned. However, in alternative implementations of those examples, the input preprocessed number may be signed. In that case, the squarer used may be specifically arranged to support squaring of signed numbers instead of unsigned ones. Besides, the zero extensions required for additions, such as the one in example of FIG. 27b, should be substituted by a sign extension. However, a different solution is presented in the example of FIG. 29. Said FIG. 29 illustrates the implementations of a preprocessed fixed point squaring module 500SQFJ for signed input according to an example. The preprocessed fixed point signed squaring module 500SQFJ receives the m MSBs of a first preprocessed fixed point two's complement number of m+1 bits, at a first input, and generates a second preprocessed fixed point two's complement number of z+1 bits corresponding to the squaring of the input number. The LSB of the preprocessed fixed point numbers is equal to 1 and need not be introduced at the input, or generated at the output, of said module. Preprocessed fixed point signed squaring module 500SQFJ of FIG. 9 comprises a conditional bit inverter 510SQFJ and a preprocessed fixed point squaring module 520SQFJ for unsigned preprocessed numbers of m bits, similar to the ones presented in previous examples. The m−1 LSBs of the input are introduced to conditional bit inverter 510SQFJ. The MSB of said input, which is the sign of the preprocessed input number, is used to control the conditional bit inverter 510SQFJ. Conditional bit inverter 510SQFJ shall carry out a bit-wise inversion of said m−1 bits if said sign bit is equal to one. Thus, the output of the conditional bit inverter 510SQFJ, along with the implicit LSB, corresponds to the magnitude of the preprocessed input number, since said number is negated if it is negative. The m−1 bit output of the conditional bit inverter 510SQFJ is coupled to the preprocessed fixed point squaring module 520SQFJ, which generates the z−1 MSBs of the squaring of said magnitude. The output of the preprocessed fixed point squaring module 520SQFJ, augmented to the left with a sign bit, which is always zero, corresponds to the z MSBs of the second preprocessed fixed point two's complement number. The LSB is equal to 1 and needs not be stored or generated.
[0316] The examples shown in figures from FIGS. 27a to 28 are for unsigned input number whereas the example in FIG. 29 is exclusively for signed input number. However, one skilled in the art may appreciate that it is possible, with minor modifications, to design a new architecture combining them to support both formats at the same unit.
[0317] FIGS. 30a and 30b illustrate the implementations of a preprocessed fixed point constant multiplication module according to two examples. A preprocessed fixed point constant multiplication module 100MCFJ or 200MCFJ receives the m MSBs of a first preprocessed fixed point number of m+1 bits, at a first input and generates a second preprocessed fixed point number of z+1 bits corresponding to the multiplication of the input number and a constant preprocessed fixed point number of n+1 bits. The LSB of the preprocessed fixed point numbers is equal to 1 and need not be introduced at the input of said module. Preprocessed fixed point constant multiplication module 100MCFJ of FIG. 30a comprises a fixed point constant multiplier 110MCFJ arranged to receive said first input augmented to the right with the LSB of the preprocessed number and generates the n+m+1 MSBs of the multiplication of said number and said constant number. The introduction of this additional one may be performed internally to the multiplier without the need for a special input. They are merely illustrated to indicate that the multiplier shall take them into account when performing the multiplication operation. The z MSBs of the output of the constant multiplier 110MCFJ corresponds to the z MSB of the second preprocessed fixed point number. The LSB is equal to 1 and needs not be stored or generated.
[0318] Alternatively, preprocessed fixed point constant multiplication module 200MCFJ of FIG. 30b comprises a fixed point constant multiplier 110bMCFJ arranged to receive just said first input and generate the n+m+1 bits of the multiplication of said input and said constant number. An adder 120bMCFJ is utilized to incorporate the effect of the implicit LSB of the input number by adding the n MSBs of the constant number, aligned to the right, to the output of the constant multiplier 110bMCFJ. In the example of FIG. 30b an unsigned constant number is supposed, but sign extension instead of zero extension may be used for signed constants. In other implementations, a constant adder, optimized to add the constant value to its only input value, may be used instead of the adder 120bMCFJ and the external constant. In others implementation, said addition may be performed within the constant multiplier 110bMCFJ. The z MSBs of the output of the adder 120bMCFJ corresponds to the z MSB of the second preprocessed fixed point number. The LSB is equal to 1 and needs not be stored or generated.
[0319] In alternative implementations of the examples of FIG. 30a y 30b the desired constant number may not be a preprocessed number since its LSB may be zero. However, all the LSBs before the first bit equal to one may be removed to generate a preprocessed constant number. In some implementations, those LSBs equal to zero may added to the right of the output of the constant multiplier 110MCFJ, or 110bMCFJ, if any those bits corresponds to the integer part of the number to generate the correct result. In this case, the result may be an unprocessed number. In some implementation a unprocessed to preprocessed numbers converter may be use. In other ones, the unprocessed number may be the output number.
[0320] Since, only the z MSBs of the multiplication are delivered, the multiplier circuit may be optimized by avoiding the computation of the LSBs. FIG. 30c illustrates an implementation example of a preprocessed fixed point constant multiplier which avoids the generation of said LSBs. Fixed point constant multiplier 300MCFJ comprises a redundant constant multiplication module 305MCFJ, a carry net module 307MCFJ and a conversion module 309MCFJ. The redundant constant multiplication module 305MCFJ receives, at a first input, the m MSBs of the first preprocessed fixed number, and an additional input coupled to 1, so that the m bits at the input is augmented to the right by 1 bit. However, in alternative implementations, the introduction of the additional one may be performed internally to the module 305MCFJ without the need for a special input. It is merely illustrated in the example of FIG. 30c, and in other subsequent examples, to indicate the need for the functional introduction of the implicit LSB. The redundant constant multiplication module 305MCFJ generates, in a redundant representation format, the n+m+1 MSDs of a value corresponding to the multiplication operation between the preprocessed input number and a constant preprocessed fixed point number of n+1 bits. The LSD The LSD of said result is always one and it is not required explicitly. The redundant constant multiplication module 305MCFJ shown in FIG. 30c generates the result in carry-save format and then said result is delivered at a first and a second n+m+1 bit outputs, corresponding to the sum word and carry word respectively. However, one skilled in the art may appreciate that other redundant representation formats may be used with minor modifications to the disclosed circuits, such as signed digit representations.
[0321] The carry net module 307MCFJ receives the n+1 LSDs of the output of said redundant constant multiplication module 305MCFJ, which does not include the implicit LSB of the preprocessed format, and generates the carry bit corresponding to the conversion of said digits to a non-redundant binary representation. In this particular example, since carry-save representation is used, the carry net module 307MCFJ receives the n+1 LSBs of the sum and carry words, at a first and a second input, respectively, and generates the last carry bit corresponding to the addition of both inputs.
[0322] The conversion module 309MCFJ receives the m MSDs of the output of the redundant constant multiplication module 305MCFJ and the carry bit from the carry net module 307MCFJ, and generates the m bits corresponding to the m MSBs of the value of the multiplication of the input fixed point number and the constant number in a non-redundant representation. In this particular example, since carry-save representation is used, the conversion module 309MCFJ receives the m MSBs of the sum and carry words at a first and a second input, respectively, and the carry bit at a third input and generates a value corresponding to the addition of both input words and the carry bit. Besides, in this particular example, the size of the output and the first input are equal, but in an alternative implementation the size of the output may be z+1 bits, being z<n+m+1. In this case, the carry net module 307MCFJ may receive the n+m−z+1 LSDs of the output of the redundant multiplier, and the conversion module 309MCFJ, the z MSDs.
[0323] FIG. 31 illustrates an implementation of a preprocessed redundant constant multiplication module 405MCFJ according to one example, wherein the LSB of the input number is not received. Thus, said module receives only the m MSBs of a preprocessed fixed point number (X), since the LSB is constant and equal to one. Said preprocessed redundant constant multiplication module generates, in a redundant representation, the m+n+1 MSDs of the result of the multiplication between the preprocessed input number and a constant preprocessed fixed point number of n+1 bits (Y), being the LSB of said result also implicit and equal to one. Said in a different way, if the m MSBs of X are represented by X′ and the n MSBs of Y are represented by Y′, then the m+n+1 digit value at the output is equal to X′*Y′+1/2X′+1/2Y′. The preprocessed redundant constant multiplication module 405MCFJ comprises a partial product generator module 425MCFJ and a compressor tree 430MCFJ. The partial product generator module 425MCFJ receives said m MSBs of the preprocess fixed point number, at a first input, and generates a set of partial products, which allows, by adding them, to obtain a value corresponding to the product of said first input times the n MSBs of the constant preprocessed number (i.e., X′*Y′). One skilled in the art may appreciate that there are different sets of partial products which may be utilized depending on the degree of optimization desired. Besides, in an alternative implementation, the partial product generator module may be arranged to take into account also the LSB of the constant (i.e., generate X′*Y′+1/2X′).
[0324] The compressor tree 430MCFJ receives the output of the partial product generator module 425MCFJ, a copy of the m-bit input and the n MSBs of the constant preprocessed number, and generates a m+n+1 digit redundant output corresponding to the addition of all its inputs correctly aligned. We should note that said copy and said n MSBs are aligned, in such a way that their second LSB is aligned with the LSB of the least significant partial product. In an alternative implementation said copy and said n MSBs of the constant number may be introduced either within the compressor tree 430MCFJ or the partial product generator module 425MCFJ. In this particular example, since carry-save representation is used, two m+n+1 bit numbers are produced corresponding to the sum and carry words. In an alternative implementation, a different redundant representation format may be used. In other implementations if non redundant output is desired, a conversion module may be used to transform the output of the compressor tree 4300MCFJ to a non-redundant m+n+1 bit number corresponding to the m+n+1 MSBs of the product of the initial preprocessed number and the constant number.
[0325] The architectures shown with reference from FIGS. 30a to 31, may be implemented for either unsigned or signed numbers by using the adequate modules accordingly, such as unsigned or signed fixed point constant multiplier, and substituting the zero extensions required for additions, such as the one in example of FIG. 30b, by a sign extension. However a different approach may be utilized to implement constant multiplication modules for signed preprocessed numbers. This may be based on the use of the unsigned version of any of the examples shown before and the conversion of the two's complement input number to sign-and-magnitude. This conversion is easily implemented for preprocessed numbers using a conditional bit inverter to invert the n−1 LSBs of the N MSBs of a preprocessed number of n+1 bits, if it is negative. Then, the magnitude may be processed by the constant multiplier module for unsigned inputs while the sign is processed apart. Finally, a conversion from the sign-and-magnitude result to two's complement number, which is similar to the previous one, is required. Besides, one skilled in the art may appreciate that it is easy to modify this design to support both formats at the same unit.
[0326] The implementation of a preprocessed left shifter is described FIG. 32, according to an example. Since the left shifting of a preprocessed fixed point number produces an unprocessed number, a rounding to nearest is required. The preprocessed left shifter 100SHFJ performs the left shifting of a preprocessed fixed point number without introducing bias due to rounding. Preprocessed left shifter 100SHFJ receives the n MSBs of a first preprocessed fixed point number of n+1 bits, at a first input, and shift amount, at a second input, and generates a second preprocessed fixed point number of n+1 bits corresponding to the left shifting of the input preprocessed number according to the shift amount. The LSB of the preprocessed fixed point numbers is equal to 1 and need not be introduced or generated. Preprocessed left shifter 100SHFJ comprises a special barrel left-shifter 160SHFJ having a new third one-bit input which allows selecting the value used to fill the vacant positions after shifting. Special left-shifter 160SHFJ is arranged to receive the n MSBs of the first preprocessed fixed point number augmented to the left with a bit having a random value, at a first input, the shift amount, at a second input, and the inverse of said random bit, at said new third input. In this way, the vacant position after left shifting is randomly filled either by one bit sets to one and the remaining bits set to zero, or the opposite, and no bias is produced. The random bit may be any selected bit, or combination of selected bits, of the first preprocessed fixed point number, or any other bit with adequate statistical characteristics. In other implementations the shift amount may be a constant value, and the shifting may be hardwired instead of using a special left shifter. In alternative implementations the size of the output may not be equal to the size of the first input.
[0327] Other category of converters is converters for converting preprocessed fixed point numbers to preprocessed Fixed Point numbers of different size. FIG. 33a is an example of such a converter. Converter 800a illustrates a converter adapted to convert a preprocessed fixed point number of n+m+1 bits to an n+1 bit preprocessed fixed point number. The LSB of both numbers is equal to 1 and is therefore not depicted. The n MSBs of the original number shall be the n MSBs of the target preprocessed number. That is, a simple truncation function may take place.
[0328] FIG. 33b is another example of a preprocessed fixed point number to preprocessed fixed point number converter. Converter 800b illustrates a converter adapted to convert a preprocessed fixed point number of m+1 bits to an n+m+1 number. Converter 800b is a biased version of such a converter. Again, The LSB of both numbers is equal to 1 and is therefore not depicted. According to converter 800b, a circuit expands the number size by adding (to the right) a lagging one bit and as many zeros as required to complete the new number size.
[0329] FIG. 33c is another example of a preprocessed fixed point number to preprocessed fixed point number converter. Converter 800c illustrates a converter adapted to convert a preprocessed fixed point number of n+1 bits to an n+m+1 number. Converter 800c is an unbiased version of such a converter. Again, The LSB of both numbers is equal to 1 and is therefore not depicted. According to converter 800c, a circuit is used to expand the number's size by adding to the right a randomly selected bit value and as many bits with the inverse value as required to complete the new number size. The random bit may be any one of the initial number's or combination of them, such as the second LSB, as shown in FIG. 33c.
[0330] Another category of converters is converters for converting preprocessed fixed point numbers to unprocessed fixed point numbers FIG. 34 illustrates an example of converter 100CFJ for converting a n+m+1 bit preprocessed number to a n bit unprocessed number. The n+1 MSBs of the input number are introduced to a rounding module 120CFJ to produce a rounded unprocessed n bit number corresponding to the output value. The computation of the sticky bit corresponding to the remaining m bits is not required, since the LSB is always 1 and then, also the sticky bit is one.
[0331] FIG. 35 shows an implementation of said converter when the rounding module perform round to nearest. Converter 100bCFJ comprises an adder 1310aCFJ, used to increment by one the n MSBs of the preprocessed significand if the n+1th MSB is one. When m=0, i.e., the input processed number has n+1 bits, the n-bit input value is augmented with the LSB of said number, which is equal to one, before it inputs the rounding module. In alternative implementations different rounding modules performing different rounding modes may be used. On the other hand, the converter adapted to convert a preprocessed fixed point number of m+1 bits to an n+m+1 bit unprocessed number, is similar to the one described with reference to FIG. 33b, but the output doesn't have an implicit LSB.
[0332] Another category of converters is converters for converting preprocessed FP numbers to preprocessed fixed-point numbers (FIG. 16, 17a y 17b) previously commented.
[0333] Another category of converters is converters for converting preprocessed fixed-point numbers to preprocessed FP numbers. FIG. 36 illustrates an example of such a converter for a preprocessed fixed-point number of m+2 bits and a preprocessed FP number having a significand of n+1 bits. Converter 600FJ comprises a normalization module 630FJ having a conditional bit inverter 605FJ in series with a preprocessed left shifter 610FJ, which may be similar to the one described with reference to FIG. 32. The conditional bit inverter has a first input for receiving the m LSBs of an m+2 bit preprocessed fixed-point number. The MSB of the m+2 bit number is the sign, and shall be the sign of the preprocessed FP number as well as used to control the conditional bit inverter 605FJ. The m-bit output of the conditional bit inverter 605FJ is input to the preprocessed left shifter 610FJ. In alternative implementations the preprocessed left shifter precedes the conditional bit inverter 605FJ. The function of preprocessed left shifter 610FJ is to normalize the input number by shifting it according to the received shift mount and rounding it without bias. An implementation of said preprocessed left shifter is described in more detail in FIG. 32.
[0334] In this example of FIG. 36, the maximum shift amount is m+1. If the fixed-point number is equal to zero and the random bit (R) in FIG. 32 is also equal to zero, it requires a maximum shift amount having an additional bit (m+1), so that the significand is normalized. Alternatively, if the fixed-point number is equal to zero, it may be treated as a special case and be converted to FP zero. Then the maximum shift amount would be equal to m.
[0335] The input value of preprocessed left shifter 610FJ is augmented with an additional LSB sets to any bit with a random value (for instance, the LSB of the initial input value) and both, the vacant positions required to complete the size of n, if n>m+1, and the vacant positions produced after shifting are set to the invert of the random value. The output of preprocessed left shifter 610FJ comprises the n MSBs of the significand Mz of the preprocessed FP number. Said output corresponds only to the n MSBs of the shifted value if n<m. The LSB of the significand Mz is implicit and it is equal to 1.
[0336] In a parallel path, the converter 600FJ comprises LOD module 615FJ having an input coupled to the output of conditional bit inverter 605FJ and an output for generating the shift amount for the preprocessed left shifter 610FJ which is also used as input to exponent computation module 620FJ to generate the exponent Ez of the preprocessed FP number. Alternatively, the input of LOD module 615FJ may be directly coupled at the input of converter 600FJ but, in this case, it should detect the first zero instead of the one when the number is negative.
[0337] Compared to conventional fixed-point-to-FP numbers converters, when m>n, there is no rounding up taking place after the shifting operation and therefore there is a reduction in components and processing. When m<n, then there is no bias produced with the used of the proposed converter.
[0338] Another category of such converters is converters for converting preprocessed fixed-point numbers to unprocessed FP numbers. FIG. 37 illustrates an example of such a converter for a preprocessed fixed-point numbers of m+2 bits and a unprocessed FP number having a significand of n bits. Converter 1500FJ has an input to receive the m+1 MSBs of an m+2 bit preprocessed fixed point number. Converter 1500FJ comprises a normalization module 1530FJ, having a conditional bit inverter 1505FJ in series with a left shifter 1510FJ, and a rounding module 1540FJ. The conditional bit inverter 1505FJ has a first input for receiving the m LSBs of said m+1 bit input. The MSB of the preprocessed fixed point number is its sign and shall be the sign of the unprocessed FP number as well as used to control the conditional bit inverter 1505FJ. The m-bit output of the conditional bit inverter 1505FJ is input to left shifter 1510FJ. The value 1 is also inserted at the input of the left shifter 1510FJ so that the m bits at the output of the conditional bit inverter 1505FJ are augmented to the right by 1 bit corresponding to the implicit LSB. However, in other implementations the introduction of the additional one may be performed internally to the left shifter 1510FJ without the need for a special input. The left shifter 1510FJ produces a n+1 bit output corresponding to the significand Mz of the unprocessed FP number before rounding. Said output corresponds only to the n+1 MSBs of the shifted value if n<m. Both, the vacant positions to complete the size of n if n>m, and the vacant positions produced after shifting are set to zero. The n+1 output of the normalization module 1530FJ are rounded to n bits by the rounding module 1540FJ. Rounding module 1540FJ also generates an overflow output that is used by exponent calculator 1520FJ to generate the exponent of the unprocessed FP number. The rounder 1540FJ is similar to the rounder 100bCFJ explained in FIG. 35. An adder is used to increment by one the n MSBs of the output of normalization module 1530FJ, if the LSB of said output is one. In alternative implementations different rounding units performing different rounding modes may be used. In other implementations, the MSB of the normalized significand Mz may not include the leading one. Therefore, the output of the conditional bit inverter may be one bit less.
[0339] In a parallel path, the converter 1500FJ comprises LOD module 1515FJ having an input coupled to the output of conditional bit inverter 1505FJ and an output for generating the shift amount for the left shifter 1510FJ which is also used, along with the overflow signal, as input to exponent computation module 1520FJ to generate the exponent Ez of the preprocessed FP number. Alternatively, the input of LOD module 1515FJ may be directly coupled at the input of converter 1500FJ. The converter shown in this example may produce some bias when n<m and the input number is in such a way that the LSB of the output of the left shifter 1510FJ coincides with the LSB of said input number. This bias may be avoided by applying standard techniques when this situation occurs; such as only perform the rounding up if the second LSB of the number is also one. In some implementations, said situation may be detected by checking the shift amount whereas in others it may be detected by computing the sticky bit over the m-n LSBs of the shifted value.
[0340] Another category of converters is converters for converting unprocessed FP numbers to preprocessed fixed point numbers. FIG. 38 illustrates a converter 1600FJ for converting an FP number having an m bit significand and a d-bit exponent to a preprocessed fixed point number of n+2 bits. The m-bit significand is input to a unprocessed-to-preprocessed fixed point numbers converter 1602FJ, similar to the ones described in FIGS. 18 to 19b, according to the relation between n and m, arranges to generate the n MSBs of a n+1 bit preprocessed fixed point number. In an alternative implementation, since said significand is normalized, its MSB may be implicit, and said MSB may be not introduced explicitly to the converter. Said n MSBs of said preprocessed number are input to a conditional bit inverter 1605FJ whereas the LSB is implicit and equal to one.
[0341] The sign of the unprocessed FP number is used to control the conditional bit inverter 1605FJ. The output of the conditional bit inverter 1605FJ along with the sign (sign_x) is input to right shifter 1610FJ. Right shifter 1610FJ has another input for receiving the shift amount from shift amount calculator 1615FJ. Shift amount calculator 1615FJ receives the exponent of the unprocessed FP number and generates the shift amount. The output of the right shifter 1610FJ is the n+1 MSBs of the preprocessed fixed point number. The LSB is similarly equal to 1 and is neither generated nor depicted. In an alternative implementation the conditional bit inverter may be placed after the right shifter.
[0342] Although only a number of particular embodiments and examples of the invention have been disclosed herein, it will be understood by those skilled in the art that other alternative embodiments and/or uses of the invention and obvious modifications and equivalents thereof are possible. Furthermore, the present invention covers all possible combinations of the particular embodiments described. Thus, the scope of the present invention should not be limited by particular embodiments, but should be determined only by a fair reading of the claims that follow.
[0343] Furthermore, the described embodiments of the invention with reference to the drawings comprise computer systems and processes performed in computer systems, characterized functionally, and independent of the support or technology used for implementation. This support means may be, for example, an application specific integrated circuit (ASIC, acronym) circuit, a programmable logic circuit (FPGA or CPLD, acronym in English) including a memory, or any other device, such circuits being adapted or configured to perform, or for use in performing, the relevant processes.
[0344] Although the embodiments described comprise computing devices, the invention also extends to computer programs, more particularly to computer programs in a carrier means adapted to carry out the invention. The computer program may be in source code, object code or an intermediate code between source code and object code such as in partially compiled form, or in any other form suitable for use in the implementation of the processes according to the invention. The carrier may be any entity or device capable of carrying the program.
[0345] For example, the carrier may comprise a storage medium such as a ROM, for example a CD ROM or semiconductor ROM, or magnetic recording medium, for example a floppy disc or hard disk. In addition, the carrier may be a transmissible carrier medium such as an electrical or optical signal that can be transmitted via electrical or optical cable or by radio or other means.
[0346] When the computer program is contained in a signal that can be transmitted directly via cable or other device or means, the carrier may be constituted by such cable or other device or means.