BasicMathsBenchmarksQ15.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #include "BasicMathsBenchmarksQ15.h"
  2. #include "Error.h"
  3. void BasicMathsBenchmarksQ15::vec_mult_q15()
  4. {
  5. arm_mult_q15(this->inp1,this->inp2,this->outp,this->nb);
  6. }
  7. void BasicMathsBenchmarksQ15::vec_add_q15()
  8. {
  9. arm_add_q15(this->inp1,this->inp2,this->outp,this->nb);
  10. }
  11. void BasicMathsBenchmarksQ15::vec_sub_q15()
  12. {
  13. arm_sub_q15(this->inp1,this->inp2,this->outp,this->nb);
  14. }
  15. void BasicMathsBenchmarksQ15::vec_abs_q15()
  16. {
  17. arm_abs_q15(this->inp1,this->outp,this->nb);
  18. }
  19. void BasicMathsBenchmarksQ15::vec_negate_q15()
  20. {
  21. arm_negate_q15(this->inp1,this->outp,this->nb);
  22. }
  23. void BasicMathsBenchmarksQ15::vec_offset_q15()
  24. {
  25. arm_offset_q15(this->inp1,1.0,this->outp,this->nb);
  26. }
  27. void BasicMathsBenchmarksQ15::vec_scale_q15()
  28. {
  29. arm_scale_q15(this->inp1,0x45,1,this->outp,this->nb);
  30. }
  31. void BasicMathsBenchmarksQ15::vec_dot_q15()
  32. {
  33. q63_t result;
  34. arm_dot_prod_q15(this->inp1,this->inp2,this->nb,&result);
  35. }
  36. void BasicMathsBenchmarksQ15::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(BasicMathsBenchmarksQ15::INPUT1_Q15_ID,mgr,this->nb);
  41. input2.reload(BasicMathsBenchmarksQ15::INPUT2_Q15_ID,mgr,this->nb);
  42. output.create(this->nb,BasicMathsBenchmarksQ15::OUT_SAMPLES_Q15_ID,mgr);
  43. switch(id) {
  44. case BasicMathsBenchmarksQ15::VEC_MULT_Q15_1:
  45. case BasicMathsBenchmarksQ15::VEC_ADD_Q15_2:
  46. case BasicMathsBenchmarksQ15::VEC_SUB_Q15_3:
  47. case BasicMathsBenchmarksQ15::VEC_ABS_Q15_4:
  48. case BasicMathsBenchmarksQ15::VEC_SCALE_Q15_7:
  49. case BasicMathsBenchmarksQ15::VEC_OFFSET_Q15_6:
  50. this->inp1=input1.ptr();
  51. this->inp2=input2.ptr();
  52. this->outp=output.ptr();
  53. break;
  54. case BasicMathsBenchmarksQ15::VEC_NEGATE_Q15_5:
  55. this->inp1=input1.ptr();
  56. this->outp=output.ptr();
  57. break;
  58. case BasicMathsBenchmarksQ15::VEC_DOT_Q15_8:
  59. this->inp1=input1.ptr();
  60. this->inp2=input2.ptr();
  61. break;
  62. }
  63. }
  64. void BasicMathsBenchmarksQ15::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  65. {
  66. }