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.

TMS320F2837x CLA MNOP

Hi All,

For the CLA I've created a .cla source file but when I compile it, the compiler puts EVERYWHERE MNOP instructions in between? Is the compiler doing this by default? Nice to have a fast CLA at 200MHz, but when it's inserting 3 MNOPS after (almost) every instructions I'm getting real sad..

        MI32TOF32 MR0,MR0               ; [CPU_] |42|
        MCMPF32   MR0,#16384            ; [CPU_] |42|
        MNOP      ; [CPU_]
        MNOP      ; [CPU_]
        MNOP      ; [CPU_]

        MBCNDD    $C$L2,GEQ             ; [CPU_] |42|
        MNOP      ; [CPU_]
        MNOP      ; [CPU_]
        MNOP      ; [CPU_]

  • Hi Tjarco,

    The CLA has an unprotected pipeline, meaning the compiler has to take care that NOPs are put in the right places to ensure correct operation. In the example you show above, the 6 NOPs (delay slots) are for the branch instruction MBCNDD. The branch instruction requires that the decision for the branch (MCMPF32 in this case) takes place exactly 3 cycles before MBCNDD and the actual branching takes place 3 cycles after MBCNDD - hence the 3 NOPs before and after

    Now, if you turn optimization on -O2, and if there is sufficient code density, the compiler will replace those NOPs with instructions that do not interfere with the branching instruction.

    There are other instructions like the branch e.g. MRCNDD that also have these delay slots. You will find their description in the CLA chapter of the device TRM.

  • Hi Vishal,

    Yes you're right, -O2 does optimize the code and reduces execution time about 20%.
     Didn't know that the CLA has an unprotected pipeline. Thank you for the clarification.