1 #include "FIRQ31.h" 2 #include "Error.h" 3 4 #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE) 5 static __ALIGNED(8) q31_t coeffArray[64]; 6 #endif 7 test_fir_q31()8 void FIRQ31::test_fir_q31() 9 { 10 arm_fir_q31(&instFir, pSrc, pDst, this->nbSamples); 11 } 12 test_lms_q31()13 void FIRQ31::test_lms_q31() 14 { 15 arm_lms_q31(&instLms, pSrc, (q31_t*)pRef, pDst, pErr,this->nbSamples); 16 } 17 test_lms_norm_q31()18 void FIRQ31::test_lms_norm_q31() 19 { 20 arm_lms_norm_q31(&instLmsNorm, pSrc, (q31_t*)pRef, pDst, pErr,this->nbSamples); 21 } 22 23 24 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)25 void FIRQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 26 { 27 28 29 std::vector<Testing::param_t>::iterator it = params.begin(); 30 this->nbTaps = *it++; 31 this->nbSamples = *it; 32 33 samples.reload(FIRQ31::SAMPLES1_Q31_ID,mgr,this->nbSamples); 34 coefs.reload(FIRQ31::COEFS1_Q31_ID,mgr,this->nbTaps); 35 36 state.create(2*ROUND_UP(this->nbSamples,4) + this->nbSamples + this->nbTaps - 1,FIRQ31::STATE_Q31_ID,mgr); 37 output.create(this->nbSamples,FIRQ31::OUT_SAMPLES_Q31_ID,mgr); 38 39 switch(id) 40 { 41 case TEST_FIR_Q31_1: 42 #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE) 43 /* Copy coefficients and pad to zero 44 */ 45 memset(coeffArray,0,32*sizeof(q31_t)); 46 q31_t *ptr; 47 48 ptr=coefs.ptr(); 49 memcpy(coeffArray,ptr,this->nbTaps*sizeof(q31_t)); 50 this->pCoefs = coeffArray; 51 #else 52 this->pCoefs=coefs.ptr(); 53 #endif 54 55 arm_fir_init_q31(&instFir,this->nbTaps,coefs.ptr(),state.ptr(),this->nbSamples); 56 57 this->pSrc=samples.ptr(); 58 this->pDst=output.ptr(); 59 break; 60 61 case TEST_LMS_Q31_2: 62 refs.reload(FIRQ31::REFS1_Q31_ID,mgr,this->nbSamples); 63 error.create(this->nbSamples,FIRQ31::ERR_Q31_ID,mgr); 64 // Value of mu and postShift are arbitrary just for benchmark 65 arm_lms_init_q31(&instLms,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1); 66 67 this->pSrc=samples.ptr(); 68 this->pRef=refs.ptr(); 69 70 this->pDst=output.ptr(); 71 this->pErr=error.ptr(); 72 break; 73 74 case TEST_LMS_NORM_Q31_3: 75 refs.reload(FIRQ31::REFS1_Q31_ID,mgr,this->nbSamples); 76 error.create(this->nbSamples,FIRQ31::ERR_Q31_ID,mgr); 77 // Value of mu and postShift are arbitrary just for benchmark 78 arm_lms_norm_init_q31(&instLmsNorm,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1); 79 80 this->pSrc=samples.ptr(); 81 this->pRef=refs.ptr(); 82 83 this->pDst=output.ptr(); 84 this->pErr=error.ptr(); 85 break; 86 } 87 88 } 89 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)90 void FIRQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 91 { 92 } 93