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.

Execution time issue SARAM/XINTF

Hi,

on F28335 I have observed that when I mix access to internal SARAM (L7) and SRAM on XINTF, the code executes substantially slower than when all accesses are on internal memory. This is also valid for part of code that exclusively manipulates SARAM data if it is preceded and followed by accesses to external memory. I'm guessing this has something to do with emptying the pipeline before switching memory but I would like to get a confirmation for my theory. Tried looking for an explanation in the documentation, but with no success.

Am I right in my guesses or something else is going on?

Regards,

Josip

  • Hi Josip,

    If the execution code is accessing some data via CPU data bus which is shared with XINTF access then it'll definitely impact the execution performance. It depends how the these access mixed in the code. If you could provide the sequence of operation, it'll be helpful.

    Regards,

    Vivek Singh 

  • Hi Vivek,

    thank you for the reply. I've experimented with measurement of execution time of a piece of code that checks if two longword locations are equal. For this, I used ePWM6 timer. It counts up at SYSCLK, so a 1 means one CPU cycle. All directly addressed locations are in internal L7 SARAM. Firstly, here is the code with mixed XINTF SRAM and internal L7 SARAM accesses:

    ; get ePWM6 timer value an store it to XINTF SRAM
    MOVL XAR0,#0x006944
    MOV ACC,*
    MOVL XAR0,#0x2000DA
    MOVL *,ACC

    ; check if two locations are equal (done on L7 SARAM)
    MOVL ACC,@@120
    SUBL ACC,@@118
    ABS ACC
    SUBB ACC,#1
    MOVL @@116,ACC ; -1 if equal, >= 0 if not equal

    ; get ePWM6 timer value an store it to XINTF SRAM
    MOVL XAR0,#0x006944
    MOV ACC,*
    MOVL XAR0,#0x2000DC
    MOVL *,ACC

    ; calculate execution time by subtracting two ePWM6 timer values
    MOVL XAR0,#0x2000DC
    MOVL ACC,*
    MOVL XAR0,#0x2000DA
    SUBL ACC,*

    The result in ACC is 25.

    If I use internal L7 SARAM exclusively, the code looks like:

    ; get ePWM6 timer value an store it to L7 SARAM
    MOVL XAR0,#0x006944
    MOV ACC,*
    MOVL @@116,ACC

    ; check if two locations are equal (done on L7 SARAM)
    MOVL ACC,@@124
    SUBL ACC,@@122
    ABS ACC
    SUBB ACC,#1
    MOVL @@118,ACC

    ; get ePWM6 timer value an store it to L7 SARAM
    MOVL XAR0,#0x006944
    MOV ACC,*
    MOVL @@120,ACC

    ; calculate execution time by subtracting two ePWM6 timer values
    MOVL ACC,@@120
    SUBL ACC,@@116

    The result in ACC is 10. Clearly, one cycle is spared because storing of the 1st ePWM6 timer value is done directly, but this cannot account for the huge difference in measured execution times.

    Regards,
    Josip

  • Hi Josip,

    In code where you are storing the timer values on exteranl RAMs, there are two READ operations to external RAM which will stall the pipeline and will add to the execution time. If you substract the two memory READ ACCESS time from the execution, I think you'll get the same number.

    Regards,

    Vivek Singh

     

  • Hi Vivek,

    I do not understand your answer. You say there are two READ operations that cause this, but to my understanding there is only one WRITE operation that can influence the measurement: the writing of first timer value to external RAM prior to executing the measured code (line 05). The only reads from external RAM are when subtracting the two timer values at the end of the code section (lines 22 and 24), but these cannot influence the final result. To be clear, I copied the 1st code segment from my previous post and added line numbers that i referenced in brackets.

    01   ; get ePWM6 timer value an store it to XINTF SRAM
    02   MOVL XAR0,#0x006944
    03   MOV ACC,*
    04   MOVL XAR0,#0x2000DA
    05   MOVL *,ACC
    06
    07   ; check if two locations are equal (done on L7 SARAM)
    08   MOVL ACC,@@120
    09   SUBL ACC,@@118
    10   ABS ACC
    11   SUBB ACC,#1
    12   MOVL @@116,ACC ; -1 if equal, >= 0 if not equal
    13
    14   ; get ePWM6 timer value an store it to XINTF SRAM
    15   MOVL XAR0,#0x006944
    16   MOV ACC,*
    17   MOVL XAR0,#0x2000DC
    18   MOVL *,ACC
    19
    20   ; calculate execution time by subtracting two ePWM6 timer values
    21   MOVL XAR0,#0x2000DC
    22   MOVL ACC,*
    23   MOVL XAR0,#0x2000DA
    24   SUBL ACC,

    Regards,
    Josip

  • Hi Josip,

    Sorry, my mistake. I see that reads I was referring are at the end of program and does not have any impact on the issue you are referring.

    Are you enabling the write buffer feature of XINTF? By default this is not enable hence any write to XINTF will stall the CPU (please check the setting of LEAD/ACTIVE/TRAIL for XINTF). Please enable the write buffer feature (set the WRBUFF value in XINTF Configuration Register to non-zero) and try the same code again and see if this makes any difference.

    Regards,

    Vivek Singh

  • Hi Vivek,

    you were right on the spot! When I enabled WRBUFF, the execution measurement for the situation with external RAM fell from 25 to 11 cycles. I just can't believe that I missed this setting. Mea culpa.

    Regards,
    Josip