1 #include "FIRF32.h"
2 #include "Error.h"
3 
4 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
5 static __ALIGNED(8) float32_t coeffArray[64];
6 #endif
7 
test_fir_f32()8     void FIRF32::test_fir_f32()
9     {
10        arm_fir_f32(&instFir, this->pSrc, this->pDst, this->nbSamples);
11     }
12 
test_lms_f32()13     void FIRF32::test_lms_f32()
14     {
15       arm_lms_f32(&instLms, this->pSrc, (float32_t*)this->pRef, this->pDst, this->pErr,this->nbSamples);
16     }
17 
test_lms_norm_f32()18     void FIRF32::test_lms_norm_f32()
19     {
20        arm_lms_norm_f32(&instLmsNorm, this->pSrc, (float32_t*)this->pRef, this->pDst, this->pErr,this->nbSamples);
21     }
22 
23 
24 
setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)25     void FIRF32::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(FIRF32::SAMPLES1_F32_ID,mgr,this->nbSamples);
34        coefs.reload(FIRF32::COEFS1_F32_ID,mgr,this->nbTaps);
35 
36        state.create(this->nbSamples + this->nbSamples + this->nbTaps - 1,FIRF32::STATE_F32_ID,mgr);
37        output.create(this->nbSamples,FIRF32::OUT_SAMPLES_F32_ID,mgr);
38 
39        switch(id)
40        {
41            case TEST_FIR_F32_1:
42 
43 #if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)
44               /* Copy coefficients and pad to zero
45               */
46               memset(coeffArray,0,32*sizeof(float32_t));
47               float32_t *ptr;
48 
49               ptr=coefs.ptr();
50               memcpy(coeffArray,ptr,this->nbTaps*sizeof(float32_t));
51               this->pCoefs = coeffArray;
52 #else
53               this->pCoefs=coefs.ptr();
54 #endif
55 
56               this->pSrc=samples.ptr();
57 
58               this->pDst=output.ptr();
59 
60               arm_fir_init_f32(&instFir,this->nbTaps,this->pCoefs,state.ptr(),this->nbSamples);
61            break;
62 
63            case TEST_LMS_F32_2:
64               refs.reload(FIRF32::REFS1_F32_ID,mgr,this->nbSamples);
65               error.create(this->nbSamples,FIRF32::ERR_F32_ID,mgr);
66               arm_lms_init_f32(&instLms,this->nbTaps,coefs.ptr(),state.ptr(),0.1,this->nbSamples);
67 
68               this->pSrc=samples.ptr();
69               this->pRef=refs.ptr();
70 
71               this->pDst=output.ptr();
72               this->pErr=error.ptr();
73            break;
74 
75            case TEST_LMS_NORM_F32_3:
76               refs.reload(FIRF32::REFS1_F32_ID,mgr,this->nbSamples);
77               error.create(this->nbSamples,FIRF32::ERR_F32_ID,mgr);
78               arm_lms_norm_init_f32(&instLmsNorm,this->nbTaps,coefs.ptr(),state.ptr(),0.1,this->nbSamples);
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 FIRF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
91     {
92     }
93