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.

TMS320F2811: CPU execution speed is different between F2811 and F2809 at the same system clock.

Part Number: TMS320F2811
Other Parts Discussed in Thread: TMS320F2809,

Hi,

The question is about comparison of CPU speed between TMS320F2809 and TMS320F2811.

I used hardware timer to measure the execution time. The codes are like this.

lTimerStart = ReadCpuTimer0Counter();
for(iTestCpuSpeed1 = 0; iTestCpuSpeed1 < iTestCpuSpeed2; iTestCpuSpeed1++) ;
lTimerEnd = ReadCpuTimer0Counter(); // down counter
if(lTimerEnd > lTimerStart) { // wrap-up
    lTimerGap = lTimerEnd - lTimerStart + CpuTimer0Regs.PRD.all;
}
else {
    lTimerGap = lTimerStart - lTimerEnd;
}

TMS320F2809 is operated with 20MHz OSC and TMS320F2811 with 30MHz OSC.

The Pll is set as 60MHz for both.

iTestCpuSpeed2 is 10.

The result is that lTimerGap is 179 and 188 for F2809 and F2811 respectively.

F2809 is slightly faster than F2811.

How can you explain this?

Thank you.

  • The difference is unlikely to be the device. As the difference is only a small number of cycles I suspect slightly different assembly code is being generated by the compiler.

    Check first that the code is located in 0-wait state RAM in both cases. Also, if your F2811 is earlier than Rev.C you'll have some extra memory initialization to do (see the advisory on p.10 of the errata sheet).

    Then look at the generated assembly code in a dis-assembly window. That may give you some clues about where the cycles are being lost. Check also that the compiler settings, and particularly the optimizer, are the same in your two projects. This is most likely where the difference is coming from.

    Regards,

    Richard
  • 1. the code is executed from Flash.

    2. I initialized memory from the errata sheet, there's no difference.

    3. I compared the assembly code.

    This is assembly code for F2811.

    .dwpsn file "Mot_Pwm.C",line 602,column 2,is_stmt
    MOVW DP,#_CpuTimer0Regs
    MOVL ACC,@_CpuTimer0Regs ; |602|
    MOVW DP,#_lTimerStart
    MOVL @_lTimerStart,ACC ; |602|
    .dwpsn file "Mot_Pwm.C",line 603,column 6,is_stmt
    MOVW DP,#_iTestCpuSpeed1
    MOV @_iTestCpuSpeed1,#0 ; |603|
    .dwpsn file "Mot_Pwm.C",line 603,column 26,is_stmt
    MOV AL,@_iTestCpuSpeed2 ; |603|
    CMP AL,@_iTestCpuSpeed1 ; |603|
    B $C$L35,LOS ; |603|
    ; branchcc occurs ; |603|
    $C$L34:
    $C$DW$L$_PWM_ISR$67$B:
    .dwpsn file "Mot_Pwm.C",line 603,column 59,is_stmt
    INC @_iTestCpuSpeed1 ; |603|
    .dwpsn file "Mot_Pwm.C",line 603,column 26,is_stmt
    CMP AL,@_iTestCpuSpeed1 ; |603|
    B $C$L34,HI ; |603|
    ; branchcc occurs ; |603|
    $C$DW$L$_PWM_ISR$67$E:
    $C$L35:
    .dwpsn file "Mot_Pwm.C",line 604,column 2,is_stmt
    MOVW DP,#_CpuTimer0Regs
    MOVL ACC,@_CpuTimer0Regs ; |604|
    MOVW DP,#_lTimerEnd
    MOVL @_lTimerEnd,ACC ; |604|
    .dwpsn file "Mot_Pwm.C",line 605,column 2,is_stmt
    MOVL ACC,@_lTimerStart ; |605|
    CMPL ACC,@_lTimerEnd ; |605|
    B $C$L36,GEQ ; |605|
    ; branchcc occurs ; |605|
    .dwpsn file "Mot_Pwm.C",line 606,column 3,is_stmt
    MOVL ACC,@_lTimerEnd ; |606|
    SUBL ACC,@_lTimerStart ; |606|
    MOVW DP,#_CpuTimer0Regs+2
    ADDL ACC,@_CpuTimer0Regs+2 ; |606|
    MOVW DP,#_lTimerGap
    MOVL @_lTimerGap,ACC ; |606|
    .dwpsn file "Mot_Pwm.C",line 607,column 2,is_stmt
    B $C$L37,UNC ; |607|
    ; branch occurs ; |607|
    $C$L36:
    .dwpsn file "Mot_Pwm.C",line 609,column 3,is_stmt
    MOVL ACC,@_lTimerStart ; |609|
    SUBL ACC,@_lTimerEnd ; |609|
    MOVL @_lTimerGap,ACC ; |609|

    This is assembly code for F2809.

    MOVW DP,#_CpuTimer0Regs
    MOVL ACC,@_CpuTimer0Regs ; |1026|
    MOVW DP,#_lTimerStart
    MOVL @_lTimerStart,ACC ; |1026|
    MOVW DP,#_iTestCpuSpeed1
    MOV @_iTestCpuSpeed1,#0 ; |1027|
    MOV AL,@_iTestCpuSpeed2 ; |1027|
    CMP AL,@_iTestCpuSpeed1 ; |1027|
    B $C$L52,LOS ; |1027|
    ; branchcc occurs ; |1027|
    $C$L51:
    $C$DW$L$_PWM_ISR$102$B:
    INC @_iTestCpuSpeed1 ; |1027|
    CMP AL,@_iTestCpuSpeed1 ; |1027|
    B $C$L51,HI ; |1027|
    ; branchcc occurs ; |1027|
    $C$DW$L$_PWM_ISR$102$E:
    $C$L52:
    MOVW DP,#_CpuTimer0Regs
    MOVL ACC,@_CpuTimer0Regs ; |1028|
    MOVW DP,#_lTimerEnd
    MOVL @_lTimerEnd,ACC ; |1028|
    MOVW DP,#_lTimerStart
    MOVL ACC,@_lTimerStart ; |1029|
    MOVW DP,#_lTimerEnd
    CMPL ACC,@_lTimerEnd ; |1029|
    B $C$L53,GEQ ; |1029|
    ; branchcc occurs ; |1029|
    MOVL ACC,@_lTimerEnd ; |1030|
    MOVW DP,#_lTimerStart
    SUBL ACC,@_lTimerStart ; |1030|
    MOVW DP,#_CpuTimer0Regs+2
    ADDL ACC,@_CpuTimer0Regs+2 ; |1030|
    B $C$L54,UNC ; |1031|
    ; branch occurs ; |1031|
    $C$L53:
    MOVW DP,#_lTimerStart
    MOVL ACC,@_lTimerStart ; |1033|
    MOVW DP,#_lTimerEnd
    SUBL ACC,@_lTimerEnd ; |1033|
    $C$L54:
    MOVW DP,#_lTimerGap
    MOVL @_lTimerGap,ACC ; |1033|

    After stripping out unnecessary lines, the assembly code is like below.

    Left is F2811, Right is F2809. The assembly code is almost the same.

    From map file, the address of variable is like this.

    F2809

    F2811

    In both cases, RAM H area is used.

  • I am not sure. I have been unable to force any difference in similar code between the '069 and '379 devices I have access to.

    Regarding F2811 and F2809; the CPU and CPU timers are identical on these devices so if you are seeing a difference in cycle count it can only be attributed to the code or to memory access timing. Did you check the F2811 device revision I asked about?

    When you write in C you are reliant on the compiler to do a consistent job of generating efficient assembly code. Changes to the compiler settings may affect this, as may the compiler version. The linker needs to be set up in a consistent way too so that variables are in similar locations. From the disassembly code I can see there are more DP loads in the F2811 (the opposite of what I would expect fromn your measurements - can you double-check F2811 was on the left?). This may be because the variables "_iTimerStart" and "iTimerEnd" were not on the same data page when you built for that device, whereas they were when you built for the F2809.

    In my view, to measure accurate timings across devices you are better off coding in assembly. For this case I can only suggest you step through the assembly code to try to identify where the extra cycles are coming in. You can use the CCS clock to help with this.

    Can you post the compiler settings you are using please?

    Regards,

    Richard
  • Hi,

    The compiler setting from CCS project file(.pjt) is as follows. I use 'Debug' configuration so the 'Debug' settings are shown. I use Code Composer Studio V3.3 and Code Generation Tools 5.2.12.

    [F2811]

    ["Compiler" Settings: "Debug"]
    Options=-g -q -pr -pdv -pden -pds9 -fr".\Debug" -i".\include" -i"C:\ti\c2000\cgtools_313\include" -d"_DEBUG" -d"LARGE_MODEL" -ml -v28

    ["DspBiosBuilder" Settings: "Debug"]
    Options=-v28

    ["Linker" Settings: "Debug"]
    Options=-q -c -m".\Debug\XPrima.map" -o".\Debug\XPrima.out" -stack0x400 -w -x -l".\Lib\rts2800_ml-V040610.lib"

    ["Mot_Pwm.C" Settings: "Debug"]
    Options="Compiler" +{-k}

    [F2809]

    ["Compiler" Settings: "Debug"]
    Options=-k -pds9 -fr"$(Proj_dir)\Debug_4.1.3" -fs"$(Proj_dir)\Debug_4.1.3" -i"$(Proj_dir)\Include(TI)" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28

    ["Linker" Settings: "Debug"]
    Options=-c -heap0x2000 -m".\Debug_4.1.3\ALLGrp_S100_Main.map" -o".\Debug_4.1.3\ALLGrp_S100_Main.out" -stack0x400 -w -x

    ["F2809_Start.cmd" Settings: "Debug"]
    LinkOrder=1

    I did another test where asm(" nop") is inserted one by one. But the amount of timer count increase is not regularly proportional.

    asm(" nop") count / lTimerGap

    0    7

    1    8

    2    12

    3    12

    4    13

    5    14

    6    18

    Why does lTimerGap increase abruptly when asm(" nop") count is from 1 to 2 and 5 to 6? Does this have something to do with cache miss or pipeline?

    And in another test, DATA_SECTION pragma is used to force the variable to be allocated in the same data page.

    As a result, the map file shows the variables are in the same data page.

    But, the loading DP register is still there.

     .dwpsn file "Mot_Pwm.C",line 610,column 2,is_stmt
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |610|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |610|
     .dwpsn file "Mot_Pwm.C",line 612,column 2,is_stmt
     nop
     .dwpsn file "Mot_Pwm.C",line 613,column 2,is_stmt
     nop
     .dwpsn file "Mot_Pwm.C",line 614,column 2,is_stmt
     nop
     .dwpsn file "Mot_Pwm.C",line 615,column 2,is_stmt
     nop
     .dwpsn file "Mot_Pwm.C",line 616,column 2,is_stmt
     nop
     .dwpsn file "Mot_Pwm.C",line 617,column 2,is_stmt
     nop
     .dwpsn file "Mot_Pwm.C",line 618,column 2,is_stmt
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |618|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |618|
     .dwpsn file "Mot_Pwm.C",line 619,column 2,is_stmt
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |619|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |619|
            B         $C$L34,GEQ            ; |619|
            ; branchcc occurs ; |619|
     .dwpsn file "Mot_Pwm.C",line 621,column 3,is_stmt
            MOVL      ACC,@_lTimerEnd       ; |621|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |621|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |621|
            MOVW      DP,#_lTimerGap
            MOVL      @_lTimerGap,ACC       ; |621|
     .dwpsn file "Mot_Pwm.C",line 622,column 2,is_stmt
            B         $C$L35,UNC            ; |622|
            ; branch occurs ; |622|
    $C$L34:   
     .dwpsn file "Mot_Pwm.C",line 625,column 3,is_stmt
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |625|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |625|
            MOVW      DP,#_lTimerGap
            MOVL      @_lTimerGap,ACC       ; |625|
    $C$L35:   

    I will try to code in assembly to measure accurate timing as you suggest.

    Thank you.

  • Can you let me have an update on the question please? I'm wondering if you created an assembly module and if it yielded any information?

    Thanks.

    Regards,

    Richard
  • Hello,

    It's been a while, I was too busy to answer.

    Thank you for your support.

    As you suggested, I made an assembly module.

    This module was made by the following process.

    1. make a new c file which includes only time measuring function

    2. generate asm file by compling

    3. strip out unnecessary part

    The resulting file is like this.

    ;***************************************************************
    ;* TMS320C2000 C/C++ Codegen                         PC v4.1.3 *
    ;* Date/Time created: Wed Jan 16 11:53:49 2019                 *
    ;***************************************************************
     .compiler_opts --mem_model:code=flat --mem_model:data=large --quiet --silicon_version=28
    FP .set XAR2

     .sect ".text"
     .global _measure_time_asm
     .global _measure_time_asm1
     .global _measure_time_asm2
     .global _measure_time_asm3
     .global _measure_time_asm4
     .global _measure_time_asm5
     .global _measure_time_asm6
     .global _measure_time_asm7
     .global _measure_time_asm8
     .global _measure_time_asm9
     .global _measure_time_asm10
     .global _measure_time_asm11
     .global _measure_time_asm12

    ;***************************************************************
    ;* FNAME: _measure_time                 FR SIZE:   0           *
    ;*                                                             *
    ;* FUNCTION ENVIRONMENT                                        *
    ;*                                                             *
    ;* FUNCTION PROPERTIES                                         *
    ;*                            0 Parameter,  0 Auto,  0 SOE     *
    ;***************************************************************

    _measure_time_asm:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L1,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap
            MOVL      @_lTimerGap,ACC       ; |45|
            B         L2,UNC                ; |46|
    L1:   
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap
            MOVL      @_lTimerGap,ACC       ; |49|
    L2:   
            SPM       #0
            LRETR

    _measure_time_asm1:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L11,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap1
            MOVL      @_lTimerGap1,ACC       ; |45|
            B         L12,UNC                ; |46|
    L11:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap1
            MOVL      @_lTimerGap1,ACC       ; |49|
    L12:
            SPM       #0
            LRETR

    _measure_time_asm2:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L21,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap2
            MOVL      @_lTimerGap2,ACC       ; |45|
            B         L22,UNC                ; |46|
    L21:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap2
            MOVL      @_lTimerGap2,ACC       ; |49|
    L22:
            SPM       #0
            LRETR

    _measure_time_asm3:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L31,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap3
            MOVL      @_lTimerGap3,ACC       ; |45|
            B         L32,UNC                ; |46|
    L31:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap3
            MOVL      @_lTimerGap3,ACC       ; |49|
    L32:
            SPM       #0
            LRETR

    _measure_time_asm4:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L41,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap4
            MOVL      @_lTimerGap4,ACC       ; |45|
            B         L42,UNC                ; |46|
    L41:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap4
            MOVL      @_lTimerGap4,ACC       ; |49|
    L42:
            SPM       #0
            LRETR

    _measure_time_asm5:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L51,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap5
            MOVL      @_lTimerGap5,ACC       ; |45|
            B         L52,UNC                ; |46|
    L51:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap5
            MOVL      @_lTimerGap5,ACC       ; |49|
    L52:
            SPM       #0
            LRETR

    _measure_time_asm6:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L61,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap6
            MOVL      @_lTimerGap6,ACC       ; |45|
            B         L62,UNC                ; |46|
    L61:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap6
            MOVL      @_lTimerGap6,ACC       ; |49|
    L62:
            SPM       #0
            LRETR

    _measure_time_asm7:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L71,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap7
            MOVL      @_lTimerGap7,ACC       ; |45|
            B         L72,UNC                ; |46|
    L71:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap7
            MOVL      @_lTimerGap7,ACC       ; |49|
    L72:
            SPM       #0
            LRETR

    _measure_time_asm8:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L81,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap8
            MOVL      @_lTimerGap8,ACC       ; |45|
            B         L82,UNC                ; |46|
    L81:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap8
            MOVL      @_lTimerGap8,ACC       ; |49|
    L82:
            SPM       #0
            LRETR

    _measure_time_asm9:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L91,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap9
            MOVL      @_lTimerGap9,ACC       ; |45|
            B         L92,UNC                ; |46|
    L91:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap9
            MOVL      @_lTimerGap9,ACC       ; |49|
    L92:
            SPM       #0
            LRETR

    _measure_time_asm10:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L101,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap10
            MOVL      @_lTimerGap10,ACC       ; |45|
            B         L102,UNC                ; |46|
    L101:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap10
            MOVL      @_lTimerGap10,ACC       ; |49|
    L102:
            SPM       #0
            LRETR

    _measure_time_asm11:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L111,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap11
            MOVL      @_lTimerGap11,ACC       ; |45|
            B         L112,UNC                ; |46|
    L111:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap11
            MOVL      @_lTimerGap11,ACC       ; |49|
    L112:
            SPM       #0
            LRETR

    _measure_time_asm12:
            MOVW      DP,#_CpuTimer0Regs+4
            AND       @_CpuTimer0Regs+4,#0xffef ; |28|
            MOVL      ACC,@_CpuTimer0Regs   ; |30|
            MOVW      DP,#_lTimerStart
            MOVL      @_lTimerStart,ACC     ; |30|
    * add the code to be tested here - start
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
            nop
    * add the code to be tested here - begin
            MOVW      DP,#_CpuTimer0Regs
            MOVL      ACC,@_CpuTimer0Regs   ; |42|
            MOVW      DP,#_lTimerEnd
            MOVL      @_lTimerEnd,ACC       ; |42|
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |43|
            MOVW      DP,#_lTimerEnd
            CMPL      ACC,@_lTimerEnd       ; |43|
            B         L121,GEQ                ; |43|

            MOVL      ACC,@_lTimerEnd       ; |45|
            MOVW      DP,#_lTimerStart
            SUBL      ACC,@_lTimerStart     ; |45|
            MOVW      DP,#_CpuTimer0Regs+2
            ADDL      ACC,@_CpuTimer0Regs+2 ; |45|
            MOVW      DP,#_lTimerGap12
            MOVL      @_lTimerGap12,ACC       ; |45|
            B         L122,UNC                ; |46|
    L121:
            MOVW      DP,#_lTimerStart
            MOVL      ACC,@_lTimerStart     ; |49|
            MOVW      DP,#_lTimerEnd
            SUBL      ACC,@_lTimerEnd       ; |49|
            MOVW      DP,#_lTimerGap12
            MOVL      @_lTimerGap12,ACC       ; |49|
    L122:
            SPM       #0
            LRETR

    ;***************************************************************
    ;* UNDEFINED EXTERNAL REFERENCES                               *
    ;***************************************************************
     .global _lTimerEnd
     .global _lTimerGap
     .global _lTimerGap1
     .global _lTimerGap2
     .global _lTimerGap3
     .global _lTimerGap4
     .global _lTimerGap5
     .global _lTimerGap6
     .global _lTimerGap7
     .global _lTimerGap8
     .global _lTimerGap9
     .global _lTimerGap10
     .global _lTimerGap11
     .global _lTimerGap12
     .global _lTimerStart
     .global _CpuTimer0Regs

    And I call measure_time_asm() ~ measure_time_asm12() from main() before enabling interrupt.

    The result is shown in the following table.

    Table 1. lTimerGap value in each DSP

    nop count

    2809

    2811

    0

    6

    4

    1

    6

    11

    2

    8

    12

    3

    9

    16

    4

    10

    14

    5

    11

    14

    6

    12

    18

    7

    14

    19

    8

    14

    22

    9

    14

    23

    10

    16

    24

    11

    17

    28

    12

    18

    26

    The result is hard to understand. Sometimesi lTimerGap stays the same even and even decreases if nop operation is added.

    What do you think?

    Thank you.

  • Sorry for the delay in responding. To be honest I am struggling for ideas on this one. I have discussed the issue with a colleague who raised some interesting questions:

    Can you check the flash wait state settings on both devices? As you are running from flash we're wondering if it's possible the wait states have been configured differently and this is causing the execution timing difference.

    Also, as the memory map on these devices is very similar, you may be able to load the .out file of one project directly onto the other device. If you can do that and make the same timing measurements, it would either prove or rule out the software as being the culprit. Can you try that?

    Regards,

    Richard
  • Hi,

    The culprit was Flash wait state.

    This table below shows that when wait state is the same, similar result can be obtained.

    A little difference is observed even when same wait is used in 2811 and I think this originates from pipeline thing of FLASH.

    nop 개수

    2809

    wait = 3

    2811

    wait = 5

    2811

    wait = 3

    2811

    wait = 3

    0

    6

    4

    2

    2

    1

    6

    11

    7

    7

    2

    8

    12

    8

    8

    3

    9

    16

    10

    8

    4

    10

    14

    10

    11

    5

    11

    14

    10

    12

    6

    12

    18

    12

    12

    7

    14

    19

    13

    13

    8

    14

    22

    14

    13

    9

    14

    23

    15

    15

    10

    16

    24

    16

    16

    11

    17

    28

    18

    17

    12

    18

    26

    18

    19

    If time allows, I'm going to test using the same .out file. Becaus Flash memory map is not the same between 2809 and 2811, the same .out file can not be working without modifying. The source program is huge and I need to remove unnecessary part to download the same .out.

  • Great.  Thank you for letting us know.

    Regards,

    Richard