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.

MVK with a function call ?

Hi,.

I am confused with the following assembly instruction:

I have a code which uses MVK assembly language instruction for C6414/16 processors. This is a working code.

Question: How does the following MVK work? How can a function be called? It doesn't make sense to me!

In the code, MVK is used as follows:

File 1: B.asm

.def my_function

my_function:

.word 0x4100 + (8*3)

.word 0x4080 + (8*0)
.word 0x4180 + (8*2)

File 2:  A.asm

.ref  my_function

.reg my_register_pointer

MVK my_function-4, my_register_pointer

  • Bugra,

    As I explained in your other assembly-related thread, this forum is not the place to learn C6000 assembly syntax. It is very difficult to learn, and it is not practical for us to duplicate the CPU & Instruction Set Reference Guide in pieces within these forum threads.

    The way to learn C6000 assembly is to

    1. Read all the way through the CPU & Instruction Set Reference Guide for your device's architecture, the C64x+.
    2. Write a simple program in C that, for example, calls a small function.
    3. Set the CCS compiler to include the -k or keep assembly switch.
    4. Compiler the code and review the assembly code.
    5. If it helps, single-step through the assembly code using CCS and an emulator with your EVM or your own target board, and watch all the Core Registers in the Registers view.

    Refer back to the CPU & Inst Set RG for each instruction to understand the various argument syntax and how it fits with what you observed.

    What you show above is not working code. It is incomplete snippets of code and gives no indication of what the code should be doing.

    In what you have shown above, 'my_function' in B.asm is not a valid assembly function. There should never be .word directives where program code should be located. Additionally, the MVK instruction does not any valid for calling a function at 'my_function' even if that function were valid.

    Please study the Reference Guide and some assembly output from the compiler. And please understand that writing and using C code is much better and easier for you to make your program work.

    What is you ultimate goal here? Are you trying to fix an existing product by making changes to assembly code? Are you trying to learn assembly so you can write highly optimized algorithms for the C6416?

    There is a training class archived on TI.com. You can search for "DSP Optimization" (no quotes) to search for articles and workshops that might be tailored for your needs.

    Regards,
    RandyP
  • Hi Randy,

    This is a reverse engineering work. The existing code is written in assembly. The code is working successfully in a product. The objective is to understand what the author is trying to achieve with the code.
  • Bugra,

    You have my recommendations on how to learn C6000 assembly, and to not try to learn it. Your best chance at success, in my opinion, would be to find someone from the TI Design Network to hire with expertise in C6000 assembly. I am not sure anyone would guarantee they can succeed in reverse assembling an entire application into a high-level description of that application, but it will require C6000 expertise.

    There is also the ethics question of whether this is a permitted thing to do. Many products come with EULAs that specifically deny you the right to reverse engineer any part of the product. Since you do not have documentation for this, it is an easy assumption to make that the product is not one of your company's products, although I can easily be wrong. But the ethics issue would have to be considered by us at TI and by anyone you hire to help.

    In the future, I will try to stay off your threads so someone else who might be available to teach you assembly would have a chance to start the discussion with you.

    From your preview posts above, B.asm and A.asm are not valid assembly files, so I do not expect there are source files that you have started from. It seems more likely that you are reverse assembling from the emulator and making arbitrary breaks in the code to call a file. You will have a difficult task ahead of you, and I am not sure this is the role of this device forum. Others may disagree and join to help you on your next question or here.

    Regards,
    RandyP