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.
Part Number: UCD3138
Tool/software: TI C/C++ Compiler
Hi,
I am using CCS6.1 with compiler 5.22. I found the result of multiplication of two 32-bits data is not correct. I defined the result as 64 bits data. the correct result should be 0x0000 0056 0038 7512. I saw one register R0 has the number 0x0000 0056, another register R1 has the number 0x00387512, which is correct. however, the result I get is 0x0038 7512 0000 0056, which seems the two registers's data are put in the wrong order.
Is it a bug or I didn't configure the CCS correctly?
Thanks,
Julie
In reply to Keith Barkley:
the code is :
Uint16 uint16_multiply_shift_clamp(Uint32 x, Uint32 y, int16 shift, Uint16 max_value){ Uint64 scale_product_64;
scale_product_64 = (Uint64)x*y;
.............
}
I tried to declare the variable scale_product_64 as a global variable, then the result is correct.
please refer to attached document. I put all the screen captures into this document.
Thanks
Julie64-bits multiplication.docx
In reply to Julie Zhu:
This is expected behavior. When a 64-bit integer value resides in a register pair, the even register holds the high order bits, and the odd register holds the low order bits. When inspecting 64-bit values, avoid looking at the registers. It is easy to get confused. Look in the watch window, or something similar.
Thanks and regards,
-George
TI C/C++ Compiler Forum ModeratorPlease click This Resolved My Issue on the best reply to your questionThe CCS Youtube Channel has short how-to videosThe Compiler Wiki answers most common questionsTrack an issue with SDOWP. Enter your bug id in the Search box.
In reply to George Mock:
George Mock This is expected behavior. When a 64-bit integer value resides in a register pair, the even register holds the high order bits, and the odd register holds the low order bits. When inspecting 64-bit values, avoid looking at the registers. It is easy to get confused. Look in the watch window, or something similar.
I think Julie gave an example where the watch window would show a wrong 64 bit value (namely, when the variable was stored in a register rather than in memory). That looks like a bug in CCS to me (not in the compiler, though).
Markus
In reply to Markus Moll:
George,
If you look at the screen capture I provided, the data shown in the watch window is in wrong order when it arranges the 64-bits data from 2 registers. Should be a problem in the watch window display.
Julie ZhuIf you look at the screen capture I provided, the data shown in the watch window is in wrong order when it arranges the 64-bits data from 2 registers. Should be a problem in the watch window display.
In the above working example the 64-bit variable sum is given a register-pair location of "R8:32,R9:32" in the Variables view, whereas in your failure case the location is given as "R0" which is a single 32-bit register.
Can you post an example project which shows the problem, along with the exact CCS version number? Not sure if the problem is either:
a) A bug in the CCS version you are using.
b) The debug information generated by the compiler has specified the wrong register location for the 64-bit scale_product_64 variable.
In reply to Chester Gillon:
Hi, Chester,
the CCS version I am using is Version: 6.1.0.00104. the project is for UCD3138, I have attached the screen capture for the details.
Julie Zhuthe CCS version I am using is Version: 6.1.0.00104. the project is for UCD3138, I have attached the screen capture for the details.
Not sure if it is significant, but the UCD3138 is big-endian, whereas the ARM devices I failed to re-create the problem with are little-endian. Hopefully someone from TI can repeat the problem with a UCD3138.
Are you able to try a later CCS version to see if the problem has been fixed in a later version?
E.g. found Expressions and variables windows not displaying correct values which was reported against CCS 6.1.0.00104, for which bug SDSCM00051806 was raised which was fixed in CCS 6.1.1