1 #include "FIRQ15.h"
2 #include "Error.h"
3 
4 #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
5 static __ALIGNED(8) q15_t coeffArray[64];
6 #endif
7 
test_fir_q15()8     void FIRQ15::test_fir_q15()
9     {
10        arm_fir_q15(&instFir, this->pSrc, this->pDst, this->nbSamples);
11     }
12 
test_lms_q15()13     void FIRQ15::test_lms_q15()
14     {
15       arm_lms_q15(&instLms, this->pSrc, (q15_t*)this->pRef, this->pDst, this->pErr,this->nbSamples);
16     }
17 
test_lms_norm_q15()18     void FIRQ15::test_lms_norm_q15()
19     {
20       arm_lms_norm_q15(&instLmsNorm, this->pSrc, (q15_t*)this->pRef, this->pDst, this->pErr,this->nbSamples);
21     }
22 
23 
setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)24     void FIRQ15::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
25     {
26 
27 
28        std::vector<Testing::param_t>::iterator it = params.begin();
29        this->nbTaps = *it++;
30        this->nbSamples = *it;
31 
32        samples.reload(FIRQ15::SAMPLES1_Q15_ID,mgr,this->nbSamples);
33        coefs.reload(FIRQ15::COEFS1_Q15_ID,mgr,this->nbTaps);
34 
35        state.create(this->nbSamples + this->nbTaps - 1,FIRQ15::STATE_Q15_ID,mgr);
36        output.create(this->nbSamples,FIRQ15::OUT_SAMPLES_Q15_ID,mgr);
37 
38        switch(id)
39        {
40            case TEST_FIR_Q15_1:
41 #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE)
42               /* Copy coefficients and pad to zero
43               */
44               memset(coeffArray,0,32*sizeof(q15_t));
45               q15_t *ptr;
46 
47               ptr=coefs.ptr();
48               memcpy(coeffArray,ptr,this->nbTaps*sizeof(q15_t));
49               this->pCoefs = coeffArray;
50 #else
51               this->pCoefs=coefs.ptr();
52 #endif
53               arm_fir_init_q15(&instFir,this->nbTaps,coefs.ptr(),state.ptr(),this->nbSamples);
54 
55               this->pSrc=samples.ptr();
56               this->pDst=output.ptr();
57            break;
58 
59            case TEST_LMS_Q15_2:
60               refs.reload(FIRQ15::REFS1_Q15_ID,mgr,this->nbSamples);
61               error.create(this->nbSamples,FIRQ15::ERR_Q15_ID,mgr);
62               arm_lms_init_q15(&instLms,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1);
63 
64               this->pSrc=samples.ptr();
65               this->pRef=refs.ptr();
66 
67               this->pDst=output.ptr();
68               this->pErr=error.ptr();
69            break;
70 
71            case TEST_LMS_NORM_Q15_3:
72               refs.reload(FIRQ15::REFS1_Q15_ID,mgr,this->nbSamples);
73               error.create(this->nbSamples,FIRQ15::ERR_Q15_ID,mgr);
74               arm_lms_norm_init_q15(&instLmsNorm,this->nbTaps,coefs.ptr(),state.ptr(),100,this->nbSamples,1);
75 
76               this->pSrc=samples.ptr();
77               this->pRef=refs.ptr();
78 
79               this->pDst=output.ptr();
80               this->pErr=error.ptr();
81            break;
82        }
83 
84     }
85 
tearDown(Testing::testID_t id,Client::PatternMgr * mgr)86     void FIRQ15::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
87     {
88     }
89