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.

Having trouble converting between the TMS320C32's single-precision floating-point hexadecimal, and the decimal equivalent.

Other Parts Discussed in Thread: TMS320C6655, TMS320C6748

Hello. I am currently writing software that processes the format of a Texas Instruments DSP floating point. The software works where a user enters a number formatted in the TMS320C32's single-precision floating-point (as a hexadecimal) and the program converts it into the decimal equivalent. Here are some examples, that were taken directly from the TMS320C3X user's guide:

The user would enter the value -3, and the program would output 0x01C00000.

The user would enter the value 6, and the program would output 0x02400000.

The user would enter the value 0.046875, and the program would output 0xFB400000.

Okay, so the user's guide is pretty good about explaining how the above 3 cases can be converted to/from TMS320C3X format. I am confused however, on how we would convert to/from negative whole numbers containing fractional components as well as negative fractional numbers.

I would like some examples on how to convert between say... the following two numbers:

-0.769 and -4.537

Thank You

  • Hi,

    Which device and which SDK version are you using?

    Best Regards,
    Yordan
  • Device = TMS320C3X
    SDK = no SDK, just doing mathematical calculations using a pencil and paper right now
  • Steven,

    "TMS320C3X" is not a device number; it is a family of parts, many of which no longer appear on TI.com because of the age of the devices. Some were put on Lifetime Buy many years ago, and some are still available for purchase. The actual part number you have on your board is what we are asking for, which will help direct our resources from the correct place to give you the right support. For example, TMS320C32 does not show up on TI.com.

    I would assume you have an existing board. Is that true? If not, I strongly recommend you look at the newer and faster native-floating point devices, including the TMS320C6748 and TMS320C6655.

    Do you have the documentation from TI for your device? Do you have the compiler/assembler/linker for your device?

    Regards,
    RandyP
  • Randy,

    Believe me, I am fully aware of the status on this part. Also, I am not doing a design here. Purely academic at this point.

    I only want to know whether you understand how this conversion works or not.

    Thank you

  • Yumchin,

    What documentation from TI do you have for your device? Do you have the compiler/assembler/linker for your device?

    When I taught classes on the C30 in the early 1990's, I understood how the floating point format worked, but those were the days of majority assembly programming and debug; and I do not recall it now. Today's floating point processors use a different standard for floating point format, and I just let the compiler and CCS debugger do the conversion for me.

    That is why I asked if you have the compiler. I would recommend you put the numbers into C code (or assembly) and let the compiler (or assembler) do the conversion so you can look at it in the listing output file.

    If you want to know it at the bit level for academic reasons, it should be described well in the documentation. I do not know if there were variations in the format from one device to another, so I do not know where to refer you without more detail.

    Regards,
    RandyP
  • Randy,

    As previously stated, I'd like to be able to do these calculations by hand. And when you said ""TMS320C3X" is not a device number; it is a family of parts, many of which no longer appear on TI.com because of the age of the devices." There is documentation available on this part despite the age. However, that doesn't mean the documentation is the easiest thing to understand.

    I'll point you to a link for the C30 floating-point documentation (still same C3X family device). Obviously this has been a problem for people, as there is an entire document dedicated to its cause. Take a look at:

    www.ti.com/.../spra400.pdf

    Thank you very much for your response.

  • Hi,

    I am not aware of such examples (which you require in your initial post).
    I will notify the design team to see if we still provide support for this device. Feedback will be posted directly here.

    Best Regards,
    Yordan
  • Yordan,

    That would be extremely helpful. Thank you.

    S

  • Have you referred to the section 3-20 in the TMS320C3x GENERAL-PURPOSE APPLICATIONS USER'S GUIDE
    www.ti.com/.../spru194.pdf

    This is a fairly old DSP with not much developer/design resource available to consult. I recommend that you post further question on the TI compiler forum who may have experts with history on these parts.

    Regards,
    Rahul
  • Yes, I've read the section. Did not find it very useful. Seems cryptic/antiquated in how they describe all the "cases" would like to speak with someone who worked on this DSP/knows what they're doing.

    Thank you
  • You state that you can convert 0.046875 to 0xFB400000. Converting from -0.768 should be no different.
    -0.769 = -1 * (1/2) * 1.538
    sign = 1
    exp = -1 -> 0xFF
    mantissa = 0.538 = 4429185.024 / 0x800000 -> binary = 4429185 = 0x439581
    Final binary = 0xFF839581
    Note that there is loss of precision and -0.769 cannot be exactly represented in floating point. Converting back won't result in the same value. The conversion is the same principles are IEEE floating point. Lots of examples out there.
  • I understand your thinking that this would be the process for TMS320C32's floating point, but would highly encourage you to read the application note I've attached (or linked, I don't remember) in a previous post. There seem to be special "cases" where different variations of the IEEE bit-fields are manipulated before being stored as C32 floating point bit fields. See if you can make any sense of how that logic works.

    Right now I am noodling out something that will break a number down into the IEEE bit fields, where I can then manipulate them according to the guidelines laid out in the application note. I have not been successful in doing this yet.

    Steve