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.

Iq-math or Floating point hardware??

Hai everyone,

I am working on a EzDSP-F28335 Evaluation board which is interfaced with an External ADC of 18-bits and an External DAC of 14-bits.

I have to take the ADC outputs, convert to floating-point say A, B, C, D and calculate a factor say

X = ((A-B)*C)-D then pass the X as input to the 14-bit DAC.

Here main task is maintaining precision as well as timings whole process should not take more time to execute and give DAC output.


Now I need a clarity whether going for floating point hardware is better or IQ-Math?

In case of IQ-Math, we can maintain even the least precision but takes more number of cycles to execute the conversions.

In case of floating point hardware, we can complete the process in less time but the values like 10.000002 are considered as 10.0 where I have to loose the precision of final output.

One more help I need is,

When using IQ-Math,

  1. Aall the variables in "X = ((A-B)*C)-D" are converted from floating point to IQ variables with different Q values(26, 24, 20, 19)
  2. Using _IQmpy function for multiplication
  3. The output is defined in Q17 which gets a 32-bit long value in Y.
  4. I have converted this Y to QN format using _IQtoQ15(Y) function.

But I need to pass only 14-bits to DAC at the same time precision is important.

How can I implement this?

Please help me with this issue as soon as possible.

 


Thankyou,

Lakshmi.

  • Hi Lakshmi,

    Now I need a clarity whether going for floating point hardware is better or IQ-Math?

    Off-course Floating point is superior to IQMath.

    In case of floating point hardware, we can complete the process in less time but the values like 10.000002 are considered as 10.0 where I have to loose the precision of final output.

    Are you sure? If yes how did you conclude on the same? Did you try with float32 data-type?

    Regards,

    Gautam

  • Hai Gautam,

    I Thank you for your fast response.

    From this I have concluded that,

    If the Image doesn't display, please see the page-6 of attached datasheet.

    0160.IQMath_fixed_vs_floating.pdf

    Anyway I am not 100% sure about this. Correct me if I am wrong.

    Thankyou,

    Komali.

  • Hi Komali,

    The document does convey the information that you previously shared. I've never required such a high precision calculation and hence never noticed. If so, then it would better if you go with IQMath library!

    Regards,

    Gautam

  • Thankyou Gautam for your suggestion.

  • Do Share your observations once your implementation yield results. 

    Regards, 

    Gautam

  • Komali

    I do not agree with Guatam regarding floating point. In C2000 family it can be faster than IQ math or it can be slower. Now with IQ math you always know what your resolution is so you as a programmer are aware of any resolution issues. The example in the documen (page 6) shows potential problems using floating point, but you can come across similar issue using IQ math (e.g. IQ1(1.0) + _IQ30(0.000000000931322574615478515625). Using IQ math you will usually pay attentions to operations with operands with such different formats, while using floating point this issue might be missed. Also keep in mind that even with fixed point you can not write certain numbers (e.g. 0.3).

    The document that you are pointing to is quite old and at the time C2000 family did not have a floating point unit. So there is a little bias trying to show IQ math as good as floating point (which most people coming form PC world are used to). In fact they are both good, but it is up to you as a programmer to know which is best for your application.

    But from your requirements I can only conclude that it does not matter which way you go, so I would use floating point for simplicity's sake. "float" type has about 24 bit precision (relative). Your math seems pretty simple (I can not tell whether you have any type of integration or not), so you do not loose a lot numerically. And you have 14 bit DAC, so 24 bits relative should be plenty enough.

    Regards, Mitja

  • Hai Mitja Nemec,

    Thankyou for your useful information and suggestion.

    No integrations are performed. Only additions, subtractions and multiplications are done in my application.

    Now I can conclude of using Floating point or IQ math.

    My worry here is how to push the 32-bit floating value to a 14-bit DAC, not considering the Sign bit because the DAC is unipolar(only 0 to +10V)?

    For this I can use IQ math conversion of-"Float to IQN". But at what IQN(1-30) would I get precision results?

    Please suggest to clear this.

    Thankyou,

    Komali.

  • Hi Mitja, (Hi LK) 

    I appreciate for your detailed info on the above topic. I've personally tested fpu32 and IQMath library on F28335. As far as for my control loops and calculations fpu32 performed really well. But there are certain functions where IQMath has an upper hand. Though as mentioned previously, have not checked the precision as much as required above; so won't be able to comment further. 

    Regards, 

    Gautam

  • Hi Gautam, Hi Mitja

    We decided to continue with Floating point as we are very much worried about timings in our thing. IQ math is consuming very much time for each instruction, we can't go with that. And for precision we are implementing other way of calculations.

    Thankyou,

    Komali

  • That's Great!

    Goodluck & Regards,

    Gautam