Hello Experts ,
I am working on the beagle board. it has c64x fixed point processor. i am new to fixed point programming. can you please tell how to program in the fixed point ?
Thank you,
raju.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello Experts ,
I am working on the beagle board. it has c64x fixed point processor. i am new to fixed point programming. can you please tell how to program in the fixed point ?
Thank you,
raju.
Hello Raju,
There are three parts to this problem:
The #1 above is relatively easy to master. You need to be familiar with:
For fixed point division operation you may need to know how to implement integer or fractional division using conditional subtract instructions (or just how to use regular integer division to implement fractional division if you do not need to optimize code too much). You should also learn how to avoid division in your algorithms and use multiplication instead.
The #2 above (fixed point algorithm design) is a completely different story. After you learn basics of numerical operations with the fixed point numbers, you need to understand that most numerical and signal processing algorithms will not map easily from floating point into fixed point. The problem will be the dynamic range of the numbers you are dealing with. You will also face issues with quantization, overflows and underflows. There are many different techniques you may end up using to deal with those issues. The adaptive algorithms with feedback loops or recursive algorithms will give you the most trouble.
Some examples of dealing with these problems are:
Each of these approaches will have pros and cons depending on the application and sometimes you need to combine them within more complex algorithms.
The best approach to start is to just learn the basics of the fixed point number representations and some basic arithmetic with 2's complement. Then, you may use TI's DSP libraries that are implemented for fixed point DSP's. For example:
You may find additional fixed point libraries available through TI that would provide you with solutions for most of signal processing problems.
The #3 above (portability) is very important (for some people) when it comes to fixed point algorithms. In case of floating point, you may just take the ANSI C implementation and recompile it on another CPU. With fixed point, that may not work due to how the optimization of fixed point algorithms is done.
If you decide to use C language for fixed point programming you should create macros that could use TI C intrinsics for more efficient implementation (in case plain ANSI C cannot be optimized enough). That would also help you make your code more portable as you move from one DSP platform to another, or if you decide one day to run your fixed point algorithm on ARM CPU vs. DSP. The data types you use could also be made more portable to avoid problems of different bit lengths as you move from one architecture to another.
Very basic example of fixed point data types and macros may be found within the VoLIB that was mentioned above. Within that library you may find ti.mas.types and ti.mas.fract components that provide basic simple types (in types.h) and fixed point macros (in fract.h) files. They are not necessarily optimized too much, but you may use these as a starting point. Keep in mind that these basic components within VoLIB are not supported by TI since they are provided only as dependent components within the VoLIB. They may change between releases and may not be kept backward compatible. You should use it only as examples of how you could jump start your own fixed point programming practice.
You should also supplement your learning process by finding books that may talk about fixed point algorithm design and you may learn from reading the source code of the libraries that are provided in a source code form.
Regards,
Bogdan