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.
Hello all,
I am trying to use the _gmpy4 intrinsic as part of some reed-solomon code, however I get very different results based on whether I run the code natively or on the target. On target, I am seeing the result I would expect, but when running on the host, I get stuck in an infinite while loop. I have run the unit tests supplied with the host intrinsics package, which pass, however they only test GF(256), while my code operates on GF(64). If I change GFPGFR to operate over the GF(64) field, the tests hang.
The following code will cause an infinite loop:
#include "C6xSimulator.h" GFPGFR = 0x500000c; _gmpy4(0, 0); // hangs on this call
Even if I leave GFPGFR at its default value, I get an infinite loop. I also tried the code from example 3 in Application Report SPRA686, which also hangs. Could there be a bug in the host intrinsics implementation of this function? If so any idea how to fix it or work around it?
thanks,
Mark
This one is being looked into. I'm sure you would like to know more than that. A response should be posted by tomorrow or the next day.
Thanks and regards,
-George
I apologize for the delay. At this point, it looks like this one will go on past the holidays.
Thanks and regards,
-George
Unfortunately, no. I was hoping for a quick fix of some sort. It is time to admit that isn't going to happen. The other approach I am considering is a longer term thing. Which means more planning and people need to be involved.
I'm sorry I'm being less than clear here. I figure you aren't too concerned with all the low level details.
Thanks and regards,
-George
hi guys
the polynomial division was diverging for GF(64), hence the endless loop. the following patch made it work for me, and passes all the unit tests i have:
Index: hostport/C6xSimulator.c =================================================================== --- hostport/C6xSimulator.c (revision 322703) +++ hostport/C6xSimulator.c (revision 338579) @@ -1323,29 +1322,28 @@ /* multiply the four sets of polynomials together */ for(k=0;k<8;k++) { - c = mask&a32.x4u.hi2; + c = (mask&a32.x4u.hi2) >> (8-m); ytmp[3] ^= b32.x4u.hi2*c; - c = mask&a32.x4u.hi1; + c = (mask&a32.x4u.hi1) >> (8-m); ytmp[2] ^= b32.x4u.hi1*c; - c = mask&a32.x4u.lo2; + c = (mask&a32.x4u.lo2) >> (8-m); ytmp[1] ^= b32.x4u.lo2*c; - c = mask&a32.x4u.lo1; + c = (mask&a32.x4u.lo1) >> (8-m); ytmp[0] ^= b32.x4u.lo1*c; mask <<= 1; } - /* divide each result by the generator polynomial */ for(k=0;k<4;k++) { maxpower2 = 30-_norm(ytmp[k]); - while(maxpower2 >= m) + while(maxpower2 >= 8) { - c = poly << (maxpower2 - m); + c = poly << (maxpower2 - 8); ytmp[k] ^= c; maxpower2 = 30-_norm(ytmp[k]); }
cheers,
sam