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.

Converting embedded assembly language instructions/directives

Other Parts Discussed in Thread: TMS320VC33

I'm migrating code from the TMS320VC33 to the TMS320V6748. There's a good deal of embedded assembly. I'm trying to understand how to register operations like PUSH and POP in new instruction set.

/* 32 bit float (A) + 40 bit Float (B) = 40 Bit float (C). */

 

 

 

 

#define ADD_LD(a_DBL,b_LDBL,c_LDBL) asm(" PUSH R0");\

 

 

                                    asm(" PUSH R1");\

 

                                    asm(" LDFU @_"STR(a_DBL)",r0");\

 

                                    asm(" LDFU @_"STR(b_LDBL)",r1");\

 

                                    asm(" LDI @_"STR(b_LDBL)"+1,r1");\

 

                                    asm(" ADDF r0,r1");\

 

                                    asm(" STF r1,@_"STR(c_LDBL));\

 

                                    asm(" STI r1,@_"STR(c_LDBL)"+1");\

 

                                    asm(" POP r1");\

 

                                    asm(" POP r0");

  •  

     

     

     

     

     

    Code in larger font size...

    /* 32 bit float (A) + 40 bit Float (B) = 40 Bit float (C). */

    #define

     

     

     

                               asm(" PUSH R1");\

     

                               asm(" LDFU @_"STR(a_DBL)",r0");\

     

                               asm(" LDFU @_"STR(b_LDBL)",r1");\

     

                               asm(" LDI @_"STR(b_LDBL)"+1,r1");\

     

                               asm(" ADDF r0,r1");\

     

                               asm(" STF r1,@_"STR(c_LDBL));\

     

                               asm(" STI r1,@_"STR(c_LDBL)"+1");\

     

                               asm(" POP r1");\

     

                               asm(" POP r0");
    ADD_LD(a_DBL,b_LDBL,c_LDBL) asm(" PUSH R0");\

  • I recommend you rewrite the macro as a basic C operation ...

    #define ADD_LD(a_DBL, b_LDBL, c_LDBL) c_LDBL = a_DBL + b_LDBL

    Get it all working.  Then deal with any performance issues you may have.

    Thanks and regards,

    -George

  • Thanks George. The simplest answer wasn't that obvious to me. I inherited this mess. And I must admit that I don't completely understand assembly or why it's used in my case. There is a lot of embedded assembly in my code. I like the thought of basic C operations and then working thru optimizing any perofrmance issues (if they come up). There are also a number of ASM files that I need to understand so I can rewrite them in C.

    My followup question is this: are there resources that you are aware of that could help me in this code port (assembly to C)?

    I've read thru the Assembly Language Tools User's Guides; Optimizing Compiler User's Guides, and Programmer's Guides for both the VC33 and the C6748 (C6000). Unfortunately, I need something more fundamental (or generic). Any ideas/recommendations?

     

    I typically have worked at a much higher level (control system blockware), so I don't do much with raw source code. I know C well enough to be dangerous.

     

    Thanks.

  • It seems to me you need to learn the C30 instruction set.  Then use that knowledge to rewrite, as normal C, all those macros which use C30 instructions in asm statements.  The good news is that C30 instructions are pretty straightforward.  Keep in mind you only need to understand the operation the instructions compute.  You don't need to learn the pipeline, interrupts, or any of that.  The bad news is that C30 is very old.  There is almost no collateral available for it.  The most important thing is the CPU User's Guide.  I have the impression you have found everything else which might be useful.

    Thanks and regards,

    -George