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.

ROV with floating-point values

I have a RTSC structure that contains floating-point values, and I'd like to show them in an ROV view.  However, the value that CCS (5.2.1.00018, with XDCtools 3.23.03.53, for a C64x+ target) shows is what obtains by treating the bits as an integer rather than a floating-point value.

For example, if I look at the structure in a Memory Browser tab, the location of one "float" contains 0x461CBC74.  Interpreted as a floating-point value -- e.g. using the "32 Bit Float" decoder -- this is 10031.11.  With the "32 Bit Signed Integer" decoder, it is 1176288372.  When my ROV viewInitFxn copies the value from the instance object (second parameter) to the view object (first parameter), it displays as 1176288372.  I get the same value if I use Program.fetchStruct(ScalarStructs.S_Float$fetchDesc, ...).

Is this intended?  Is there a workaround (short of writing XDCscript to decode IEEE floats) that will let my ROV code show the correct value for this field?

  • Michael,

    One way to do this is to declare the value as a “String” in the ModuleView structure.  And then in viewInitModule() simply set that string value to the floating point value and let the conversion happen automatically.

    For example, in the module .xdc file:

        /*!
         *  ======== ModuleView ========
         */
        metaonly struct ModuleView {

            String myFloat;
        }


    And then in viewInitModule() in the .xs file:

            view.myFloat = (123.45678).toFixed(3);


    In this arbitrary example the specification of “toFixed(3)” will cause the ROV view to display the float value to three decimal places: 123.457

    Does something like this work for you?

    Scott

  • Scott,

    Using "view.myFloat = obj.floatField.toFixed(3);" generates a value like 1176288372.000.  Even a Javascript "print(obj.floatField);" (when starting CCS with the -console flag) shows the integer-interpreted value.  As far as I can figure out, the ROV back end is generating the Javascript object as if the 32-bit word is an integer rather than a floating-point value.

    Michael

  • Michael,

    I just tried referencing a float within the module state object (versus just a float value as I’d tried before) and see the same behavior.  I’m doing this on an MSP430, so the issue is not isolated to C64x+. 

    I will ask around tomorrow to see if there is an alternate method to recommend to you.  And, file a bug report for this improper conversion from a float to string...

    Scott

  • Michael,

    We did some more testing and narrowed the conversion issue to be a problem somewhere within ROV.  The underlying memory accesses and conversions are OK, but there appears to be an intermediate conversion to an integer within ROV. 

    I filed a bug report for this: Bug 393211

    Scott

  • BTW, the bug that Scott filed was against the RTSC component, which is an Eclipse OSS project.  Which means that you can see the bug report at:

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=393211

    I am going to mark this thread as Answered and anyone interested in how the problem is ultimately dispositioned should go to the Bugzilla record.

    Scott, you should add this thread's URL to the Bugzilla record as well.

    Dave