debug_test_external.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include "allocator.h"
  2. #include <dsppp/fixed_point.hpp>
  3. #include <dsppp/matrix.hpp>
  4. #include <cmsis_tests.h>
  5. #include <iostream>
  6. #if defined(ARM_MATH_MVEI) || defined(ARM_MATH_MVEF)
  7. Q15 external_debug(const PVector<Q15,16> &a0,
  8. const PVector<Q15,16> &a1,
  9. const PVector<Q15,16> &a2,
  10. const PVector<Q15,16> &a3,
  11. const PVector<Q15,16> &b,
  12. int l)
  13. {
  14. int nb = l;
  15. Q<33,30> acc0;
  16. Q<33,30> acc1;
  17. Q<33,30> acc2;
  18. Q<33,30> acc3;
  19. for(index_t i=0; i<nb; i+=8)
  20. {
  21. acc0 = inner::vmacc(acc0,a0.vector_op_tail(i,nb-i),b.vector_op_tail(i,nb-i),inner::vctpq<Q15>::mk(nb-i));
  22. acc1 = inner::vmacc(acc1,a1.vector_op_tail(i,nb-i),b.vector_op_tail(i,nb-i),inner::vctpq<Q15>::mk(nb-i));
  23. acc2 = inner::vmacc(acc2,a2.vector_op_tail(i,nb-i),b.vector_op_tail(i,nb-i),inner::vctpq<Q15>::mk(nb-i));
  24. acc3 = inner::vmacc(acc3,a3.vector_op_tail(i,nb-i),b.vector_op_tail(i,nb-i),inner::vctpq<Q15>::mk(nb-i));
  25. }
  26. Q15 r0,r1,r2,r3;
  27. r0 = inner::from_accumulator(acc0);
  28. r1 = inner::from_accumulator(acc1);
  29. r2 = inner::from_accumulator(acc2);
  30. r3 = inner::from_accumulator(acc3);
  31. return(r0+r1+r2+r3);
  32. }
  33. #else
  34. Q15 external_debug(const PVector<Q15,16> &a0,
  35. const PVector<Q15,16> &a1,
  36. const PVector<Q15,16> &a2,
  37. const PVector<Q15,16> &a3,
  38. const PVector<Q15,16> &b,
  39. int l)
  40. {
  41. (void)a0;
  42. (void)a1;
  43. (void)a2;
  44. (void)a3;
  45. (void)b;
  46. (void)l;
  47. return(a0[0]);
  48. }
  49. #endif