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.

Why does dsp pass two lines one time?

Other Parts Discussed in Thread: TMS320C6678

 Hi,

 I am learning some knowledge of asm. The following code is from the pdf manual. The original code has a '||' sign before line 7. I found that it passes 6 and 7 when exec line 5. When I step through the following code of TMS320C6678, the core steps line 4, 5, then 9 even after I remove '||' sign of line 7. I do not understand why it can pass line 6 and 7 together with line 5. Is it true that line 5,6 and 7 execute as a one cycle? It is not the same way as the execute packet as the manual says to me.

The second question is: I notice that line 6, 7 each has 32 bit instruction code. DSP can exec line 6 and 7 no matter the '||' sign exists or not?

 Thanks.

.................................................

4                                          MVK 1, A1          

        cpyer_asm:

0c016000:   24A6                MVK.L1        1,A1

5                                          B .S1 LOOP

0c016002:   014A                BNOP.S1       LOOP (PC+10 = 0x0c01600a),0  

6                                          ADD .L1 A1, A2, A3

0c016004:   2130                ADD.L1        A1,A2,A3  

7                                          ADD .L2 B1, B2, B3

0c016006:   2131                ADD.L2        B1,B2,B3  

9                                          ADD .D1 A4, A6, A4

0c016008:   8336                ADD.D1        A4,A6,A4

10                        LOOP:     MPY.M1X A3, B3, A4

.......................................................................

 

  • Hi,

    Below is the original code on page 169 of

    TMS320C66x DSP CPU and Instruction Set. Literature Number: SPRUGH7 November 2010

    I run this code. It does not work as the cycle table on Page 169. That is, it does  not stop at 0004h at all. Am I wrong?

     

    Thanks.

     

    ............

    0000 0000 B .S1 LOOP

    0000 0004 ADD .L1 A1, A2, A3

    0000 0008 ||ADD .L2 B1, B2, B3

    0000 000CLOOP: MPY.M1X A3, B3, A4

    0000 0010 ||SUB .D1 A5, A6, A6

    0000 0014 MPY .M1 A3, A6, A5

    0000 0018 MPY .M1 A6, A7, A8

    0000 001C SHR .S1 A4, 15, A4

    0000 0020 ADD .D1 A4, A6, A4

  • Robert,

    That is just a sample to explain how the Branch instruction works. You cannot put instructions at address 0x0000 0000 in the C6678.

    The formatting in your first post makes it very difficult to understand what is happening or what your are trying to do. This is really bad code in terms of overlapping execution packets, so it does not seem practical to try to debug something that is not real code.

    Please use the C compiler to write your application and use the optimizer to get the best performance you can. After that, you can try modifying the assembly output from the compiler if you have to do so.

    I am not aware of much online training for assembly programming, but is you go to the Wiki and search for "C6000 optimization workshop" (no quotes) you may find the archived student guide and labs from some of our past training.

    Regards,
    RandyP

  • Robert,

    That is just a sample to explain how the Branch instruction works. You cannot put instructions at address 0x0000 0000 in the C6678.

    I agree. I removed the left two columns and saved the code as an .asm file to compile and run.

     

    The formatting in your first post makes it very difficult to understand what is happening or what your are trying to do. This is really bad code in terms of overlapping execution packets, so it does not seem practical to try to debug something that is not real code.

    I supposed that it would run in an efficient (parallel ADDs) or not only.

    Please use the C compiler to write your application and use the optimizer to get the best performance you can. After that, you can try modifying the assembly output from the compiler if you have to do so.

    I agree that C coding is the most appropriate choice for many many applications. The manager just wants us to use assembly to get better performance. I am amazed by the C compiler performance. A good algorithm, an appropriate C coding style generally are much better than asm in both performance and using much less time. 

     

    I am not aware of much online training for assembly programming, but is you go to the Wiki and search for "C6000 optimization workshop" (no quotes) you may find the archived student guide and labs from some of our past training.

    I originally thought that each step instruction (F6) represented a clock cycle or two (or more) for the execution. Now, I realize that TI DSP separate timing (clock cycle) simulation (by TSCL,H) from logic function (even in cycle accurate simulator). It seems that one instruction step (F6) can represent two or more instructions (two or more clock cycles in timing), such as a B (branch instruction) followed by two ADD instructions can run through by one F6 press. They are in fact two excution packets. Am I right about the above feature?

    I hope that I can find such descriptions about these simulation features. If you have some recommendations, I'd like to learn. After a huge manual reading, it still has some to learn about CCS.

     

    Thanks again.

     

    Regards, RandyP

  • Robert,

    Robert W said:
    A good algorithm, an appropriate C coding style generally are much better than asm in both performance and using much less time.

    I am not sure I would state it quite so strongly (although "better" is ambiguous enough I might), but you may want to consider stating this to your manager. In all of our classes, we tell our customers to start with C in a Debug build and test it functionally. If it performs well enough, stop and go on to your next project or take a vacation. Otherwise use the Release build and apply other optimization methods until it does perform well enough.

    If you need more performance, start from the compiler's assembly output. That is the best place to learn how to program assembly well. Starting from the CPU & Instruction Set Reference Guide is not a good way to learn how to program assembly. It is a lot easier to learn how something works right than to debug small details about what does not work right.

    Why are you using the F6 key in assembly? You want to do assembly-step operations not C-source step operations.

    You are doing something wrong, maybe just the F6, but the simulator does not behave this way when you do it right. If you are still having trouble, we can move this thread to the Code Composer forum to get you some simulator and CCS help.

    Regards,
    RandyP