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.

FPU instruction

Part Number: TMS320F28377S


Tool/software: Code Composer Studio

FPU instruction MOV32 operand "mem32" explicitly use direct or indirect addressing mode  in the document SPRUHS1A. Can't I use stack addressing mode(SP)?

In the routine shown in document SPRUHS1A, the direct addressing mode does not use the instruction MOVW DP, #_x. Does the FPU  need not set the value of DP at any time and can access the variable x directly through "MOV32 R0H, @_x"?

  • I've assigned your post to a C2000 expert, but due to the US holiday we will get back to no later than July 8th, by end of day US Central Time.

    Best regards,
    Matthew

  • You can use stack addressing modes with MOV32. Typically that's how you would perform context save/restore of the FPU regsters. For example:
    MOV32 *SP++, R5H
    ...
    MOV32 R5H, *--SP

    If you want to use direct addressing with any of the registers (FPU or otherwise) you need to ensure the data page pointer is correct first. In direct addressing only the lowest 6 bits of the varriable are encoded in the opcode, the rest being taken from the DP pointer, so if DP is incorrect the wrong address will be accessed.

    The code snippets in the user guides illustrate examples of various points but are not necessarily complete. It is possible (for example in example 1-7 on p.21) that the code to configure DP is not shown.

    BTW, there is a later version of the extenses instruction set user's guide available here:
    http://www.ti.com/lit/ug/spruhs1b/spruhs1b.pdf

    I hope this helps.

    Regards,

    Richard