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.

Unexpected Memory modification during MAC instructions

I am working with the C5515 eZDSP USB Stick.

I am seeing the content of the memory locations pointed to by CDP modified in the following instructions, and I don't understand how or why.

AC2 = *AR0+*HI(coef(*CDP)),
AC3 = *AR0+*LO(coef(*CDP)) 
AC3 = rnd(AC3 + (*AR0+*HI(coef(*CDP)))),
AC2 = rnd(AC2 - (*AR0+*LO(coef(*CDP))))

I have a breakpoint set to observe the memory location (which is in DARAM), and it stops on these instructions.

This happens very consistently, with the content of *CDP having a small amount added to it each time.

This is the only place where this memory is addressed, other than the initialization.

Just for additional info, here are the values of the status registers:

ST0 = 0x8000
ST1 = 0x6140
ST2 = 0x7400
ST3 = 0x1006

 

  • Once I moved *CDP into SARAM, the problem went away, not that I find that to be entirely satisfactory.

    I think the documentation is a little unclear on this.  It does say that cmem must be in a separate memory bank than smem in the instruction reference (SWPU068E).  However, the word "bank" is not found in the C5515 data sheet, so I thought that as long as they were in separate "blocks" (terminology used in datasheet) then it would be ok. In any case, the bottom line is that I am getting a memory modification in the absence of any instruction to write to memory.  That is an undesirable feature.

    The CPU Reference guide (SWPU073E) does not make any mention of SARAM versus DARAM.  Nor do the instruction sets.  I know the difference between the two should be obvious, but I am having a little trouble seeing the actual difference in execution.  Do you have any pointers to more information?

     

    Thanks!

  • Dustin,

    Each block ("block" as defined in the datasheet) of SARAM provides a single access per cycle (one read or one write). Each block of DARAM provides two access per cycle (two read, two writes, or one read/one write).

    Whether the Smem / Cmem data is contained in SARAM or DARAM should only affect performance, not correct functionality. Also, whether the data is in separate blocks ("blocks" as referred to in the datasheet) should only affect performance, not correct functionality. In either case you can introduce pipeline stalls because the CPU is attempting to access memory more times per cycle than the memory supports.

    Memory accesses and the pipeline are pretty well described in Section 4.4.3 of spru376a.

    I looked at your status register settings and didn't see anything that should cause problems.

    A few questions for you:

    1) What is your XCDP for the case of DARAM vs. SARAM?

    2) What instructions surround the above instructions? Do any of these instructions write to the memory pointed to by CDP?

    3) Are any other buffers moved around by relink when you move the CDP buffers to SARAM?

    I'd be happy to look at a more detailed code example if you can provide one.

     

    Regards,

    Frank

  • Thanks for the response.

    Thanks for pointing me to spru376a.  There is no mention or link to this document anywhere on any of the C5515 pages.  Also do you know why this document is 9 years old and still in "preliminary draft" state.  It seems to cover most of the same ground as swpu073e, which I am pretty familiar with.

    I am not quite in a position to go back and reproduce this right away, but I'll try to get something soon.  I had a pretty stripped down code, and I was pretty confident that there was nothing else that should have written to the memory pointed to by CDP.  I guess the one thing I didn't try was to see if the memory in DARAM was still being modified even after I moved the buffer to SARAM.  Moving that buffer left a hole in DARAM which shouldn't ever be accessed, so that would be a good test.

    One question I have is whether a 32 Bit read on the BB bus counts as a single read, even in SARAM?  I assume it does, I just haven't seen it explicitly stated anywhere.

     

    Best,

     

    Dustin

  • Dustin,

    I don't know the history of the document, so I don't know why it's still listed as "preliminary". I've attached an document containing updates to some of the information. I'll look into have the document officially updated and linked in the C5515 pages.

    Yes, 32-bit reads on BB only count as a single read, even in SARAM.

    Regards,

    Frank

    5861.SPRU376_Update.doc