This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

multiply all array element in cortex-m4

void scale1(uint32_t dst[], uint32_t src[], uint32_t size, uint32_t value){
   uin32_t i;
   for(i=0;i<size;i++){
      dst[i] = src[i]*value;
   }
}

void scale2(float32_t dst[], uint32_t src[], uint32_t size, float32_t value){
   uin32_t i;
   for(i=0;i<size;i++){
      dst[i] = src[i]*value;
   }
}

hello all, I'm learn cortex-m4 which has dsp instruction

may I ask like code above, when I need to multiply all array element,

is there a much faster way to handle this situation,

is the way can be suitable for multiplier is float type?

 

thanks all, for giving me any idea =)

  • Hi there !
    Cortex M4 can handle parallel multiply only wih accumulation (MAC) ... but it can only do this on 16-bit data. Therefore I doubt that you could do much better than this.
    Maybe you could unroll a bit and fetch 64-bits at one time, but still no DSP feature to be used.

    Sorry for this quite pessimistic reply ...