BasicMathsBenchmarksQ31.cpp 2.4 KB

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