1 /* 2 * SPDX-FileCopyrightText: Copyright 2010-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the License); you may 7 * not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 /* ---------------------------------------------------------------------- 20 * Project: CMSIS NN Library 21 * Title: arm_nn_math_types.h 22 * Description: Compiler include and basic types 23 * 24 * $Date: 15 August 2023 25 * $Revision: V.1.3.3 26 * 27 * Target : Arm(R) M-Profile Architecture 28 * -------------------------------------------------------------------- */ 29 30 #ifndef ARM_NN_MATH_TYPES_H 31 32 #define ARM_NN_MATH_TYPES_H 33 34 #include <limits.h> 35 #include <stdint.h> 36 #include <string.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /** 43 * 44 * @brief Translate architecture feature flags to CMSIS-NN defines 45 * 46 */ 47 48 // CMSIS-NN uses the same macro names as CMSIS-DSP 49 #if (defined(__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) 50 #ifndef ARM_MATH_DSP 51 #define ARM_MATH_DSP 1 52 #endif 53 #endif 54 55 #if (defined(__ARM_FEATURE_MVE) && (__ARM_FEATURE_MVE & 1)) 56 #ifndef ARM_MATH_MVEI 57 #define ARM_MATH_MVEI 1 58 #endif 59 #endif 60 61 /** 62 * 63 * @brief Limits macros 64 * 65 */ 66 67 #define NN_Q31_MAX ((int32_t)(0x7FFFFFFFL)) 68 #define NN_Q15_MAX ((int16_t)(0x7FFF)) 69 #define NN_Q7_MAX ((int8_t)(0x7F)) 70 #define NN_Q31_MIN ((int32_t)(0x80000000L)) 71 #define NN_Q15_MIN ((int16_t)(0x8000)) 72 #define NN_Q7_MIN ((int8_t)(0x80)) 73 74 #ifdef __cplusplus 75 } 76 #endif 77 78 #endif /*ifndef ARM_NN_MATH_TYPES_H */ 79