I have a floating point C code . I want to convert this code into a fixed point code so that it can run on the DSP processor 64x+ device which is present on the beagle board.
I am trying to write the code in Code composer studio v4 and i'm new to it. I found that there is a specific IQ math lib which can be used to write the code directly by using the
functions provided in the library. Will it be efficient to write the code this way or, should i do a line by line change from floating to fixed.
What is the procedure to use the IQmath libraries in CCS v4?? Will i be able to port the code after it has been compiled into the board since we will have to use linux to port it.
You will want to read and learn the IQ Math Lib documentation and examples. This is an easy way to convert from floating point to fixed point. It may meet your needs perfectly, or you may need to move to academically-challenging methods of converting floating point to fixed point.
There are articles on the Wiki and other documents to help you learn about IQMath. Please see how those work out for you.
In reply to RandyP:
I have been hearing from people that using libraries will place considerable overhead on the processing and hence the speed will reduce. But if i have to convert the code line by line, i am finding it difficult to write separate functions for the division operations , trignometric functions, etc. I have been searching the net looking for help regarding this and very few information is available regarding the fixed point conversion. I am working on a Kalman filter algorithm for the purpose of implementing Navigation algorithm on the beagle board( contains 64x+ processor) and need to convert an existing floating point to fixed point code. Please suggest me in this regard, since i have only limited time for the purpose of conversion.
In reply to Divya Narayanan:
Divya Narayananusing libraries will place considerable overhead on the processing and hence the speed will reduce
This is an over-generalization and it very incorrect for many situations. In your case, if you were to take floating-point code and compile it for a fixed-point processor, the Run-Time Support Libraries will correctly implement the functionality of the floating-point operations, but it will not be efficient performance.
Your original question was about using IQ Math. That library is used for easily converting floating-point numbers to fixed-point numbers and then doing math operations on those numbers. The libraries are fairly efficient; the most efficient is to use the inline version which requires source code and special licensing. Search the E2E forum or TI Wiki Pages for information on that, if you want to use that method.
Divya Narayananseparate functions for the division operations , trignometric functions
In fixed- or floating-point math, you will want to minimize divisions when possible. These are almost always done through library calls unless the processor has a native division instruction. Trigonometric functions are always implemented through libraries. It is not completely clear to me what you are talking about for this point.
Divya NarayananI have been searching the net looking for help regarding this and very few information is available regarding the fixed point conversion.
Try searching TI.com for "kalman filter" (no quotes). Any fixed-point processor's implementation (if in C and not assembly) can be used on the C64x+. There are app notes that mention Kalman filters and E2E forum posts that mention Kalman filters. It looks like there should be some good help for you out there.
There are many third-party design houses for TI processors who may have highly efficient Kalman filter implementations available for sale. You may be able to find some of those through TI.com or by using your favorite web search engine.
I am assuming that you understand the numerical issues associated with using fixed-point math and how these are applied to fixed-point numbers within a fixed-point processor. If that is not correct, please let us know what you do know and what you would like to learn.
Thank you for your reply, i found it really useful.
Could you give me some more information on the inline version of the libraries so that i could make use of them. At present , i have the free version of IQmath libraries. Can i use them at this point to convert the existing floating point C code into a fixed one ?will these libraries work on visual C studio?
On the same TI.com page that allows you to download the official released copy of the IQMath library, there is another button for downloading the source. If you did not get the library that way, you can search TI.com for C64x+ IQMath to find it. That is the place to get information on the library source files required for inlining.
You do not need the inline source to make progress on the functional aspect of your code work. You can write the code with the API calls into the library and you will get the functional conversions. There is no reason to wait for the source before starting your development. I do not believe that having the source will change the code that you are working on.
These libraries are for use with the C64x+ compiler and the C64x+ device. These are not general purpose libraries for use on any platform, and I believe the license agreement states that you will only use these on the target TI DSPs.
I definately understand that i will be using these libraries to run on the target 64x+ DSP. But where exactly should i make use of them?? in CC studio or some special software to program this DSP.
When you download the library, you will get documentation for it. Read that documentation to understand the library and how it is used.
Search the TI Wiki Pages for discussions on the use of IQMath. These will also help you learn how to use the library functions.
You will use it within CCS.
I got the library installed and started using it.
I found that a specific function for multiplication _IQmul doesn give the correct results. If you could try fixing the bug , it would be very useful.
What is the bug?
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.