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.

MSP432E401Y: Multiply and Accumulate Assembly

Part Number: MSP432E401Y

Hi,

I need help converting this example to something that will work with the MSP432E4 SDK and CCS 12.4.0.

#define MULADDC_INIT                            \
    asm(

#define MULADDC_CORE                            \
            "ldr    r0, [%0], #4        \n\t"   \
            "ldr    r1, [%1]            \n\t"   \
            "umaal  r1, %2, %3, r0      \n\t"   \
            "str    r1, [%1], #4        \n\t"

#define MULADDC_STOP                            \
         : "=r" (s),  "=r" (d), "=r" (c)        \
         : "r" (b), "0" (s), "1" (d), "2" (c)   \
         : "r0", "r1", "memory"                 \
         );

Thanks,

-Mike

  • Hi Mike,

      These are assembly instructions supported by M4 core if you are referring to umaal (Unsigned Long Multiply, with Optional Accumulate, 32-bit operands, producing a 64-bit result.)

    .  What is wrong with these code?  I'm not clear what you mean to convert them for CCS. Are you having a compilation error? if yes, which line?  In what context are you using these code (e.g. inline assembly in a C file or in an assembly file). I will move your post to our compiler experts if you are having compiler/linker issue.

      I have no idea what your lines 11-13 are doing. They don't look like assembly code to me but I have to be honest that I'm not an Arm assembly language expert. 

      If you want to insert inline assembly to your C code, please refer to to section 5.10 and 6.6.5 in the TI Arm compiler user's guide. https://www.ti.com/lit/pdf/spnu151. But you need to be extremely careful not to disrupt the C/C++ environment with asm statements. The compiler does not check the inserted instructions. It can easily cause unpredictable results in variables manipulated in or around the inserted code. I will suggest you put your assembly in a separate asm file. I don't know what these assembly code are for. I hope the user's guide should help you do what you want with the assembly. 

      Here is the TI Arm assembler user's guide. https://www.ti.com/lit/pdf/spnu151

  • Hi Charles,

    I picked the code out of C:\ti\simplelink_msp432e4_sdk_4_20_00_12\source\third_party\mbedtls\include\mbedtls\bn_mul.h at this check below.

    #elif (__ARM_ARCH >= 6) && \
    defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)

    I would like to add a section for the MSP432.

    Regards,

    -Mike

  • The compile error is:

    "../../../../library/bignum.c", line 1456: error #18: expected a ")"

  • Hi Mike,

      Thanks for the clarification. I'm not familiar with this 3rd party mbedtls code especially at the assembly level. Can you please create a small (as small as possible) CCS project that you can still reproduce the compiler error and I will move it to our compiler experts for assistance. 

      I think __ARM_ARCH and __ARM_FEATURE_DSP are predefined MACROs supported by TI Arm compiler. Cortex-M4 should be version 7 so I think from the macros perspective these macros are valid to fall through. 

      Have you tried different optimization levels and they all produce the same compilation error?

  • Hi Mike,

     I can reproduce the error using the code in the link. I will forward the post to our compiler expert. 

  • It appears the TI proprietary Arm compiler is being used.  Unfortunately, this compiler does not support GCC-style asm statements like the one shown in the first post.  It may be possible to re-implement it in terms of the intrinsic _umaal.  Please search for it in the TI ARM compiler manual.

    Thanks and regards,

    -George

  • Hi George,

    The compile error start after #define MULADDC_STOP.  I'm not familiar with assembly for either compiler.  Can you please port those lines of code for us?  We would greatly appreciate it.

    Regards,

    -Mike

  • That requires knowledge of how these macros are used, and the details of how the GCC-style asm statement works.  Unfortunately, I lack that knowledge.

    Thanks and regards,

    -George