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.

Instruction Set - Reference Guide - SPLOOPW

Other Parts Discussed in Thread: OMAPL138

Hello!

There might be a typo in document TMS320c674x DSP CPU and Instruction Set. Reference Guide. SPRUFE8B. July 2010.

Page 675. The encircled instruction should be conditioned on [A0] and not on [!A0]. Please look at the attachment.


Best regards

Przemyslaw Baranski

  • Hi,

    Thanks for your post.

    In my understanding, If you look page no. 486, as per the syntax, it is SPLOOPW ii where ii value cannot be negative as per the bit fields of 23 to 27 of the opcode is ii-1. So, if you choose ii to be 1, it would be 1-1=0 but as per page no. 675, Example 7.7 in your case, the termination condition should be A0 equal to 0 which mean, the loop will terminate when A0 attains the value of 0. This is as per the C code logic specified in Example 7-6, but as per the assembly syntax of SPLOOPW ii, we cannot keep the value of ii to be 0, if we do so, the bit fields 23 to 27 of opcode would be negative value (0-1), so, forcefully, we are choosing the ii value to be 1 in order to meet 1-1=0 in the SPLOOPW ii syntax, but our termination condition as per C code logic remains same which is "A0 equal to 0". In order to meet the requirement of C code logic as well Assembly syntax, we have been forcefully made ii value to 1, so that our termination condition would meet when A0 equal to 0 by keeping [!A0] in the document would hold good.

    By the above statement, if A0 value reaches 0 by decrementing from its initial value of 8 which is loaded through MVK assembly instruction, the !A0 (NOT value of A0) would be 1 which then checks the condition as per the mentioned syntax SPLOOPW 1 in the doc. and by the way, whenever the !A0 value equals ii which is 1 mentioned as per syntax, the loop will terminate but indirectly, it means, when A0 value decrements from 8 to 0 and !A0 (which is 1) equals ii (which is 1), the loop will terminate and thus meets the same C code logic as per Example 7.6

    In my opinion, !A0 mentioned in the document should be fine and it is intentionally drafted the way it is in order to meet the assembly syntax compatibility of SPLOOPW ii (please refer page no 485)

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Hi Sivaraj!

    Thanks for your rapt response. Surely, there is something wrong. When I change the condition to [A0] the code works as expected.

    I have CCS Version: 4.2.4.00033 and work on OMAPL138.

    Best regards
    Przemyslaw Baranski

  • Hi,

    Thanks for your update.

    If possible, could you please share your build & output logs which you mentioned that, it works as expected when you change the condition from [!A0]to [A0] in the code.

    Thanks & regards,
    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------

  • Hi!

    Please find attached the asm code, that I extracted. 


    // ------------- TESTBED

    extern void  test_sploop2( void * src, void * dst, int cnt );
    int src[] = {1,2,3,4,5,6,7,8};
    int dst[] = {0,0,0,0,0,0,0,0};

    int main()
    {
    // ... initialization
    test_sploop2( src, dst, 8 );
    }

    5238.test.asm

    Best regards
    Przemyslaw Baranski

  • Hi Sivaraj!

    Have you managed to try the code?

    Best regards
    Przemyslaw Baranski

  • Hi,

    I do apologise for the misinterpretation and now, i am clarified with your point.

    Yes,  it should be [A0] for the condition on the SPLOOPW instruction in the TI documentation.

    Thanks for your clarification.

    Regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question

    -------------------------------------------------------------------------------------------------------