The floating point to fixed point conversion is necessary to interface a floating processor to a fixed point implementation. So that there maintains a smooth transition from one type of architecture to another.
The steps involved in this conversion are
- Concatenate the hidden bit and add leading zeros according to the fixed point length.
- Find the absolute difference between the exponent of the floating point number and bias.
- If left shift the input number by their absolute difference. Otherwise if right shift is executed.
- Finally, invert the number if sign bit is 1.
Example: Floating Point to Fixed Point Conversion
- Input data is represented in floating point as .
- Prepare the data as for 16-bit fixed point representation with 6 integer bits.
- The difference between exponent and bias is and exponent is greater than the bias.
- Left shift the number by 4-bit. Result is .
- As the sign bit 0, no need of inversion. Discard the LSB and concatenate the sign bit at the MSB side. The final output is .
In this above example, the LSB is discarded to fit the result in 16-bit format. Thus there exists error in the conversion process. Only a certain range of floating point representation can be represented in fixed point for same word length. An architecture for this conversion is shown in Figure 1. Here two variable shifters are used, viz, VLSH and VRSH. VLSH does the right shifting like the VRSH block. Two 4-bit adder/subtractors and one 16-bit adder/subtractor is used. This architecture can be adopted for any word length.