aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristofer Jonsson <kristofer.jonsson@arm.com>2022-05-12 11:35:33 +0200
committerKristofer Jonsson <kristofer.jonsson@arm.com>2022-05-13 12:49:05 +0200
commit1c0e7ae4bbf8ee81411b4c2e02c70ca892d17390 (patch)
tree49530e22edaff9916e31a22c3409fe6135b9b3be
parent301399d9e0b619fb2e229c9a9223aaf31ec6bcfa (diff)
downloadethos-u-core-driver-1c0e7ae4bbf8ee81411b4c2e02c70ca892d17390.tar.gz
Set default configuration22.05-rc322.05-rc2
Base address 1 points at the TFLM arena and is by default routed over AXI 0. For the spilling use case with both model and arena in DRAM it would make more sense to route base addresses 0 and 1 over AXI 1. For Ethos-U65 the default settings should correspond to the spilling use case. The AXI limits should have different max values depending on the NPU architecture. Change-Id: Icd317097e2cfdbfb39886e13c2cb2202651e5357
-rw-r--r--src/ethosu_config_u55.h (renamed from src/ethosu_config.h)15
-rw-r--r--src/ethosu_config_u65.h132
-rw-r--r--src/ethosu_device_u55_u65.c7
-rw-r--r--src/ethosu_driver.c7
4 files changed, 158 insertions, 3 deletions
diff --git a/src/ethosu_config.h b/src/ethosu_config_u55.h
index 7a9fae2..afb75bc 100644
--- a/src/ethosu_config.h
+++ b/src/ethosu_config_u55.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020,2022 Arm Limited.
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -60,12 +60,15 @@
#ifndef AXI_LIMIT0_MAX_BEATS_BYTES
#define AXI_LIMIT0_MAX_BEATS_BYTES 0x0
#endif
+
#ifndef AXI_LIMIT0_MEM_TYPE
#define AXI_LIMIT0_MEM_TYPE 0x0
#endif
+
#ifndef AXI_LIMIT0_MAX_OUTSTANDING_READS
#define AXI_LIMIT0_MAX_OUTSTANDING_READS 32
#endif
+
#ifndef AXI_LIMIT0_MAX_OUTSTANDING_WRITES
#define AXI_LIMIT0_MAX_OUTSTANDING_WRITES 16
#endif
@@ -73,12 +76,15 @@
#ifndef AXI_LIMIT1_MAX_BEATS_BYTES
#define AXI_LIMIT1_MAX_BEATS_BYTES 0x0
#endif
+
#ifndef AXI_LIMIT1_MEM_TYPE
#define AXI_LIMIT1_MEM_TYPE 0x0
#endif
+
#ifndef AXI_LIMIT1_MAX_OUTSTANDING_READS
#define AXI_LIMIT1_MAX_OUTSTANDING_READS 32
#endif
+
#ifndef AXI_LIMIT1_MAX_OUTSTANDING_WRITES
#define AXI_LIMIT1_MAX_OUTSTANDING_WRITES 16
#endif
@@ -86,24 +92,31 @@
#ifndef AXI_LIMIT2_MAX_BEATS_BYTES
#define AXI_LIMIT2_MAX_BEATS_BYTES 0x0
#endif
+
#ifndef AXI_LIMIT2_MEM_TYPE
#define AXI_LIMIT2_MEM_TYPE 0x0
#endif
+
#ifndef AXI_LIMIT2_MAX_OUTSTANDING_READS
#define AXI_LIMIT2_MAX_OUTSTANDING_READS 32
#endif
+
#ifndef AXI_LIMIT2_MAX_OUTSTANDING_WRITES
#define AXI_LIMIT2_MAX_OUTSTANDING_WRITES 16
#endif
+
#ifndef AXI_LIMIT3_MAX_BEATS_BYTES
#define AXI_LIMIT3_MAX_BEATS_BYTES 0x0
#endif
+
#ifndef AXI_LIMIT3_MEM_TYPE
#define AXI_LIMIT3_MEM_TYPE 0x0
#endif
+
#ifndef AXI_LIMIT3_MAX_OUTSTANDING_READS
#define AXI_LIMIT3_MAX_OUTSTANDING_READS 32
#endif
+
#ifndef AXI_LIMIT3_MAX_OUTSTANDING_WRITES
#define AXI_LIMIT3_MAX_OUTSTANDING_WRITES 16
#endif
diff --git a/src/ethosu_config_u65.h b/src/ethosu_config_u65.h
new file mode 100644
index 0000000..d662886
--- /dev/null
+++ b/src/ethosu_config_u65.h
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2019-2020,2022 Arm Limited.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ETHOSU_CONFIG_H
+#define ETHOSU_CONFIG_H
+
+/* Set default values if not manually overriden */
+
+#ifndef NPU_QCONFIG
+#define NPU_QCONFIG 2
+#endif
+
+#ifndef NPU_REGIONCFG_0
+#define NPU_REGIONCFG_0 3
+#endif
+
+#ifndef NPU_REGIONCFG_1
+#define NPU_REGIONCFG_1 2
+#endif
+
+#ifndef NPU_REGIONCFG_2
+#define NPU_REGIONCFG_2 1
+#endif
+
+#ifndef NPU_REGIONCFG_3
+#define NPU_REGIONCFG_3 1
+#endif
+
+#ifndef NPU_REGIONCFG_4
+#define NPU_REGIONCFG_4 1
+#endif
+
+#ifndef NPU_REGIONCFG_5
+#define NPU_REGIONCFG_5 1
+#endif
+
+#ifndef NPU_REGIONCFG_6
+#define NPU_REGIONCFG_6 1
+#endif
+
+#ifndef NPU_REGIONCFG_7
+#define NPU_REGIONCFG_7 1
+#endif
+
+#ifndef AXI_LIMIT0_MAX_BEATS_BYTES
+#define AXI_LIMIT0_MAX_BEATS_BYTES 0x0
+#endif
+
+#ifndef AXI_LIMIT0_MEM_TYPE
+#define AXI_LIMIT0_MEM_TYPE 0x0
+#endif
+
+#ifndef AXI_LIMIT0_MAX_OUTSTANDING_READS
+#define AXI_LIMIT0_MAX_OUTSTANDING_READS 64
+#endif
+
+#ifndef AXI_LIMIT0_MAX_OUTSTANDING_WRITES
+#define AXI_LIMIT0_MAX_OUTSTANDING_WRITES 32
+#endif
+
+#ifndef AXI_LIMIT1_MAX_BEATS_BYTES
+#define AXI_LIMIT1_MAX_BEATS_BYTES 0x0
+#endif
+
+#ifndef AXI_LIMIT1_MEM_TYPE
+#define AXI_LIMIT1_MEM_TYPE 0x0
+#endif
+
+#ifndef AXI_LIMIT1_MAX_OUTSTANDING_READS
+#define AXI_LIMIT1_MAX_OUTSTANDING_READS 64
+#endif
+
+#ifndef AXI_LIMIT1_MAX_OUTSTANDING_WRITES
+#define AXI_LIMIT1_MAX_OUTSTANDING_WRITES 32
+#endif
+
+#ifndef AXI_LIMIT2_MAX_BEATS_BYTES
+#define AXI_LIMIT2_MAX_BEATS_BYTES 0x0
+#endif
+
+#ifndef AXI_LIMIT2_MEM_TYPE
+#define AXI_LIMIT2_MEM_TYPE 0x0
+#endif
+
+#ifndef AXI_LIMIT2_MAX_OUTSTANDING_READS
+#define AXI_LIMIT2_MAX_OUTSTANDING_READS 64
+#endif
+
+#ifndef AXI_LIMIT2_MAX_OUTSTANDING_WRITES
+#define AXI_LIMIT2_MAX_OUTSTANDING_WRITES 32
+#endif
+
+#ifndef AXI_LIMIT3_MAX_BEATS_BYTES
+#define AXI_LIMIT3_MAX_BEATS_BYTES 0x0
+#endif
+
+#ifndef AXI_LIMIT3_MEM_TYPE
+#define AXI_LIMIT3_MEM_TYPE 0x0
+#endif
+
+#ifndef AXI_LIMIT3_MAX_OUTSTANDING_READS
+#define AXI_LIMIT3_MAX_OUTSTANDING_READS 64
+#endif
+
+#ifndef AXI_LIMIT3_MAX_OUTSTANDING_WRITES
+#define AXI_LIMIT3_MAX_OUTSTANDING_WRITES 32
+#endif
+
+/*
+ * Address offset between the CPU and the NPU. The offset is
+ * applied to the QBASE and BASEP registers.
+ */
+#ifndef BASE_POINTER_OFFSET
+#define BASE_POINTER_OFFSET 0
+#endif
+
+#endif /* #ifndef ETHOSU_CONFIG_H */
diff --git a/src/ethosu_device_u55_u65.c b/src/ethosu_device_u55_u65.c
index f16f9f8..54d2a79 100644
--- a/src/ethosu_device_u55_u65.c
+++ b/src/ethosu_device_u55_u65.c
@@ -18,10 +18,15 @@
#include "ethosu_interface.h"
-#include "ethosu_config.h"
#include "ethosu_device.h"
#include "ethosu_log.h"
+#ifdef ETHOSU55
+#include "ethosu_config_u55.h"
+#else
+#include "ethosu_config_u65.h"
+#endif
+
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c
index ee9d08c..11c51f6 100644
--- a/src/ethosu_driver.c
+++ b/src/ethosu_driver.c
@@ -21,10 +21,15 @@
******************************************************************************/
#include "ethosu_driver.h"
-#include "ethosu_config.h"
#include "ethosu_device.h"
#include "ethosu_log.h"
+#ifdef ETHOSU55
+#include "ethosu_config_u55.h"
+#else
+#include "ethosu_config_u65.h"
+#endif
+
#include <assert.h>
#include <cmsis_compiler.h>
#include <inttypes.h>