AnsweredAssumed Answered

DAG register issues SC589 Anomaly 20000002?

Question asked by on May 18, 2017
Latest reply on May 31, 2017 by StuartS

I am having issues loading the DAG registers correctly.  The following assembly code is crashing, it appears that the Lx register is not loading:


//******************** Code Start *******************

r0 = i0; puts = r0;

i0 = r4;

l4 = dm(offsetof(CIRCBUFFER, size), i0);   //get length
b4 = dm(offsetof(CIRCBUFFER, pbase), i0); // get base address
i4 = dm(offsetof(CIRCBUFFER, pdata), i0); // get pointer to #data

m4 = 2;
r2 = 8;
i0 = r8; // point to input buffer

lcntr = r2, do loopLabel until lce;

r0 = dm(i0, m4) (lw); // get two words
dm(i4, 1) = r0; // put first word
dm(i4, 1) = r1; // put second word

i0 = r4; // save pointer
r0 = i4;
dm(offsetof(CIRCBUFFER, pdata), i0) = r0;

l4 = 0;
i0 = gets(1);

//******************** Code End *******************


I have implemented the function using C in CCES using the builtin circular buffer pointer function:


//******************** Code Start *******************

int i;

for(i = 0; i < 16; i++)
      *(pbuffer->pdata) = buffer[i];
      pbuffer->pdata = __builtin_circptr(pbuffer->pdata, sizeof(float), pbuffer->pbase, pbuffer->size*sizeof(float));

//******************** Code End *******************


This works as long as I do not enable optimizations.  Apparently, the silicon anomaly is corrected by the C compiler as long as the code is not optimized.  As soon as optimizations are applied, the code crashes.


So, my question is specific: How do I modify the above assembler to avoid the issues that I am having?


Thank You.