Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: ARM math question

  1. #1

    ARM math question

    Hey guys.
    I just wondering if possible is moving this function to arm math and floating operations. I’m totally new with arm math and not sure.


    Code:
    // Multi ++++++++++++++++++++
    inline uint32_t M32x16(uint32_t x, uint32_t y) {
      return (uint32_t)(((uint32_t)x) * ((uint32_t)y) >> 16);
    }
    
      resultA = M32x16(outputA, (distance << 7));
      resultB = M32x16(outputB, (((SIZE >> 1) - distance) << 7));
    
    for( int pointer = 0; pointer < 128; pointer++){
      bufferOut[pointer] = resultA += resultB;
     }

  2. #2
    Senior Member
    Join Date
    Oct 2016
    Posts
    1,048
    I don't understand your question, and I'm not sure what your function M32x16 is supposed to do, but it doesn't look right. Can you please ask your question again and provide more detail, and please show a complete test program?

  3. #3
    Quote Originally Posted by joepasquariello View Post
    I don't understand your question, and I'm not sure what your function M32x16 is supposed to do, but it doesn't look right. Can you please ask your question again and provide more detail, and please show a complete test program?
    I just want do some calculations in floating point and looking how to do using CMSIS DSP
    Above code is just a part full version of my pseudo realtime code which is here
    https://forum.pjrc.com/threads/72019...ghlight=Diodac

  4. #4
    Quote Originally Posted by joepasquariello View Post
    I don't understand your question, and I'm not sure what your function M32x16 is supposed to do, but it doesn't look right. Can you please ask your question again and provide more detail, and please show a complete test program?
    I working on new DSP code now, I got to work queue record and convert audio from int16 to float32 and from float32 to int16 for play queue using arm math function.
    Now I need find proper equivalent functions for replacement my old M32x16.

  5. #5
    Senior Member
    Join Date
    Sep 2021
    Posts
    186
    There are no DSP instructions for float.
    It's integer only.
    So, for a float multiplication just use "*" (which is pretty fast) :-)

  6. #6
    The M32x16() function looks like a fixed point operation. Sort of. Works with any C compiler but is of course faster on targets with hardware multiply. Like some ARM chips. Floating point and integer multiply on the Teensy 3.6 are equally fast.

    Although for fixed point what I usually look for is something that returns the full size of the multiply. Which would be 64 bits for a 32X32 multiply. Alas, C can't do that so you have to resort to assembly.

  7. #7
    Quote Originally Posted by UhClem View Post
    The M32x16() function looks like a fixed point operation. Sort of. Works with any C compiler but is of course faster on targets with hardware multiply. Like some ARM chips. Floating point and integer multiply on the Teensy 3.6 are equally fast.

    Although for fixed point what I usually look for is something that returns the full size of the multiply. Which would be 64 bits for a 32X32 multiply. Alas, C can't do that so you have to resort to assembly.
    I rewrote my code and I was able get it to work with ARM hardware multiply using mult32x64 and mixing outputA and outputB by clip_q31_to_q15.
    It working nice better than I expected.
    I writing now code for floating point operation and see how it works.
    I will share my code when I finish it.
    Thank you for input.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •