Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "arm_math.h"
00026
00055 void arm_mult_q15(
00056 q15_t * pSrcA,
00057 q15_t * pSrcB,
00058 q15_t * pDst,
00059 uint32_t blockSize)
00060 {
00061 uint32_t blkCnt;
00062 q31_t inA1, inA2, inB1, inB2;
00063 q15_t out1, out2, out3, out4;
00064 q31_t mul1, mul2, mul3, mul4;
00065
00066
00067 blkCnt = blockSize >> 2u;
00068
00069
00070
00071 while(blkCnt > 0u)
00072 {
00073
00074 inA1 = *__SIMD32(pSrcA)++;
00075
00076 inB1 = *__SIMD32(pSrcB)++;
00077
00078 inA2 = *__SIMD32(pSrcA)++;
00079
00080 inB2 = *__SIMD32(pSrcB)++;
00081
00082
00083 mul1 = (q31_t)((q15_t)(inA1 >> 16)* (q15_t)(inB1>> 16));
00084 mul2 = (q31_t)((q15_t)inA1 * (q15_t)inB1);
00085 mul3 = (q31_t)((q15_t)(inA2 >> 16)* (q15_t)(inB2>> 16));
00086 mul4 = (q31_t)((q15_t)inA2 * (q15_t)inB2);
00087
00088
00089 mul1 = mul1 >> 15;
00090 mul2 = mul2 >> 15;
00091 mul3 = mul3 >> 15;
00092 mul4 = mul4 >> 15;
00093
00094
00095 #ifdef CCS
00096
00097 out1 = (q15_t) __SSATA(mul1, 0, 16);
00098 out2 = (q15_t) __SSATA(mul2, 0, 16);
00099 out3 = (q15_t) __SSATA(mul3, 0, 16);
00100 out4 = (q15_t) __SSATA(mul4, 0, 16);
00101
00102 #else
00103
00104 out1 = (q15_t) __SSAT(mul1, 16);
00105 out2 = (q15_t) __SSAT(mul2, 16);
00106 out3 = (q15_t) __SSAT(mul3, 16);
00107 out4 = (q15_t) __SSAT(mul4, 16);
00108
00109 #endif // #ifdef CCS
00110
00111
00112 #ifndef ARM_MATH_BIG_ENDIAN
00113
00114 *__SIMD32(pDst)++ = __PKHBT(out2, out1, 16);
00115 *__SIMD32(pDst)++ = __PKHBT(out4, out3, 16);
00116
00117 #else
00118
00119 *__SIMD32(pDst)++ = __PKHBT(out2, out1, 16);
00120 *__SIMD32(pDst)++ = __PKHBT(out4, out3, 16);
00121
00122 #endif // #ifndef ARM_MATH_BIG_ENDIAN
00123
00124
00125 blkCnt--;
00126 }
00127
00128
00129
00130 blkCnt = blockSize % 0x4u;
00131
00132 while(blkCnt > 0u)
00133 {
00134
00135
00136 #ifdef CCS
00137 *pDst++ = (q15_t) __SSATA((((q31_t) (*pSrcA++) * (*pSrcB++)) >> 15), 0, 16);
00138 #else
00139 *pDst++ = (q15_t) __SSAT((((q31_t) (*pSrcA++) * (*pSrcB++)) >> 15), 16);
00140 #endif // #ifdef CCS
00141
00142 blkCnt--;
00143 }
00144 }
00145