Documentation

Quantization

The quantization Q of a real-world value V is 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=0ws1bi2i]+B,

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

V~=S.[bws12ws1+i=0ws2bi2i]+B,

where

  • bi are binary digits, with bi=1,0, for i=0,1,...,ws1

  • The word size in bits is given by ws, with ws = 1, 2, 3,..., 128.

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

bi are called bit multipliers and 2i are called the weights.

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 number 0011.0101 yields the same value for the unsigned and two's complement representation because the MSB = 0. Setting B = 0 and using the appropriate weights, bit multipliers, and scaling, the value is

V~=(F2E)Q=2E[i=0ws1bi2i]=24(0×27+0×26+1×25+1×24+0×23+1×22+0×21+1×20)=3.3125.

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

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

V~=(F2E)Q=2E[i=0ws1bi2i]=24(1×27+0×26+1×25+1×24+0×23+1×22+0×21+1×20)=11.3125,

while the two's complement value is

V~=(F2E)Q=2E[bws12ws1+i=0ws2bi2i]=24(1×27+0×26+1×25+1×24+0×23+1×22+0×21+1×20)=4.6875.

Was this topic helpful?