Thursday, November 20, 2008

    What are PIC32 synthesized/macro instructions?

    The MPLAB Assembler for PIC32 MCUs also supports a number of synthesized/macro instructions intended to make writing assembly code easier. The LI (load immediate) instruction is an example of a synthetic macro instruction. The assembler generates two machine instructions to load a 32-bit constant value into a register from this single synthetic instruction.
    The assembler synthesizes instructions for
    • A 32-bit Load Immediate
    • A load from a memory location
    • A GP-relative load or store
    • An extended branch conditional
    • A two-operand form of some three-operand instructions
    • An unaligned load/store instruction
    Assembly directives, such as .set noat, .set nomacro, and .set noreorder, disable these normally helpful features for cases where you require full control over the generated code. See this previous post.

    No comments: