Example .. A DSP uses 4 bits to represent input fixed-point all integer numbers. Two’s complement format is used for negative numbers. The tables below indicate the resulting number if the operations are carried using 4-bits. Operand 1 Operation Operand 2 Resulting Comment 4 Binary 4-bits Binary Number –bits (Decimal) (Decimal) 4-bits Binary (Decimal) No Overflow 0011(+3) + 0010(+2) 0101(+5) 0110(+6) + 0101(+5) 1011(-5) Overflow 1101(-3) + 0111(+7) 0100(+4) No Overflow 1010(-6) + 1000(-8) 0010(+2) Overflow In the cases of overflow it becomes necessary to handle it in order to minimize the resulting error. In the table above the resulting overflow errors are: 6+5=11 compared to erroneous result of (-5), or -6-8=-14 vs. +2; both being 16. Overflow can be avoided by doubling the precision of the resulting number; that is using 8 bits as depicted in the table below. Operand 1 Operation Operand 2 Resulting Number 4 Binary 4-bits Binary 8-bits Binary (Decimal) –bits (Decimal) (Decimal) 0011(+3) + 0010(+2) 0000 0101(+ 5) 0110(+6) + 0101(+5) 0000 1011(+11) 1101(-3) + 0111(+7) 0000 0100(+ 4) 1010(-6) + 1000(-8) 1111 0100(-12) Next table depicts results of the multiplication of two 4-bit numbers with 4-bit resulting number. The errors due to overflow are large even when 4 most significant bits (MSB) are used for resulting numbers. For example (+7)x(+6)=(+42) but the resulting number from the 4 MSB’s is 2 which introduces an error of 40. Similarly, with the resulting number (-2) and error of 33.
Example .. A DSP uses 4 bits to represent input fixed-point all integer numbers. Two’s complement format is used for negative numbers. The tables below indicate the resulting number if the operations are carried using 4-bits. Operand 1 4 –bits Binary (Decimal) Operation Operand 2 4-bits Binary (Decimal) Resulting Number 4-bits Binary (Decimal) Comment 0011(+3) + 0010(+2) 0101(+5) No Overflow 0110(+6) + 0101(+5) 1011(-5) Overflow 1101(-3) + 0111(+7) 0100(+4) No Overflow 1010(-6) + 1000(-8) 0010(+2) Overflow In the cases of overflow it becomes necessary to handle it in order to minimize the resulting error. In the table above the resulting overflow errors are: 6+5=11 compared to erroneous result of (-5), or -6-8=-14 vs. +2; both being 16. Overflow can be avoided by doubling the precision of the resulting number; that is using 8 bits as depicted in the table below. Operand 1 4 –bits Binary (Decimal) Operation Operand 2 4-bits Binary (Decimal) Resulting Number 8-bits Binary (Decimal) 0011(+3) + 0010(+2) 0000 0101(+ 5) 0110(+6) + 0101(+5) 0000 1011(+11) 1101(-3) + 0111(+7) 0000 0100(+ 4) 1010(-6) + 1000(-8) 1111 0100(-12) Next table depicts results of the multiplication of two 4-bit numbers with 4-bit resulting number. The errors due to overflow are large even when 4 most significant bits (MSB) are used for resulting numbers. For example (+7)x(+6)=(+42) but the resulting number from the 4 MSB’s is 2 which introduces an error of 40. Similarly, with the resulting number (-2) and error of 33.