Isabella Gottardi | 118f73e | 2021-09-16 17:54:35 +0100 | [diff] [blame] | 1 | /* |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame^] | 2 | * Copyright (c) 2022 Arm Limited. All rights reserved. |
Isabella Gottardi | 118f73e | 2021-09-16 17:54:35 +0100 | [diff] [blame] | 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame^] | 17 | |
Isabella Gottardi | 118f73e | 2021-09-16 17:54:35 +0100 | [diff] [blame] | 18 | #ifndef ETHOS_U_NPU_MEM_CONFIG_H |
| 19 | #define ETHOS_U_NPU_MEM_CONFIG_H |
| 20 | |
| 21 | #define ETHOS_U_NPU_MEMORY_MODE_SRAM_ONLY 0 |
| 22 | #define ETHOS_U_NPU_MEMORY_MODE_SHARED_SRAM 1 |
| 23 | #define ETHOS_U_NPU_MEMORY_MODE_DEDICATED_SRAM 2 |
| 24 | |
| 25 | #define ETHOS_U_MEM_BYTE_ALIGNMENT 16 |
| 26 | |
| 27 | #ifndef ETHOS_U_NPU_MEMORY_MODE |
| 28 | #define ETHOS_U_NPU_MEMORY_MODE ETHOS_U_MEMORY_MODE_SHARED_SRAM |
| 29 | #endif /* ETHOS_U_NPU_MEMORY_MODE */ |
| 30 | |
| 31 | #if (ETHOS_U_NPU_MEMORY_MODE==ETHOS_U_NPU_MEMORY_MODE_DEDICATED_SRAM) |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame^] | 32 | #ifndef ETHOS_U_NPU_CACHE_SIZE |
| 33 | #define ETHOS_U_CACHE_BUF_SZ (393216U) /* See vela doc for reference */ |
| 34 | #else |
| 35 | #define ETHOS_U_CACHE_BUF_SZ ETHOS_U_NPU_CACHE_SIZE |
| 36 | #endif /* ETHOS_U_NPU_CACHE_SIZE */ |
Isabella Gottardi | 118f73e | 2021-09-16 17:54:35 +0100 | [diff] [blame] | 37 | #else |
| 38 | #define ETHOS_U_CACHE_BUF_SZ (0U) |
| 39 | #endif /* CACHE_BUF_SZ */ |
| 40 | |
| 41 | /** |
| 42 | * Activation buffer aka tensor arena section name |
| 43 | * We have to place the tensor arena in different region based on the memory config. |
| 44 | **/ |
| 45 | #if (ETHOS_U_NPU_MEMORY_MODE==ETHOS_U_NPU_MEMORY_MODE_SHARED_SRAM) |
| 46 | #define ACTIVATION_BUF_SECTION section(".bss.NoInit.activation_buf_sram") |
| 47 | #define ACTIVATION_BUF_SECTION_NAME ("SRAM") |
| 48 | #elif (ETHOS_U_NPU_MEMORY_MODE==ETHOS_U_NPU_MEMORY_MODE_SRAM_ONLY) |
| 49 | #define ACTIVATION_BUF_SECTION section(".bss.NoInit.activation_buf_sram") |
| 50 | #define ACTIVATION_BUF_SECTION_NAME ("SRAM") |
| 51 | #elif (ETHOS_U_NPU_MEMORY_MODE==ETHOS_U_NPU_MEMORY_MODE_DEDICATED_SRAM) |
| 52 | #define ACTIVATION_BUF_SECTION section("activation_buf_dram") |
| 53 | #define CACHE_BUF_SECTION section(".bss.NoInit.ethos_u_cache") |
| 54 | #define ACTIVATION_BUF_SECTION_NAME ("DDR/DRAM") |
| 55 | #define CACHE_BUF_ATTRIBUTE __attribute__((aligned(ETHOS_U_MEM_BYTE_ALIGNMENT), CACHE_BUF_SECTION)) |
| 56 | #endif |
| 57 | |
Isabella Gottardi | ee4920b | 2022-02-25 14:29:32 +0000 | [diff] [blame^] | 58 | #endif /* ETHOS_U_NPU_MEM_CONFIG_H */ |