Main Content

Quantization

的quantizationQof a real-world valueVis represented by a weighted sum of bits. Within the context of the general slope and bias encoding scheme, the value of an unsigned fixed-point quantity is given by

V ~ = S . [ i = 0 w s 1 b i 2 i ] + B ,

while the value of a signed fixed-point quantity is given by

V ~ = S . [ b w s 1 2 w s 1 + i = 0 w s 2 b i 2 i ] + B ,

where

  • b i are binary digits, with b i = 1 , 0 , for i = 0 , 1 , ... , w s 1

  • The word size in bits is given byws, withws=1,2,3,...,128.

  • Sis given by F = 2 E , where the scaling is unrestricted because the binary point does not have to be contiguous with the word.

b i are calledbit multipliersand 2 i are called theweights.

Fixed-Point Format

Formats for 8-bit signed and unsigned fixed-point values are shown in the following figure.

Note that you cannot discern whether these numbers are signed or unsigned data types merely by inspection since this information is not explicitly encoded within the word.

The binary number0011.0101yields the same value for the unsigned and two's complement representation because the MSB =0. SettingB=0and using the appropriate weights, bit multipliers, and scaling, the value is

V ~ = ( F 2 E ) Q = 2 E [ i = 0 w s 1 b i 2 i ] = 2 4 ( 0 × 2 7 + 0 × 2 6 + 1 × 2 5 + 1 × 2 4 + 0 × 2 3 + 1 × 2 2 + 0 × 2 1 + 1 × 2 0 ) = 3.3125.

Conversely, the binary number1011.0101yields different values for the unsigned and two's complement representation since the MSB =1.

SettingB=0and using the appropriate weights, bit multipliers, and scaling, the unsigned value is

V ~ = ( F 2 E ) Q = 2 E [ i = 0 w s 1 b i 2 i ] = 2 4 ( 1 × 2 7 + 0 × 2 6 + 1 × 2 5 + 1 × 2 4 + 0 × 2 3 + 1 × 2 2 + 0 × 2 1 + 1 × 2 0 ) = 11.3125 ,

while the two's complement value is

V ~ = ( F 2 E ) Q = 2 E [ b w s 1 2 w s 1 + i = 0 w s 2 b i 2 i ] = 2 4 ( 1 × 2 7 + 0 × 2 6 + 1 × 2 5 + 1 × 2 4 + 0 × 2 3 + 1 × 2 2 + 0 × 2 1 + 1 × 2 0 ) = 4.6875.