00001 /* ---------------------------------------------------------------------- 00002 * Copyright (C) 2010 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 15. July 2011 00005 * $Revision: V1.0.10 00006 * 00007 * Project: CMSIS DSP Library 00008 * Title: arm_cmplx_mult_real_f32.c 00009 * 00010 * Description: Floating-point complex by real multiplication 00011 * 00012 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 00013 * 00014 * Version 1.0.10 2011/7/15 00015 * Big Endian support added and Merged M0 and M3/M4 Source code. 00016 * 00017 * Version 1.0.3 2010/11/29 00018 * Re-organized the CMSIS folders and updated documentation. 00019 * 00020 * Version 1.0.2 2010/11/11 00021 * Documentation updated. 00022 * 00023 * Version 1.0.1 2010/10/05 00024 * Production release and review comments incorporated. 00025 * 00026 * Version 1.0.0 2010/09/20 00027 * Production release and review comments incorporated. 00028 * -------------------------------------------------------------------- */ 00029 00030 #include "arm_math.h" 00031 00074 void arm_cmplx_mult_real_f32( 00075 float32_t * pSrcCmplx, 00076 float32_t * pSrcReal, 00077 float32_t * pCmplxDst, 00078 uint32_t numSamples) 00079 { 00080 float32_t in; /* Temporary variable to store input value */ 00081 00082 #ifndef ARM_MATH_CM0 00083 00084 /* Run the below code for Cortex-M4 and Cortex-M3 */ 00085 uint32_t blkCnt; /* loop counters */ 00086 00087 /* loop Unrolling */ 00088 blkCnt = numSamples >> 2u; 00089 00090 /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 00091 ** a second loop below computes the remaining 1 to 3 samples. */ 00092 while(blkCnt > 0u) 00093 { 00094 /* C[2 * i] = A[2 * i] * B[i]. */ 00095 /* C[2 * i + 1] = A[2 * i + 1] * B[i]. */ 00096 in = *pSrcReal++; 00097 /* store the result in the destination buffer. */ 00098 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00099 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00100 00101 in = *pSrcReal++; 00102 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00103 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00104 00105 in = *pSrcReal++; 00106 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00107 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00108 00109 in = *pSrcReal++; 00110 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00111 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00112 00113 /* Decrement the numSamples loop counter */ 00114 blkCnt--; 00115 } 00116 00117 /* If the numSamples is not a multiple of 4, compute any remaining output samples here. 00118 ** No loop unrolling is used. */ 00119 blkCnt = numSamples % 0x4u; 00120 00121 while(blkCnt > 0u) 00122 { 00123 /* C[2 * i] = A[2 * i] * B[i]. */ 00124 /* C[2 * i + 1] = A[2 * i + 1] * B[i]. */ 00125 in = *pSrcReal++; 00126 /* store the result in the destination buffer. */ 00127 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00128 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00129 00130 /* Decrement the numSamples loop counter */ 00131 blkCnt--; 00132 } 00133 00134 #else 00135 00136 /* Run the below code for Cortex-M0 */ 00137 00138 while(numSamples > 0u) 00139 { 00140 /* realOut = realA * realB. */ 00141 /* imagOut = imagA * realB. */ 00142 in = *pSrcReal++; 00143 /* store the result in the destination buffer. */ 00144 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00145 *pCmplxDst++ = (*pSrcCmplx++) * (in); 00146 00147 /* Decrement the numSamples loop counter */ 00148 numSamples--; 00149 } 00150 00151 #endif /* #ifndef ARM_MATH_CM0 */ 00152 00153 } 00154