BasicMathsBenchmarksQ7.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #include "BasicMathsBenchmarksQ7.h"
  2. #include "Error.h"
  3. void BasicMathsBenchmarksQ7::vec_mult_q7()
  4. {
  5. arm_mult_q7(this->inp1,this->inp2,this->outp,this->nb);
  6. }
  7. void BasicMathsBenchmarksQ7::vec_add_q7()
  8. {
  9. arm_add_q7(this->inp1,this->inp2,this->outp,this->nb);
  10. }
  11. void BasicMathsBenchmarksQ7::vec_sub_q7()
  12. {
  13. arm_sub_q7(this->inp1,this->inp2,this->outp,this->nb);
  14. }
  15. void BasicMathsBenchmarksQ7::vec_abs_q7()
  16. {
  17. arm_abs_q7(this->inp1,this->outp,this->nb);
  18. }
  19. void BasicMathsBenchmarksQ7::vec_negate_q7()
  20. {
  21. arm_negate_q7(this->inp1,this->outp,this->nb);
  22. }
  23. void BasicMathsBenchmarksQ7::vec_offset_q7()
  24. {
  25. arm_offset_q7(this->inp1,1.0,this->outp,this->nb);
  26. }
  27. void BasicMathsBenchmarksQ7::vec_scale_q7()
  28. {
  29. arm_scale_q7(this->inp1,0x45,1,this->outp,this->nb);
  30. }
  31. void BasicMathsBenchmarksQ7::vec_dot_q7()
  32. {
  33. q31_t result;
  34. arm_dot_prod_q7(this->inp1,this->inp2,this->nb,&result);
  35. }
  36. void BasicMathsBenchmarksQ7::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(BasicMathsBenchmarksQ7::INPUT1_Q7_ID,mgr,this->nb);
  41. input2.reload(BasicMathsBenchmarksQ7::INPUT2_Q7_ID,mgr,this->nb);
  42. output.create(this->nb,BasicMathsBenchmarksQ7::OUT_SAMPLES_Q7_ID,mgr);
  43. switch(id)
  44. {
  45. case BasicMathsBenchmarksQ7::VEC_MULT_Q7_1:
  46. case BasicMathsBenchmarksQ7::VEC_ADD_Q7_2:
  47. case BasicMathsBenchmarksQ7::VEC_SUB_Q7_3:
  48. case BasicMathsBenchmarksQ7::VEC_ABS_Q7_4:
  49. case BasicMathsBenchmarksQ7::VEC_OFFSET_Q7_6:
  50. case BasicMathsBenchmarksQ7::VEC_SCALE_Q7_7:
  51. this->inp1=input1.ptr();
  52. this->inp2=input2.ptr();
  53. this->outp=output.ptr();
  54. break;
  55. case BasicMathsBenchmarksQ7::VEC_NEGATE_Q7_5:
  56. this->inp1=input1.ptr();
  57. this->outp=output.ptr();
  58. break;
  59. case BasicMathsBenchmarksQ7::VEC_DOT_Q7_8:
  60. this->inp1=input1.ptr();
  61. this->inp2=input2.ptr();
  62. break;
  63. }
  64. }
  65. void BasicMathsBenchmarksQ7::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  66. {
  67. }