riscv_math.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /******************************************************************************
  2. * @file riscv_math.h
  3. * @brief Public header file for NMSIS DSP Library
  4. * @version V1.10.0
  5. * @date 08 July 2021
  6. * Target Processor: RISC-V Cores
  7. ******************************************************************************/
  8. /*
  9. * Copyright (c) 2010-2021 Arm Limited or its affiliates. All rights reserved.
  10. * Copyright (c) 2019 Nuclei Limited. All rights reserved.
  11. *
  12. * SPDX-License-Identifier: Apache-2.0
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the License); you may
  15. * not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at
  17. *
  18. * www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  22. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. */
  26. /**
  27. \mainpage NMSIS DSP Software Library
  28. *
  29. * \section intro Introduction
  30. *
  31. * This user manual describes the NMSIS DSP software library,
  32. * a suite of common compute processing functions for use on RISC-V processor
  33. * based devices.
  34. *
  35. * The library is divided into a number of functions each covering a specific category:
  36. * - \ref groupMath "Basic math functions"
  37. * - \ref groupFastMath "Fast math functions"
  38. * - \ref groupCmplxMath "Complex math functions"
  39. * - \ref groupFilters "Filtering functions"
  40. * - \ref groupMatrix "Matrix functions"
  41. * - \ref groupTransforms "Transform functions"
  42. * - \ref groupController "Motor control functions"
  43. * - \ref groupStats "Statistical functions"
  44. * - \ref groupSupport "Support functions"
  45. * - \ref groupInterpolation "Interpolation functions"
  46. * - \ref groupSVM "Support Vector Machine functions (SVM)"
  47. * - \ref groupBayes "Bayes classifier functions"
  48. * - \ref groupDistance "Distance functions"
  49. * - \ref groupQuaternionMath "Quaternion functions"
  50. * - \ref groupWindow "Window functions"
  51. *
  52. * The library has generally separate functions for operating on 8-bit integers, 16-bit integers,
  53. * 32-bit integer and 32-bit floating-point values and 64-bit floating-point values.
  54. *
  55. * The library is providing vectorized versions of most algorithms for Helium
  56. * and of most f32 algorithms for Neon.
  57. *
  58. * When using a vectorized version, provide a little bit of padding after the end of
  59. * a buffer (3 words) because the vectorized code may read a little bit after the end
  60. * of a buffer. You don't have to modify your buffers but just ensure that the
  61. * end of buffer + padding is not outside of a memory region.
  62. *
  63. * NMSIS-DSP pack is containing an optional project : The NMSIS-DSP
  64. * Compute Graph. The documentation for this project is available
  65. * on the <a href="https://github.com/RISCV-software/NMSIS-DSP/blob/main/ComputeGraph/README.md">NMSIS-DSP github repository.</a>
  66. *
  67. * A Python wrapper is also available with a Python API as close as possible
  68. * to the C one. It can be used to start developing and testing an algorithm with NumPy and
  69. * SciPy before writing the C version. Is is available on <a href="https://pypi.org/project/nmsisdsp/">PyPI.org</a>.
  70. * It can be installed with : pip install nmsisdsp
  71. *
  72. *
  73. * \section using Using the Library
  74. *
  75. * The library is released in source form. It is strongly advised to compile the library using -Ofast to
  76. * have the best performances.
  77. *
  78. * \note Please refer to [NMSIS-DSP](../../../dsp/index.html)
  79. *
  80. * \section example Examples
  81. *
  82. * The library ships with a number of examples which demonstrate how to use the library functions.
  83. *
  84. * Toolchain Support
  85. * -----------------
  86. *
  87. * The library has been developed and tested with nuclei riscv gcc toolchain.
  88. *
  89. * Building the Library
  90. * --------------------
  91. *
  92. * In NMSIS repo, it contains a Makefile to rebuild libraries on nuclei riscv gcc toolchain in the <code>NMSIS/</code> folder.
  93. * * In *NMSIS* folder, you can run `make gen_dsp_lib` to build and install DSP library into **NMSIS/Library/DSP/GCC** folder.
  94. *
  95. * Preprocessor Macros
  96. * -------------------
  97. *
  98. * Each library project have different preprocessor macros controlled via CMakeLists.txt.
  99. *
  100. *
  101. */
  102. /**
  103. * @defgroup groupExamples Examples
  104. */
  105. #ifndef RISCV_MATH_H
  106. #define RISCV_MATH_H
  107. #include "riscv_math_types.h"
  108. #include "riscv_math_memory.h"
  109. #include "dsp/none.h"
  110. #include "dsp/utils.h"
  111. #include "dsp/basic_math_functions.h"
  112. #include "dsp/interpolation_functions.h"
  113. #include "dsp/bayes_functions.h"
  114. #include "dsp/matrix_functions.h"
  115. #include "dsp/complex_math_functions.h"
  116. #include "dsp/statistics_functions.h"
  117. #include "dsp/controller_functions.h"
  118. #include "dsp/support_functions.h"
  119. #include "dsp/distance_functions.h"
  120. #include "dsp/svm_functions.h"
  121. #include "dsp/fast_math_functions.h"
  122. #include "dsp/transform_functions.h"
  123. #include "dsp/filtering_functions.h"
  124. #include "dsp/quaternion_math_functions.h"
  125. #include "dsp/window_functions.h"
  126. #if defined (RISCV_FLOAT16_SUPPORTED)
  127. #include "riscv_math_f16.h"
  128. #endif /* defined (RISCV_FLOAT16_SUPPORTED) */
  129. #ifdef __cplusplus
  130. extern "C"
  131. {
  132. #endif
  133. //#define TABLE_SPACING_Q31 0x400000
  134. //#define TABLE_SPACING_Q15 0x80
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif /* _RISCV_MATH_H */
  139. /**
  140. *
  141. * End of file.
  142. */