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.

Writing a fixed point code for the DSP 64x+ processor

Hi,

     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.

  • Divya,

    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.

    Regards,
    RandyP 

  • Sir,

    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.

    Thank you,

    Divya

  • Divya,

    Divya Narayanan said:
    using 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 Narayanan said:
    separate 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 Narayanan said:
    I 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.

    Regards,
    RandyP

  • Sir,

    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?

    Thank you,

    Divya

  • Divya,

    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.

    Regards,
    RandyP

  • Sir,

    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.

    Thank you,

    Divya

  • 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.

    Regards,
    RandyP

  • Sir, 

    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.

    Thank you,

    Divya 

  • What is the bug?