1 #include "BasicMathsBenchmarksQ31.h" 2 #include "Error.h" 3 4 vec_mult_q31()5 void BasicMathsBenchmarksQ31::vec_mult_q31() 6 { 7 arm_mult_q31(this->inp1,this->inp2,this->outp,this->nb); 8 } 9 vec_add_q31()10 void BasicMathsBenchmarksQ31::vec_add_q31() 11 { 12 arm_add_q31(this->inp1,this->inp2,this->outp,this->nb); 13 } 14 vec_sub_q31()15 void BasicMathsBenchmarksQ31::vec_sub_q31() 16 { 17 arm_sub_q31(this->inp1,this->inp2,this->outp,this->nb); 18 } 19 vec_abs_q31()20 void BasicMathsBenchmarksQ31::vec_abs_q31() 21 { 22 arm_abs_q31(this->inp1,this->outp,this->nb); 23 } 24 vec_negate_q31()25 void BasicMathsBenchmarksQ31::vec_negate_q31() 26 { 27 arm_negate_q31(this->inp1,this->outp,this->nb); 28 } 29 vec_offset_q31()30 void BasicMathsBenchmarksQ31::vec_offset_q31() 31 { 32 arm_offset_q31(this->inp1,1.0,this->outp,this->nb); 33 } 34 vec_scale_q31()35 void BasicMathsBenchmarksQ31::vec_scale_q31() 36 { 37 arm_scale_q31(this->inp1,0x45,1,this->outp,this->nb); 38 } 39 vec_dot_q31()40 void BasicMathsBenchmarksQ31::vec_dot_q31() 41 { 42 q63_t result; 43 44 arm_dot_prod_q31(this->inp1,this->inp2,this->nb,&result); 45 } 46 47 48 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)49 void BasicMathsBenchmarksQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 50 { 51 52 53 std::vector<Testing::param_t>::iterator it = params.begin(); 54 this->nb = *it; 55 56 input1.reload(BasicMathsBenchmarksQ31::INPUT1_Q31_ID,mgr,this->nb); 57 input2.reload(BasicMathsBenchmarksQ31::INPUT2_Q31_ID,mgr,this->nb); 58 59 60 output.create(this->nb,BasicMathsBenchmarksQ31::OUT_SAMPLES_Q31_ID,mgr); 61 62 switch(id) 63 { 64 case BasicMathsBenchmarksQ31::VEC_MULT_Q31_1: 65 case BasicMathsBenchmarksQ31::VEC_ADD_Q31_2: 66 case BasicMathsBenchmarksQ31::VEC_SUB_Q31_3: 67 case BasicMathsBenchmarksQ31::VEC_ABS_Q31_4: 68 case BasicMathsBenchmarksQ31::VEC_OFFSET_Q31_6: 69 case BasicMathsBenchmarksQ31::VEC_SCALE_Q31_7: 70 this->inp1=input1.ptr(); 71 this->inp2=input2.ptr(); 72 this->outp=output.ptr(); 73 break; 74 75 case BasicMathsBenchmarksQ31::VEC_NEGATE_Q31_5: 76 this->inp1=input1.ptr(); 77 this->outp=output.ptr(); 78 break; 79 80 case BasicMathsBenchmarksQ31::VEC_DOT_Q31_8: 81 this->inp1=input1.ptr(); 82 this->inp2=input2.ptr(); 83 break; 84 } 85 86 } 87 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)88 void BasicMathsBenchmarksQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 89 { 90 } 91