# How to convert floating point code to fixed point?

I am working on converting a floating point MATLAB code into fixed point C code. The code is to be run on a DSP platform, the specifics of which are yet to be decided.

I'm new to floating point to fixed point conversion and am facing quite a few challenges.

My questions are:

1. What is the best way for me to start and where should I start, because the topic is quite confusing.

2. My MATLAB code is basic filtering code; there's FFT, windowing followed by IFFT. Windowing seems simple enough as its multiplication, but I'm totally lost when it comes to FFT and IFFT.

Thanks!

• do you have an FFT in fixed-point? must your filtering be done with an FFT and iFFT? (is it a very long FIR?) Commented Oct 6, 2017 at 6:43
• fixed point math is nothing like floating point math. Suggest reading fixedPoint as a starting point Commented Oct 6, 2017 at 6:52
• Neha, i'll tell you how to convert some of the basic algorithms into fixed-point, but i really need a little more context. in the meantime, here is a document from a friend of mine. Commented Oct 7, 2017 at 4:44
• No I don't have an FFT in fixed point yet. My filtering is indeed an FIR. My application is in a biomedical device and the filter basically filters out the needed signal from the rest of the noise. Commented Oct 11, 2017 at 5:57
• The document seems helpful with the basics. Thanks! Commented Oct 11, 2017 at 6:12

Having a standard fixed point library available as a reference implementation would be helpful

There are more than a few fixed point dsp libraries, some with source code and documentation. Google returns many links.

TI and Analog Devices have fixed point libraries that support their products. The documentation and support is very helpful.

Matlab also offers fixed point add ons. Student pricing is very affordable.

• The DSP platform hasn't been decided yet. The aim is to convert the filtering code into fixed point C code and then run it in different simulated environment to see which processor would be best suited. Commented Oct 11, 2017 at 5:59
• Regarding TI and AD fixed point libraries, I was able to find AD's library support but I wasn't able to find the same for TI. Can you suggest how I can get about that. Commented Oct 11, 2017 at 6:11
• Call their sales or customer support numbers. They probably will want you to get a development board, maybe not. Just make sure to ask if source code is part of the license. They don’t make money without people understanding their products
– user28715
Commented Oct 11, 2017 at 14:18