diff --git a/EdgeImpulse.EI-SDK.pdsc b/EdgeImpulse.EI-SDK.pdsc
index bdef4df..18fc736 100644
--- a/EdgeImpulse.EI-SDK.pdsc
+++ b/EdgeImpulse.EI-SDK.pdsc
@@ -5,13 +5,16 @@
EI-SDK
LICENSE-apache-2.0.txt
Edge Impulse SDK
- https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.51.3/
+ https://github.com/edgeimpulse/edge-impulse-sdk-pack/releases/download/v1.52.0/
hello@edgeimpulse.com
https://github.com/edgeimpulse/edge-impulse-sdk-pack.git
-
+
EI-SDK
+
+ EI-SDK
+
EI-SDK
@@ -98,9 +101,6 @@
EI-SDK
-
-
- EI-SDK
@@ -146,15 +146,15 @@
-
+
Edge Impulse SDK
+
-
@@ -620,11 +620,15 @@
-
+
-
+
+
+
-
+
+
+
diff --git a/EdgeImpulse.pidx b/EdgeImpulse.pidx
index 77ac9d2..a31081d 100644
--- a/EdgeImpulse.pidx
+++ b/EdgeImpulse.pidx
@@ -2,8 +2,8 @@
EdgeImpulse
https://raw.githubusercontent.com/edgeimpulse/edge-impulse-sdk-pack/main/
- 2024-06-11 11:07:42
+ 2024-06-12 09:56:52
-
+
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/.clang-format b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/.clang-format
deleted file mode 100644
index 9a7ae82..0000000
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/.clang-format
+++ /dev/null
@@ -1,144 +0,0 @@
-#
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
-#
-# 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.
-#
-
----
-Language: Cpp
-AccessModifierOffset: -2
-AlignAfterOpenBracket: Align
-AlignConsecutiveMacros: false
-AlignConsecutiveAssignments: true
-AlignConsecutiveDeclarations: false
-AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
-AllowAllArgumentsOnNextLine: true
-AllowAllConstructorInitializersOnNextLine: true
-AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
-AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: Empty
-AllowShortLambdasOnASingleLine: All
-AllowShortIfStatementsOnASingleLine: Never
-AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
-AlwaysBreakAfterReturnType: None
-AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: MultiLine
-BinPackArguments: false
-BinPackParameters: false
-BraceWrapping:
- AfterCaseLabel: true
- AfterClass: true
- AfterControlStatement: true
- AfterEnum: true
- AfterFunction: true
- AfterNamespace: true
- AfterObjCDeclaration: true
- AfterStruct: true
- AfterUnion: true
- AfterExternBlock: false
- BeforeCatch: true
- BeforeElse: true
- IndentBraces: false
- SplitEmptyFunction: true
- SplitEmptyRecord: true
- SplitEmptyNamespace: true
-BreakBeforeBinaryOperators: None
-BreakBeforeBraces: Custom
-BreakBeforeInheritanceComma: true
-BreakInheritanceList: AfterColon
-BreakBeforeTernaryOperators: false
-BreakConstructorInitializersBeforeComma: true
-BreakConstructorInitializers: AfterColon
-BreakAfterJavaFieldAnnotations: false
-BreakStringLiterals: true
-ColumnLimit: 120
-CommentPragmas: '^ IWYU pragma:'
-CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
-ConstructorInitializerIndentWidth: 4
-ContinuationIndentWidth: 4
-Cpp11BracedListStyle: true
-DerivePointerAlignment: false
-DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
-FixNamespaceComments: true
-ForEachMacros:
- - foreach
- - Q_FOREACH
- - BOOST_FOREACH
-IncludeBlocks: Preserve
-IncludeCategories:
- - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
- Priority: 2
- - Regex: '^(<|"(gtest|gmock|isl|json)/)'
- Priority: 3
- - Regex: '.*'
- Priority: 1
-IncludeIsMainRegex: '(Test)?$'
-IndentCaseLabels: false
-IndentPPDirectives: None
-IndentWidth: 4
-IndentWrappedFunctionNames: false
-JavaScriptQuotes: Leave
-JavaScriptWrapImports: true
-KeepEmptyLinesAtTheStartOfBlocks: true
-MacroBlockBegin: ''
-MacroBlockEnd: ''
-MaxEmptyLinesToKeep: 1
-NamespaceIndentation: None
-ObjCBinPackProtocolList: Auto
-ObjCBlockIndentWidth: 2
-ObjCSpaceAfterProperty: false
-ObjCSpaceBeforeProtocolList: true
-PenaltyBreakAssignment: 2
-PenaltyBreakBeforeFirstCallParameter: 19
-PenaltyBreakComment: 300
-PenaltyBreakFirstLessLess: 120
-PenaltyBreakString: 1000
-PenaltyBreakTemplateDeclaration: 10
-PenaltyExcessCharacter: 1000000
-PenaltyReturnTypeOnItsOwnLine: 1000000
-PointerAlignment: Right
-ReflowComments: true
-SortIncludes: true
-SortUsingDeclarations: true
-SpaceAfterCStyleCast: false
-SpaceAfterLogicalNot: false
-SpaceAfterTemplateKeyword: true
-SpaceBeforeAssignmentOperators: true
-SpaceBeforeCpp11BracedList: false
-SpaceBeforeCtorInitializerColon: true
-SpaceBeforeInheritanceColon: true
-SpaceBeforeParens: ControlStatements
-SpaceBeforeRangeBasedForLoopColon: true
-SpaceInEmptyParentheses: false
-SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
-SpacesInContainerLiterals: false
-SpacesInCStyleCastParentheses: false
-SpacesInParentheses: false
-SpacesInSquareBrackets: false
-Standard: Cpp11
-StatementMacros:
- - Q_UNUSED
- - QT_REQUIRE_VERSION
-TabWidth: 8
-UseTab: Never
-...
-
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/CMakeLists.txt b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/CMakeLists.txt
index 1dd1e54..e7cd9e1 100644
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/CMakeLists.txt
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/CMakeLists.txt
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
@@ -18,12 +18,6 @@
cmake_minimum_required(VERSION 3.15.6)
-macro(test_and_convert_error_level log_level ethos_level)
- if(${log_level} STREQUAL ${LOG_LEVEL})
- set(ETHOSU_LOG_SEVERITY ${ethos_level})
- endif()
-endmacro()
-
project(ethosu_core_driver VERSION 0.0.1)
#
@@ -34,17 +28,10 @@ option(DRIVER_PMU_AUTOINIT "Enable PMU boot auto-initialization" OFF)
set(CMSIS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmsis" CACHE PATH "Path to CMSIS.")
-set(LOG_NAMES emerg alert crit err warning notice info debug)
-if(DEFINED LOG_LEVEL)
- test_and_convert_error_level( LOG_LEVEL_ERROR err )
- test_and_convert_error_level( LOG_LEVEL_DEBUG debug )
- test_and_convert_error_level( LOG_LEVEL_TRACE debug )
- test_and_convert_error_level( LOG_LEVEL_INFO info )
- test_and_convert_error_level( LOG_LEVEL_WARN warning )
-else()
- set(ETHOSU_LOG_SEVERITY "info" CACHE STRING "Driver log severity level ${LOG_NAMES}")
- set_property(CACHE ETHOSU_LOG_SEVERITY PROPERTY STRINGS ${LOG_NAMES})
-endif()
+set(LOG_NAMES err warning info debug)
+set(ETHOSU_LOG_SEVERITY "warning" CACHE STRING "Driver log severity level ${LOG_NAMES} (Defaults to 'warning')")
+set(ETHOSU_TARGET_NPU_CONFIG "ethos-u55-128" CACHE STRING "Default NPU configuration")
+set_property(CACHE ETHOSU_LOG_SEVERITY PROPERTY STRINGS ${LOG_NAMES})
#
# Global settings
@@ -67,7 +54,26 @@ include_directories(${CMSIS_PATH}/CMSIS/Core/Include)
# Build driver library
add_library(ethosu_core_driver STATIC)
target_include_directories(ethosu_core_driver PUBLIC include)
-target_sources(ethosu_core_driver PRIVATE src/ethosu_driver.c src/ethosu_device.c src/ethosu_pmu.c)
+target_sources(ethosu_core_driver PRIVATE src/ethosu_driver.c src/ethosu_pmu.c)
+
+string(TOLOWER ${ETHOSU_TARGET_NPU_CONFIG} ETHOSU_TARGET_NPU_CONFIG)
+if(ETHOSU_TARGET_NPU_CONFIG MATCHES "^ethos-(u[0-9]+|uz)-([0-9]+$)")
+ set(ETHOSU_ARCH ${CMAKE_MATCH_1})
+ set(ETHOSU_MACS ${CMAKE_MATCH_2})
+else()
+ message(FATAL_ERROR "Invalid Ethos-U target configuration '${ETHOSU_TARGET_NPU_CONFIG}")
+endif()
+
+target_compile_definitions(ethosu_core_driver PRIVATE
+ ETHOSU_ARCH=${ETHOSU_ARCH}
+ ETHOS$)
+
+if (ETHOSU_ARCH STREQUAL "u55" OR ETHOSU_ARCH STREQUAL "u65")
+ target_sources(ethosu_core_driver PRIVATE src/ethosu_device_u55_u65.c)
+else()
+ message(FATAL_ERROR "Invalid NPU configuration")
+endif()
+
# Set the log level for the target
target_compile_definitions(ethosu_core_driver PRIVATE ETHOSU_LOG_SEVERITY=${LOG_SEVERITY})
@@ -83,6 +89,7 @@ install(FILES include/ethosu_device.h include/ethosu_driver.h include/pmu_ethosu
message(STATUS "*******************************************************")
message(STATUS "PROJECT_NAME : ${PROJECT_NAME}")
+message(STATUS "ETHOSU_TARGET_NPU_CONFIG : ${ETHOSU_TARGET_NPU_CONFIG}")
message(STATUS "CMAKE_SYSTEM_PROCESSOR : ${CMAKE_SYSTEM_PROCESSOR}")
message(STATUS "CMSIS_PATH : ${CMSIS_PATH}")
message(STATUS "ETHOSU_LOG_SEVERITY : ${ETHOSU_LOG_SEVERITY}")
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/README.md b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/README.md
index e23ed2e..9e077b3 100644
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/README.md
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/README.md
@@ -4,27 +4,136 @@ This repository contains a device driver for the Arm(R) Ethos(TM)-U NPU.
## Building
-The source code comes with a CMake based build system. The driver is expeced to
-be cross compiled for any of the supported Arm Cortex(R)-M CPUs, which will
-require the user to setup a custom toolchain file.
+The source code comes with a CMake based build system. The driver is expected to
+be cross compiled for any of the supported Arm Cortex(R)-M CPUs, which requires
+the user to configure the build to match their system configuration.
-The user is also required to define `CMAKE_SYSTEM_PROCESSOR` for the target CPU,
-for example cortex-m55+nodsp+nofp. This can be done either in the toolchain
-file or on the command line.
+One such requirement is to define the target CPU, normally by setting
+`CMAKE_SYSTEM_PROCESSOR`. **Note** that when using the toolchain files provided
+in [core_platform](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git),
+the variable `TARGET_CPU` must be used instead of `CMAKE_SYSTEM_PROCESSOR`.
+
+Target CPU is specified on the form "cortex-m", for example:
+"cortex-m55+nodsp+nofp".
+
+Similarly the target NPU configuration is
+controlled by setting `ETHOSU_TARGET_NPU_CONFIG`, for example "ethos-u55-128".
+
+The build configuration can be defined either in the toolchain file or
+by passing options on the command line.
+
+```[bash]
+$ cmake -B build \
+ -DCMAKE_TOOLCHAIN_FILE= \
+ -DCMAKE_SYSTEM_PROCESSOR=cortex-m \
+ -DETHOSU_TARGET_NPU_CONFIG=ethos-u-
+$ cmake --build build
+```
+
+or when using toolchain files from [core_platform](https://git.mlplatform.org/ml/ethos-u/ethos-u-core-platform.git)
+
+```[bash]
+$ cmake -B build \
+ -DCMAKE_TOOLCHAIN_FILE= \
+ -DTARGET_CPU=cortex-m \
+ -DETHOSU_TARGET_NPU_CONFIG=ethos-u-
+$ cmake --build build
```
-$ mkdir build
-$ cd build
-$ cmake .. -DCMAKE_TOOLCHAIN_FILE= -DCMAKE_SYSTEM_PROCESSOR=cortex-m
-$ make
+
+## Driver APIs
+
+The driver APIs are defined in `include/ethosu_driver.h` and the related types
+in `include/ethosu_types.h`. Inferences can be invoked in two manners:
+synchronously or asynchronously. The two types of invocation can be freely mixed
+in a single application.
+
+### Synchronous invocation
+
+A typical usage of the driver can be the following:
+
+```[C]
+// reserve a driver to be used (this call could block until a driver is available)
+struct ethosu_driver *drv = ethosu_reserve_driver();
+...
+// run one or more inferences
+int result = ethosu_invoke(drv,
+ custom_data_ptr,
+ custom_data_size,
+ base_addr,
+ base_addr_size,
+ num_base_addr);
+...
+// release the driver for others to use
+ethosu_release_driver(drv);
```
-For running the driver on Arm CPUs which are configured with datacache, the
+### Asynchronous invocation
+
+A typical usage of the driver can be the following:
+
+```[C]
+// reserve a driver to be used (this call could block until a driver is available)
+struct ethosu_driver *drv = ethosu_reserve_driver();
+...
+// run one or more inferences
+int result = ethosu_invoke_async(drv,
+ custom_data_ptr,
+ custom_data_size,
+ base_addr,
+ base_addr_size,
+ num_base_addr,
+ user_arg);
+...
+// do some other work
+...
+int ret;
+do {
+ // true = blocking, false = non-blocking
+ // ret > 0 means inference not completed (only for non-blocking mode)
+ ret = ethosu_wait(drv, );
+} while(ret > 0);
+...
+// release the driver for others to use
+ethosu_release_driver(drv);
+```
+
+Note that if `ethosu_wait` is invoked from a different thread and concurrently
+with `ethosu_invoke_async`, the user is responsible to guarantee that
+`ethosu_wait` is called after a successful completion of `ethosu_invoke_async`.
+Otherwise `ethosu_wait` might fail and not actually wait for the inference
+completion.
+
+### Driver initialization
+
+In order to use a driver it first needs to be initialized by calling the `init`
+function, which will also register the handle in the list of available drivers.
+A driver can be torn down by using the `deinit` function, which also removes the
+driver from the list.
+
+The correct mapping is one driver per NPU device. Note that the NPUs must have
+the same configuration, indeed the NPU configuration can be only one, which is
+defined at compile time.
+
+## Implementation design
+
+The driver is structured in two main parts: the driver, which is responsible to
+provide an unified API to the user; and the device part, which deals with the
+details at the hardware level.
+
+In order to do its task the driver needs a device implementation. There could be
+multiple device implementation for different hardware model and/or
+configurations. Note that the driver can be compiled to target only one NPU
+configuration by specializing the device part at compile time.
+
+## Data caching
+
+For running the driver on Arm CPUs which are configured with data cache, the
cache maintenance functions in the driver are exported with weakly linked
-symbols that should be overriden. An example implementation using the CMSIS
+symbols that should be overridden. An example implementation using the CMSIS
primitives found in cachel1_armv7.h could be as below:
-```
+```[C++]
extern "C" {
void ethosu_flush_dcache(uint32_t *p, size_t bytes) {
if (p)
@@ -42,12 +151,81 @@ void ethosu_invalidate_dcache(uint32_t *p, size_t bytes) {
}
```
-# License
+## Mutex and semaphores
+
+To ensure the correct functionality of the driver mutexes and semaphores are
+used internally. The default implementations of mutexes and semaphores are
+designed for a single-threaded baremetal environment. Hence for integration in
+environemnts where multi-threading is possible, e.g., RTOS, the user is
+responsible to provide implementation for mutexes and semaphores to be used by
+the driver.
+
+The mutex and semaphore APIs are defined as weak linked functions that can be
+overridden by the user. The APIs are the usual ones and described below:
+
+```[C]
+// create a mutex by returning back a handle
+void *ethosu_mutex_create(void);
+// lock the given mutex
+void ethosu_mutex_lock(void *mutex);
+// unlock the given mutex
+void ethosu_mutex_unlock(void *mutex);
+
+// create a (binary) semaphore by returning back a handle
+void *ethosu_semaphore_create(void);
+// take from the given semaphore
+void ethosu_semaphore_take(void *sem);
+// give from the given semaphore
+void ethosu_semaphore_give(void *sem);
+```
+
+## Begin/End inference callbacks
+
+The driver provide weak linked functions as hooks to receive callbacks whenever
+an inference begins and ends. The user can override such functions when needed.
+To avoid memory leaks, any allocations done in the ethosu_inference_begin() must
+be balanced by a corresponding free of the memory in the ethosu_inference_end()
+callback.
+
+```[C]
+void ethosu_inference_begin(struct ethosu_driver *drv, void *user_arg);
+void ethosu_inference_end(struct ethosu_driver *drv, void *user_arg);
+```
+
+Note that the `void *user_arg` pointer passed to invoke() function is the same
+pointer passed to the begin() and end() callbacks. For example:
+
+```[C]
+void my_function() {
+ ...
+ struct my_data data = {...};
+ int result = int ethosu_invoke_v3(drv,
+ custom_data_ptr,
+ custom_data_size,
+ base_addr,
+ base_addr_size,
+ num_base_addr,
+ (void *)&data);
+ ....
+}
+
+void ethosu_inference_begin(struct ethosu_driver *drv, void *user_arg) {
+ struct my_data *data = (struct my_data*) user_arg;
+ // use drv and data here
+}
+
+void ethosu_inference_end(struct ethosu_driver *drv, void *user_arg) {
+ struct my_data *data = (struct my_data*) user_arg;
+ // use drv and data here
+}
+```
+
+## License
The Arm Ethos-U core driver is provided under an Apache-2.0 license. Please see
[LICENSE.txt](LICENSE.txt) for more information.
-# Contributions
+## Contributions
The Arm Ethos-U project welcomes contributions under the Apache-2.0 license.
@@ -61,14 +239,14 @@ commit message. You must use your real name, no pseudonyms or anonymous
contributions are accepted. If there are more than one contributor, everyone
adds their name and e-mail to the commit message.
-```
+```[]
Author: John Doe \
Date: Mon Feb 29 12:12:12 2016 +0000
Title of the commit
Short description of the change.
-
+
Signed-off-by: John Doe john.doe@example.org
Signed-off-by: Foo Bar foo.bar@example.org
```
@@ -76,11 +254,18 @@ Signed-off-by: Foo Bar foo.bar@example.org
The contributions will be code reviewed by Arm before they can be accepted into
the repository.
-# Security
+In order to submit a contribution push your patch to
+`ssh://@review.mlplatform.org:29418/ml/ethos-u/ethos-u-core-driver`.
+To do this you will need to sign-in to
+[review.mlplatform.org](https://review.mlplatform.org) using a GitHub account
+and add your SSH key under your settings. If there is a problem adding the SSH
+key make sure there is a valid email address in the Email Addresses field.
+
+## Security
Please see [Security](SECURITY.md).
-# Trademark notice
+## Trademark notice
Arm, Cortex and Ethos are registered trademarks of Arm Limited (or its
subsidiaries) in the US and/or elsewhere.
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_device.h b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_device.h
deleted file mode 100644
index c3bcecb..0000000
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_device.h
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Copyright (c) 2022 Arm Limited. All rights reserved.
- *
- * 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
- * http://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.
- *
- * SPDX-License-Identifier: Apache-2.0
- */
-
-#ifndef ETHOSU_DEVICE_H
-#define ETHOSU_DEVICE_H
-
-/******************************************************************************
- * Includes
- ******************************************************************************/
-
-#include
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/******************************************************************************
- * Defines
- ******************************************************************************/
-
-#define ETHOSU_DRIVER_VERSION_MAJOR 0 ///< Driver major version
-#define ETHOSU_DRIVER_VERSION_MINOR 16 ///< Driver minor version
-#define ETHOSU_DRIVER_VERSION_PATCH 0 ///< Driver patch version
-#define ETHOSU_DRIVER_BASEP_INDEXES 8 ///< Number of base pointer indexes
-
-#ifndef ETHOSU_PMU_NCOUNTERS
-#define ETHOSU_PMU_NCOUNTERS 4
-#endif
-
-/******************************************************************************
- * Types
- ******************************************************************************/
-
-enum ethosu_error_codes
-{
- ETHOSU_SUCCESS = 0, ///< Success
- ETHOSU_GENERIC_FAILURE = -1, ///< Generic failure
- ETHOSU_INVALID_PARAM = -2 ///< Invalid parameter
-};
-
-struct ethosu_device
-{
- volatile uintptr_t base_address;
- uint32_t proto;
- uint32_t pmcr;
- uint32_t pmccntr[2];
- uint32_t pmcnten;
- uint32_t pmint;
- uint32_t pmccntr_cfg;
- uint32_t pmu_evcntr[ETHOSU_PMU_NCOUNTERS];
- uint32_t pmu_evtypr[ETHOSU_PMU_NCOUNTERS];
- uint32_t secure;
- uint32_t privileged;
-};
-
-struct ethosu_id
-{
- uint32_t version_status; ///< Version status
- uint32_t version_minor; ///< Version minor
- uint32_t version_major; ///< Version major
- uint32_t product_major; ///< Product major
- uint32_t arch_patch_rev; ///< Architecture version patch
- uint32_t arch_minor_rev; ///< Architecture version minor
- uint32_t arch_major_rev; ///< Architecture version major
-};
-
-struct ethosu_config
-{
- struct
- {
- uint32_t macs_per_cc; ///< MACs per clock cycle
- uint32_t cmd_stream_version; ///< NPU command stream version
- uint32_t shram_size; ///< SHRAM size
- uint32_t custom_dma; ///< Custom DMA enabled
- };
-};
-
-/**
- * Memory type parameter for set_regioncfg_reg:
- * Counter{0,1}: Outstanding transactions for
- * AXI port 0 for memory type/region a=0,b=1
- * Counter{2,3}: Outstanding transactions for
- * AXI port 1 for memory type/region a=2,b=3
- */
-enum ethosu_memory_type
-{
- ETHOSU_AXI0_OUTSTANDING_COUNTER0 = 0, ///< NPU axi0_outstanding_counter0
- ETHOSU_AXI0_OUTSTANDING_COUNTER1 = 1, ///< NPU axi0_outstanding_counter1
- ETHOSU_AXI1_OUTSTANDING_COUNTER2 = 2, ///< NPU axi1_outstanding_counter2
- ETHOSU_AXI1_OUTSTANDING_COUNTER3 = 3 ///< NPU axi1_outstanding_counter3
-};
-
-enum ethosu_axi_limit_beats
-{
- ETHOSU_AXI_LIMIT_64_BYTES = 0, ///< NPU AXI limit 64 byte burst split alignment.
- ETHOSU_AXI_LIMIT_128_BYTES = 1, ///< NPU AXI limit 128 byte burst split alignment.
- ETHOSU_AXI_LIMIT_256_BYTES = 2 ///< NPU AXI limit 256 byte burst split alignment.
-};
-
-enum ethosu_axi_limit_mem_type
-{
- ETHOSU_MEM_TYPE_DEVICE_NON_BUFFERABLE = 0,
- ETHOSU_MEM_TYPE_DEVICE_BUFFERABLE = 1,
- ETHOSU_MEM_TYPE_NORMAL_NON_CACHEABLE_NON_BUFFERABLE = 2,
- ETHOSU_MEM_TYPE_NORMAL_NON_CACHEABLE_BUFFERABLE = 3,
- ETHOSU_MEM_TYPE_WRITE_THROUGH_NO_ALLOCATE = 4,
- ETHOSU_MEM_TYPE_WRITE_THROUGH_READ_ALLOCATE = 5,
- ETHOSU_MEM_TYPE_WRITE_THROUGH_WRITE_ALLOCATE = 6,
- ETHOSU_MEM_TYPE_WRITE_THROUGH_READ_AND_WRITE_ALLOCATE = 7,
- ETHOSU_MEM_TYPE_WRITE_BACK_NO_ALLOCATE = 8,
- ETHOSU_MEM_TYPE_WRITE_BACK_READ_ALLOCATE = 9,
- ETHOSU_MEM_TYPE_WRITE_BACK_WRITE_ALLOCATE = 10,
- ETHOSU_MEM_TYPE_WRITE_BACK_READ_AND_WRITE_ALLOCATE = 11
-};
-
-enum ethosu_clock_q_request
-{
- ETHOSU_CLOCK_Q_DISABLE = 0, ///< Disble NPU signal ready for clock off.
- ETHOSU_CLOCK_Q_ENABLE = 1 ///< Enable NPU signal ready for clock off when stop+idle state reached.
-};
-
-enum ethosu_power_q_request
-{
- ETHOSU_POWER_Q_DISABLE = 0, ///< Disble NPU signal ready for power off.
- ETHOSU_POWER_Q_ENABLE = 1 ///< Enable NPU signal ready for power off when stop+idle state reached.
-};
-
-/******************************************************************************
- * Prototypes
- ******************************************************************************/
-
-/**
- * Initialize the device.
- */
-enum ethosu_error_codes ethosu_dev_init(struct ethosu_device *dev,
- const void *base_address,
- uint32_t secure_enable,
- uint32_t privilege_enable);
-
-/**
- * Get device id.
- */
-enum ethosu_error_codes ethosu_get_id(struct ethosu_device *dev, struct ethosu_id *id);
-
-/**
- * Get device configuration.
- */
-enum ethosu_error_codes ethosu_get_config(struct ethosu_device *dev, struct ethosu_config *config);
-
-/**
- * Execute a given command stream on NPU.
- * \param[in] cmd_stream_ptr Pointer to the command stream
- * \param[in] cms_length Command stream length
- * \param[in] base_addr Pointer to array of base addresses
- * - 0: weight tensor
- * - 1: scratch tensor
- * - All input tensors
- * - All output tensors
- * \param[in] num_base_addr Number of base addresses.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_run_command_stream(struct ethosu_device *dev,
- const uint8_t *cmd_stream_ptr,
- uint32_t cms_length,
- const uint64_t *base_addr,
- int num_base_addr);
-
-/**
- * Check if IRQ is raised.
- * \param[out] irq_status Pointer to IRQ status
- * - 0 IRQ not raised
- * - 1 IRQ raised
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_is_irq_raised(struct ethosu_device *dev, uint8_t *irq_status);
-
-/**
- * Clear IRQ status.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_clear_irq_status(struct ethosu_device *dev);
-
-/**
- * Get the 16 bit status mask.
- * \param[out] irq_status_mask Pointer to the status mask.
- * The lower 16 bits of status reg are returned.
- * bit0: state
- * bit1: irq_raised
- * bit2: bus_status
- * bit3: reset_status
- * bit4: cmd_parse_error
- * bit5: cmd_end_reached
- * bit6: pmu_irq_raised
- * bit7-15: reserved
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_get_status_mask(struct ethosu_device *dev, uint16_t *status_mask);
-
-/**
- * Get the 16 bit IRQ history mask.
- * \param[out] irq_history_mask Pointer to the IRQ history mask.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_get_irq_history_mask(struct ethosu_device *dev, uint16_t *irq_history_mask);
-
-/**
- * Clear the given bits in the
- * IRQ history mask.
- * \param[in] irq_history_clear_mask 16 bit mask indicating which bits to
- * clear in the IRQ history mask.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_clear_irq_history_mask(struct ethosu_device *dev, uint16_t irq_history_clear_mask);
-
-/**
- * Perform a NPU soft reset.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_soft_reset(struct ethosu_device *dev);
-
-/**
- * Wait for reset ready.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_wait_for_reset(struct ethosu_device *dev);
-
-/**
- * Read and return the content of a given NPU APB
- * register range.
- * \param[in] start_address Start address.
- * \param[in] num_reg Number of registers to read.
- * \param[out] reg_p Pointer to a output area, allocated by the
- * caller, where the register content shall be
- * written.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_read_apb_reg(struct ethosu_device *dev,
- uint32_t start_address,
- uint16_t num_reg,
- uint32_t *reg_p);
-
-/**
- * Set qconfig register. I.e.
- * AXI configuration for the command stream.
- * \param[in] memory_type Memory_type to use for command stream:
- * enum ethosu_memory_type.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_qconfig(struct ethosu_device *dev, enum ethosu_memory_type memory_type);
-
-/**
- * Set register REGIONCFG.
- * Base pointer configuration.
- * Bits[2*k+1:2*k] give the memory type for BASEP[k].
- * \param[in] region Region field to set: 0 - 7.
- * \param[in] memory_type Memory_type to use for region: enum ethosu_memory_type.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_regioncfg(struct ethosu_device *dev,
- uint8_t region,
- enum ethosu_memory_type memory_type);
-
-/**
- * Set AXI limit parameters for port 0 counter 0.
- * \param[in] max_beats Burst split alignment, \ref ethosu_axi_limit_beats.
- * \param[in] memtype Cache policy \ref ethosu_axi_limit_mem_type
- * \param[in] max_reads Maximum number of outstanding reads.
- * \param[in] max_writes Maximum number of outstanding writes.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_axi_limit0(struct ethosu_device *dev,
- enum ethosu_axi_limit_beats max_beats,
- enum ethosu_axi_limit_mem_type memtype,
- uint8_t max_reads,
- uint8_t max_writes);
-/**
- * Set AXI limit parameters for port 0 counter 1.
- * \param[in] max_beats Burst split alignment, \ref ethosu_axi_limit_beats.
- * \param[in] memtype Cache policy \ref ethosu_axi_limit_mem_type
- * \param[in] max_reads Maximum number of outstanding reads.
- * \param[in] max_writes Maximum number of outstanding writes.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_axi_limit1(struct ethosu_device *dev,
- enum ethosu_axi_limit_beats max_beats,
- enum ethosu_axi_limit_mem_type memtype,
- uint8_t max_reads,
- uint8_t max_writes);
-/**
- * Set AXI limit parameters for port 1 counter 2.
- * \param[in] max_beats Burst split alignment, \ref ethosu_axi_limit_beats.
- * \param[in] memtype Cache policy \ref ethosu_axi_limit_mem_type
- * \param[in] max_reads Maximum number of outstanding reads.
- * \param[in] max_writes Maximum number of outstanding writes.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_axi_limit2(struct ethosu_device *dev,
- enum ethosu_axi_limit_beats max_beats,
- enum ethosu_axi_limit_mem_type memtype,
- uint8_t max_reads,
- uint8_t max_writes);
-/**
- * Set AXI limit parameters for port 1 counter 3.
- * \param[in] max_beats Burst split alignment, \ref ethosu_axi_limit_beats.
- * \param[in] memtype Cache policy \ref ethosu_axi_limit_mem_type
- * \param[in] max_reads Maximum number of outstanding reads.
- * \param[in] max_writes Maximum number of outstanding writes.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_axi_limit3(struct ethosu_device *dev,
- enum ethosu_axi_limit_beats max_beats,
- enum ethosu_axi_limit_mem_type memtype,
- uint8_t max_reads,
- uint8_t max_writes);
-
-/**
- * Get current command stream queue read position.
- * \param[out] qread Pointer to queue read.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_get_qread(struct ethosu_device *dev, uint32_t *qread);
-
-/**
- * Get revision of NPU
- * \param[out] revision Pointer to revision read.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_get_revision(struct ethosu_device *dev, uint32_t *revision);
-
-/**
- * Issue run command for the currently programmed
- * command stream, starting at current queue read
- * position.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_command_run(struct ethosu_device *dev);
-
-/**
- * Dump a 1KB section of SHRAM.
- * \param[in] section Section offset to 1KB section in SHRAM.
- * \param[out] shram_p Pointer to a output area, allocated by the
- * caller, where the SHRAM content shall be
- * written.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_get_shram_data(struct ethosu_device *dev, int section, uint32_t *shram_p);
-
-/**
- * Set clock and power q request enable bits.
- * \param[in] clock_q Clock q ENABLE/DISABLE \ref clock_q_request.
- * \param[in] power_q Power q ENABLE/DISABLE \ref power_q_request.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_set_clock_and_power(struct ethosu_device *dev,
- enum ethosu_clock_q_request clock_q,
- enum ethosu_power_q_request power_q);
-
-/**
- * Read register.
- * \param[in] address Address to read.
- * \return Register value.
- */
-uint32_t ethosu_read_reg(struct ethosu_device *dev, uint32_t address);
-
-/**
- * Write register.
- * \param[in] address Address to read.
- * \param[in] value Value to be written.
- */
-void ethosu_write_reg(struct ethosu_device *dev, uint32_t address, uint32_t value);
-
-/**
- * Write register with shadow variable.
- * \param[in] address Address to read.
- * \param[in] value Value to be written.
- */
-void ethosu_write_reg_shadow(struct ethosu_device *dev, uint32_t address, uint32_t value, uint32_t *shadow);
-
-/**
- * Save the PMU configuration to ethosu_device struct.
- * \param[in] dev Ethos-U device where the PMU configuration is
- * saved.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_save_pmu_config(struct ethosu_device *dev);
-
-/**
- * Restore the PMU configuration from a ethosu_device struct.
- * \param[in] dev Ethos-U device where the PMU configuration is
- * stored.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_restore_pmu_config(struct ethosu_device *dev);
-
-/**
- * Save PMU counters to shadow variables in memory.
- * \param[in] dev Ethos-U device where the PMU configuration is
- * stored.
- * \return \ref ethosu_error_codes
- */
-enum ethosu_error_codes ethosu_save_pmu_counters(struct ethosu_device *dev);
-
-/**
- * Check if the STATUS register has any error bits set or not.
- * \param[in] dev Ethos-U device to check.
- * \return true if any error bits set,
- * false otherwise.
- */
-bool ethosu_status_has_error(struct ethosu_device *dev);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // ETHOSU_DEVICE_H
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_driver.h b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_driver.h
index ff040fc..9c9f173 100644
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_driver.h
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_driver.h
@@ -1,18 +1,19 @@
/*
- * Copyright (c) 2022 Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2019-2023 Arm Limited and/or its affiliates
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * 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
- * http://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.
+ * www.apache.org/licenses/LICENSE-2.0
*
- * SPDX-License-Identifier: Apache-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_DRIVER_H
@@ -22,7 +23,7 @@
* Includes
******************************************************************************/
-#include "ethosu_device.h"
+#include "ethosu_types.h"
#include
#include
@@ -32,55 +33,57 @@
extern "C" {
#endif
+/******************************************************************************
+ * Defines
+ ******************************************************************************/
+
+#define ETHOSU_DRIVER_VERSION_MAJOR 0 ///< Driver major version
+#define ETHOSU_DRIVER_VERSION_MINOR 16 ///< Driver minor version
+#define ETHOSU_DRIVER_VERSION_PATCH 0 ///< Driver patch version
+
/******************************************************************************
* Types
******************************************************************************/
-struct ethosu_driver
+// Forward declare
+struct ethosu_device;
+
+enum ethosu_job_state
{
- struct ethosu_device dev;
- bool abort_inference;
- uint64_t fast_memory;
- size_t fast_memory_size;
- bool status_error;
- bool dev_power_always_on;
- struct ethosu_driver *next;
- bool reserved;
- volatile bool irq_triggered;
- void *semaphore;
- uint8_t clock_request;
- uint8_t power_request;
+ ETHOSU_JOB_IDLE = 0,
+ ETHOSU_JOB_RUNNING,
+ ETHOSU_JOB_DONE
};
-struct ethosu_version_id
+struct ethosu_job
{
- // Ethos-U id
- uint8_t version_status;
- uint8_t version_minor;
- uint8_t version_major;
- uint8_t product_major;
- uint8_t arch_patch_rev;
- uint8_t arch_minor_rev;
- uint8_t arch_major_rev;
-
- // Driver Version
- uint8_t driver_patch_rev;
- uint8_t driver_minor_rev;
- uint8_t driver_major_rev;
+ volatile enum ethosu_job_state state;
+ const void *custom_data_ptr;
+ int custom_data_size;
+ const uint64_t *base_addr;
+ const size_t *base_addr_size;
+ int num_base_addr;
+ void *user_arg;
};
-struct ethosu_version_config
+struct ethosu_driver
{
- uint8_t macs_per_cc;
- uint8_t cmd_stream_version;
- uint8_t shram_size;
- uint8_t custom_dma;
+ struct ethosu_device *dev;
+ struct ethosu_driver *next;
+ struct ethosu_job job;
+ void *semaphore;
+ uint64_t fast_memory;
+ size_t fast_memory_size;
+ uint32_t power_request_counter;
+ bool status_error;
+ bool reserved;
};
-struct ethosu_version
+struct ethosu_driver_version
{
- struct ethosu_version_id id;
- struct ethosu_version_config cfg;
+ uint8_t major;
+ uint8_t minor;
+ uint8_t patch;
};
enum ethosu_request_clients
@@ -90,10 +93,111 @@ enum ethosu_request_clients
};
/******************************************************************************
- * Variables
+ * Prototypes (weak functions in driver)
******************************************************************************/
-extern struct ethosu_driver ethosu_drv;
+/**
+ * Interrupt handler to be called on IRQ from Ethos-U
+ *
+ * @param drv Pointer to driver handle
+ */
+void ethosu_irq_handler(struct ethosu_driver *drv);
+
+/**
+ * Flush/clean the data cache by address and size. Passing NULL as p argument
+ * expects the whole cache to be flushed.
+ *
+ * Addresses passed to this function must be 16 byte aligned.
+ *
+ * @param p 16 byte aligned address
+ * @param bytes Size of memory block in bytes
+ */
+void ethosu_flush_dcache(uint32_t *p, size_t bytes);
+
+/**
+ * Invalidate the data cache by address and size. Passing NULL as p argument
+ * expects the whole cache to be invalidated.
+ *
+ * Addresses passed to this function must be 16 byte aligned.
+ *
+ * @param p 16 byte aligned address
+ * @param bytes Size in bytes
+ */
+void ethosu_invalidate_dcache(uint32_t *p, size_t bytes);
+
+/**
+ * Minimal mutex implementation for baremetal applications. See
+ * ethosu_driver.c.
+ *
+ * @return Pointer to mutex handle
+ */
+void *ethosu_mutex_create(void);
+
+/**
+ * Minimal sempahore implementation for baremetal applications. See
+ * ethosu_driver.c.
+ *
+ * @return Pointer to semaphore handle
+ */
+void *ethosu_semaphore_create(void);
+
+/**
+ * Lock mutex.
+ *
+ * @param mutex Pointer to mutex handle
+ * @returns 0 on success, else negative error code
+ */
+int ethosu_mutex_lock(void *mutex);
+
+/**
+ * Unlock mutex.
+ *
+ * @param mutex Pointer to mutex handle
+ * @returns 0 on success, else negative error code
+ */
+int ethosu_mutex_unlock(void *mutex);
+
+/**
+ * Take semaphore.
+ *
+ * @param sem Pointer to semaphore handle
+ * @returns 0 on success, else negative error code
+ */
+int ethosu_semaphore_take(void *sem);
+
+/**
+ * Give semaphore.
+ *
+ * @param sem Pointer to semaphore handle
+ * @returns 0 on success, else negative error code
+ */
+int ethosu_semaphore_give(void *sem);
+
+/**
+ * Callback invoked just before the inference is started.
+ *
+ * @param drv Pointer to driver handle
+ * @param user_arg User argument provided to ethosu_invoke_*()
+ */
+void ethosu_inference_begin(struct ethosu_driver *drv, void *user_arg);
+
+/**
+ * Callback invoked just after the inference has completed.
+ *
+ * @param drv Pointer to driver handle
+ * @param user_arg User argument provided to ethosu_invoke_*()
+ */
+void ethosu_inference_end(struct ethosu_driver *drv, void *user_arg);
+
+/**
+ * Remapping command stream and base pointer addresses.
+ *
+ * @param address Address to be remapped.
+ * @param index -1 command stream, 0-n base address index
+ *
+ * @return Remapped address
+ */
+uint64_t ethosu_address_remap(uint64_t address, int index);
/******************************************************************************
* Prototypes
@@ -101,83 +205,151 @@ extern struct ethosu_driver ethosu_drv;
/**
* Initialize the Ethos-U driver.
+ *
+ * @param drv Pointer to driver handle
+ * @param base_address NPU register base address
+ * @param fast_memory Fast memory area, used for Ethos-U65 with spilling
+ * @param fast_memory_size Size in bytes of fast memory area
+ * @param secure_enable Configure NPU in secure- or non-secure mode
+ * @param privilege_enable Configure NPU in privileged- or non-privileged mode
+ * @return 0 on success, else negative error code
*/
int ethosu_init(struct ethosu_driver *drv,
- const void *base_address,
+ void *const base_address,
const void *fast_memory,
const size_t fast_memory_size,
uint32_t secure_enable,
uint32_t privilege_enable);
/**
- * Get Ethos-U version.
+ * Deinitialize the Ethos-U driver.
+ *
+ * @param drv Pointer to driver handle
*/
-int ethosu_get_version(struct ethosu_driver *drv, struct ethosu_version *version);
+void ethosu_deinit(struct ethosu_driver *drv);
/**
- * Invoke Vela command stream.
+ * Soft resets the Ethos-U device.
+ *
+ * @param drv Pointer to driver handle
+ * @return 0 on success, else negative error code
*/
-int ethosu_invoke(struct ethosu_driver *drv,
- const void *custom_data_ptr,
- const int custom_data_size,
- const uint64_t *base_addr,
- const size_t *base_addr_size,
- const int num_base_addr);
+int ethosu_soft_reset(struct ethosu_driver *drv);
/**
- * Abort Ethos-U inference.
+ * Request to disable Q-channel power gating of the Ethos-U device.
+ * Power requests are ref.counted. Increases count.
+ * (Note: clock gating is made to follow power gating)
+ *
+ * @param drv Pointer to driver handle
+ * @return 0 on success, else negative error code
*/
-void ethosu_abort(struct ethosu_driver *drv);
+int ethosu_request_power(struct ethosu_driver *drv);
/**
- * Interrupt handler do be called on IRQ from Ethos-U
+ * Release disable request for Q-channel power gating of the Ethos-U device.
+ * Power requests are ref.counted. Decreases count.
+ *
+ * @param drv Pointer to driver handle
*/
-void ethosu_irq_handler(struct ethosu_driver *drv);
+void ethosu_release_power(struct ethosu_driver *drv);
/**
- * Set Ethos-U power mode.
+ * Get Ethos-U driver version.
+ *
+ * @param ver Driver version struct
*/
-void ethosu_set_power_mode(struct ethosu_driver *drv, bool always_on);
+void ethosu_get_driver_version(struct ethosu_driver_version *ver);
/**
- * Register a driver for multiNPU usage
+ * Get Ethos-U hardware information.
+ *
+ * @param drv Pointer to driver handle
+ * @param hw Hardware information struct
*/
-int ethosu_register_driver(struct ethosu_driver *drv);
+void ethosu_get_hw_info(struct ethosu_driver *drv, struct ethosu_hw_info *hw);
/**
- * Deregister a driver from multiNPU usage
+ * Invoke command stream.
+ *
+ * @param drv Pointer to driver handle
+ * @param custom_data_ptr Custom data payload
+ * @param custom_data_size Size in bytes of custom data
+ * @param base_addr Array of base address pointers
+ * @param base_addr_size Size in bytes of each address in base_addr
+ * @param num_base_addr Number of elements in base_addr array
+ * @param user_arg User argument, will be passed to
+ * ethosu_inference_begin() and ethosu_inference_end()
+ * @return 0 on success, else negative error code
*/
-int ethosu_deregister_driver(struct ethosu_driver *drv);
+int ethosu_invoke_v3(struct ethosu_driver *drv,
+ const void *custom_data_ptr,
+ const int custom_data_size,
+ uint64_t *const base_addr,
+ const size_t *base_addr_size,
+ const int num_base_addr,
+ void *user_arg);
+
+#define ethosu_invoke(drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr) \
+ ethosu_invoke_v3(drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr, 0)
/**
- * Reserves a driver to execute inference with
+ * Invoke command stream using async interface.
+ * Must be followed by call(s) to ethosu_wait() upon successful return.
+ *
+ * @see ethosu_invoke_v3 for documentation.
*/
-struct ethosu_driver *ethosu_reserve_driver(void);
+int ethosu_invoke_async(struct ethosu_driver *drv,
+ const void *custom_data_ptr,
+ const int custom_data_size,
+ uint64_t *const base_addr,
+ const size_t *base_addr_size,
+ const int num_base_addr,
+ void *user_arg);
/**
- * Change driver status to available
+ * Wait for inference to complete (block=true)
+ * Poll status or finish up if inference is complete (block=false)
+ * (This function is only intended to be used in conjuction with ethosu_invoke_async)
+ *
+ * @param drv Pointer to driver handle
+ * @param block If call should block if inference is running
+ * @return -2 on inference not invoked, -1 on inference error, 0 on success, 1 on inference running
*/
-void ethosu_release_driver(struct ethosu_driver *drv);
+int ethosu_wait(struct ethosu_driver *drv, bool block);
/**
- * Set clock and power request bits
+ * Reserves a driver to execute inference with. Call will block until a driver
+ * is available.
+ *
+ * @return Pointer to driver handle.
*/
-enum ethosu_error_codes set_clock_and_power_request(struct ethosu_driver *drv,
- enum ethosu_request_clients client,
- enum ethosu_clock_q_request clock_request,
- enum ethosu_power_q_request power_request);
+struct ethosu_driver *ethosu_reserve_driver(void);
/**
- * Static inline for backwards-compatibility
+ * Release driver that was previously reserved with @see ethosu_reserve_driver.
+ *
+ * @param drv Pointer to driver handle
+ */
+void ethosu_release_driver(struct ethosu_driver *drv);
+
+/**
+ * Static inline for backwards-compatibility.
+ *
+ * @see ethosu_invoke_v3 for documentation.
*/
static inline int ethosu_invoke_v2(const void *custom_data_ptr,
const int custom_data_size,
- const uint64_t *base_addr,
+ uint64_t *const base_addr,
const size_t *base_addr_size,
const int num_base_addr)
{
struct ethosu_driver *drv = ethosu_reserve_driver();
- int result = ethosu_invoke(drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr);
+ if (!drv)
+ {
+ return -1;
+ }
+ int result = ethosu_invoke_v3(drv, custom_data_ptr, custom_data_size, base_addr, base_addr_size, num_base_addr, 0);
ethosu_release_driver(drv);
return result;
}
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_types.h b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_types.h
new file mode 100644
index 0000000..a8062dd
--- /dev/null
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/ethosu_types.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+ *
+ * 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_TYPES_H
+#define ETHOSU_TYPES_H
+
+/******************************************************************************
+ * Includes
+ ******************************************************************************/
+
+#include
+
+/******************************************************************************
+ * Types
+ ******************************************************************************/
+
+enum ethosu_error_codes
+{
+ ETHOSU_SUCCESS = 0, ///< Success
+ ETHOSU_GENERIC_FAILURE = -1, ///< Generic failure
+ ETHOSU_INVALID_PARAM = -2 ///< Invalid parameter
+};
+
+enum ethosu_clock_q_request
+{
+ ETHOSU_CLOCK_Q_DISABLE = 0, ///< Disable NPU signal ready for clock off.
+ ETHOSU_CLOCK_Q_ENABLE = 1, ///< Enable NPU signal ready for clock off when stop+idle state reached.
+ ETHOSU_CLOCK_Q_UNCHANGED = 2 ///< Keep current clock q setting
+};
+
+enum ethosu_power_q_request
+{
+ ETHOSU_POWER_Q_DISABLE = 0, ///< Disable NPU signal ready for power off.
+ ETHOSU_POWER_Q_ENABLE = 1, ///< Enable NPU signal ready for power off when stop+idle state reached.
+ ETHOSU_POWER_Q_UNCHANGED = 2 ///< Keep current power q setting
+};
+
+struct ethosu_id
+{
+ uint32_t version_status; ///< Version status
+ uint32_t version_minor; ///< Version minor
+ uint32_t version_major; ///< Version major
+ uint32_t product_major; ///< Product major
+ uint32_t arch_patch_rev; ///< Architecture version patch
+ uint32_t arch_minor_rev; ///< Architecture version minor
+ uint32_t arch_major_rev; ///< Architecture version major
+};
+
+struct ethosu_config
+{
+ uint32_t macs_per_cc; ///< MACs per clock cycle
+ uint32_t cmd_stream_version; ///< NPU command stream version
+ uint32_t custom_dma; ///< Custom DMA enabled
+};
+
+struct ethosu_hw_info
+{
+ struct ethosu_id version;
+ struct ethosu_config cfg;
+};
+#endif // ETHOSU_TYPES_H
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/pmu_ethosu.h b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/pmu_ethosu.h
index acd2a94..b717130 100644
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/pmu_ethosu.h
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/include/pmu_ethosu.h
@@ -1,18 +1,19 @@
/*
- * Copyright (c) 2022 Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2019-2022 Arm Limited and/or its affiliates
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * 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
- * http://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.
+ * www.apache.org/licenses/LICENSE-2.0
*
- * SPDX-License-Identifier: Apache-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 PMU_ETHOSU_H
@@ -104,6 +105,15 @@ enum ethosu_pmu_event_type
ETHOSU_PMU_AXI0_ENABLED_CYCLES,
ETHOSU_PMU_AXI0_RD_STALL_LIMIT,
ETHOSU_PMU_AXI0_WR_STALL_LIMIT,
+ ETHOSU_PMU_AXI_LATENCY_ANY,
+ ETHOSU_PMU_AXI_LATENCY_32,
+ ETHOSU_PMU_AXI_LATENCY_64,
+ ETHOSU_PMU_AXI_LATENCY_128,
+ ETHOSU_PMU_AXI_LATENCY_256,
+ ETHOSU_PMU_AXI_LATENCY_512,
+ ETHOSU_PMU_AXI_LATENCY_1024,
+ ETHOSU_PMU_ECC_DMA,
+ ETHOSU_PMU_ECC_SB0,
ETHOSU_PMU_AXI1_RD_TRANS_ACCEPTED,
ETHOSU_PMU_AXI1_RD_TRANS_COMPLETED,
ETHOSU_PMU_AXI1_RD_DATA_BEAT_RECEIVED,
@@ -117,15 +127,6 @@ enum ethosu_pmu_event_type
ETHOSU_PMU_AXI1_ENABLED_CYCLES,
ETHOSU_PMU_AXI1_RD_STALL_LIMIT,
ETHOSU_PMU_AXI1_WR_STALL_LIMIT,
- ETHOSU_PMU_AXI_LATENCY_ANY,
- ETHOSU_PMU_AXI_LATENCY_32,
- ETHOSU_PMU_AXI_LATENCY_64,
- ETHOSU_PMU_AXI_LATENCY_128,
- ETHOSU_PMU_AXI_LATENCY_256,
- ETHOSU_PMU_AXI_LATENCY_512,
- ETHOSU_PMU_AXI_LATENCY_1024,
- ETHOSU_PMU_ECC_DMA,
- ETHOSU_PMU_ECC_SB0,
ETHOSU_PMU_ECC_SB1,
ETHOSU_PMU_SENTINEL // End-marker (not event)
@@ -152,6 +153,12 @@ void ETHOSU_PMU_Disable(struct ethosu_driver *drv);
*/
void ETHOSU_PMU_Set_EVTYPER(struct ethosu_driver *drv, uint32_t num, enum ethosu_pmu_event_type type);
+/**
+ * \brief Get number of PMU event counters
+ * \return Number of event counters
+ */
+uint32_t ETHOSU_PMU_Get_NumEventCounters(void);
+
/**
* \brief Get event to count for PMU eventer counter
* \param [in] num Event counter (0-ETHOSU_PMU_NCOUNTERS) to configure
@@ -302,6 +309,16 @@ void ETHOSU_PMU_PMCCNTR_CFG_Set_Start_Event(struct ethosu_driver *drv, enum etho
*/
void ETHOSU_PMU_PMCCNTR_CFG_Set_Stop_Event(struct ethosu_driver *drv, enum ethosu_pmu_event_type stop_event);
+/**
+ * \brief Read qread register
+ */
+uint32_t ETHOSU_PMU_Get_QREAD(struct ethosu_driver *drv);
+
+/**
+ * \brief Read status register
+ */
+uint32_t ETHOSU_PMU_Get_STATUS(struct ethosu_driver *drv);
+
#ifdef __cplusplus
}
#endif
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ehtosu_config_u65.h b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ehtosu_config_u65.h
new file mode 100644
index 0000000..b115f43
--- /dev/null
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ehtosu_config_u65.h
@@ -0,0 +1,124 @@
+/*
+ * 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
+
+#endif /* #ifndef ETHOSU_CONFIG_H */
diff --git a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ethosu55_interface.h b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ethosu55_interface.h
index 0d1ee6c..9c0d230 100644
--- a/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ethosu55_interface.h
+++ b/edgeimpulse/edge-impulse-sdk/porting/ethos-core-driver/src/ethosu55_interface.h
@@ -1,5 +1,6 @@
+
/*
- * Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+ * Copyright (c) 2020-2021 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -35,15 +36,32 @@
#define STRUCT struct
#else
#define STRUCT
-#include
#endif
+#if defined(__cplusplus) && defined(NPU_DISASSEMBLE)
+#include
+#include
+#include
+#endif
+
+#if defined(__cplusplus) && !defined(NPU_NAMESPACE)
+#define NPU_NAMESPACE npu
+#endif
+
+#ifdef __cplusplus
+#include
+#include
+#endif
+
+#ifdef __cplusplus
+namespace NPU_NAMESPACE
+{
+#endif
#define NNX_ARCH_VERSION_MAJOR 1
-#define NNX_ARCH_VERSION_MINOR 0
-#define NNX_ARCH_VERSION_PATCH 6
+#define NNX_ARCH_VERSION_MINOR 1
+#define NNX_ARCH_VERSION_PATCH 0
// Register offsets
-
//
// Register subpage BASE
//
@@ -51,8 +69,8 @@
#define NPU_REG_STATUS 0x0004
#define NPU_REG_CMD 0x0008
#define NPU_REG_RESET 0x000C
-#define NPU_REG_QBASE0 0x0010
-#define NPU_REG_QBASE1 0x0014
+#define NPU_REG_QBASE 0x0010
+#define NPU_REG_QBASE_HI 0x0014
#define NPU_REG_QREAD 0x0018
#define NPU_REG_QCONFIG 0x001C
#define NPU_REG_QSIZE 0x0020
@@ -64,28 +82,14 @@
#define NPU_REG_AXI_LIMIT1 0x0044
#define NPU_REG_AXI_LIMIT2 0x0048
#define NPU_REG_AXI_LIMIT3 0x004C
-#define BASE_REGISTERS_SIZE 0x0050
+#define BASE_REGISTERS_SIZE 0x0080
//
// Register subpage BASE_POINTERS
//
-#define NPU_REG_BASEP0 0x0080
-#define NPU_REG_BASEP1 0x0084
-#define NPU_REG_BASEP2 0x0088
-#define NPU_REG_BASEP3 0x008C
-#define NPU_REG_BASEP4 0x0090
-#define NPU_REG_BASEP5 0x0094
-#define NPU_REG_BASEP6 0x0098
-#define NPU_REG_BASEP7 0x009C
-#define NPU_REG_BASEP8 0x00A0
-#define NPU_REG_BASEP9 0x00A4
-#define NPU_REG_BASEP10 0x00A8
-#define NPU_REG_BASEP11 0x00AC
-#define NPU_REG_BASEP12 0x00B0
-#define NPU_REG_BASEP13 0x00B4
-#define NPU_REG_BASEP14 0x00B8
-#define NPU_REG_BASEP15 0x00BC
-#define BASE_POINTERS_REGISTERS_SIZE 0x00C0
+#define NPU_REG_BASEP_BASE 0x0080
+#define NPU_REG_BASEP_ARRLEN 0x0008
+#define BASE_POINTERS_REGISTERS_SIZE 0x0100
//
// Register subpage DEBUG
@@ -98,27 +102,8 @@
#define NPU_REG_CLKFORCE 0x0140
#define NPU_REG_DEBUG_ADDRESS 0x0144
#define NPU_REG_DEBUG_MISC 0x0148
-#define NPU_REG_DEBUGCORE 0x014C
#define NPU_REG_DEBUG_BLOCK 0x0150
-#define DEBUG_REGISTERS_SIZE 0x0154
-
-//
-// Register subpage ID
-//
-#define NPU_REG_REVISION 0x0FC0
-#define NPU_REG_PID4 0x0FD0
-#define NPU_REG_PID5 0x0FD4
-#define NPU_REG_PID6 0x0FD8
-#define NPU_REG_PID7 0x0FDC
-#define NPU_REG_PID0 0x0FE0
-#define NPU_REG_PID1 0x0FE4
-#define NPU_REG_PID2 0x0FE8
-#define NPU_REG_PID3 0x0FEC
-#define NPU_REG_CID0 0x0FF0
-#define NPU_REG_CID1 0x0FF4
-#define NPU_REG_CID2 0x0FF8
-#define NPU_REG_CID3 0x0FFC
-#define ID_REGISTERS_SIZE 0x1000
+#define DEBUG_REGISTERS_SIZE 0x0180
//
// Register subpage PMU
@@ -130,283 +115,72 @@
#define NPU_REG_PMOVSCLR 0x0190
#define NPU_REG_PMINTSET 0x0194
#define NPU_REG_PMINTCLR 0x0198
-#define NPU_REG_PMCCNTR_LO 0x01A0
+#define NPU_REG_PMCCNTR 0x01A0
#define NPU_REG_PMCCNTR_HI 0x01A4
#define NPU_REG_PMCCNTR_CFG 0x01A8
#define NPU_REG_PMCAXI_CHAN 0x01AC
-#define NPU_REG_PMEVCNTR0 0x0300
-#define NPU_REG_PMEVCNTR1 0x0304
-#define NPU_REG_PMEVCNTR2 0x0308
-#define NPU_REG_PMEVCNTR3 0x030C
-#define NPU_REG_PMEVTYPER0 0x0380
-#define NPU_REG_PMEVTYPER1 0x0384
-#define NPU_REG_PMEVTYPER2 0x0388
-#define NPU_REG_PMEVTYPER3 0x038C
-#define PMU_REGISTERS_SIZE 0x0390
+#define PMU_REGISTERS_SIZE 0x0200
+
+//
+// Register subpage TSU_DEBUG
+//
+#define NPU_REG_KERNEL_X 0x0200
+#define NPU_REG_KERNEL_Y 0x0204
+#define NPU_REG_KERNEL_W_M1 0x0208
+#define NPU_REG_KERNEL_H_M1 0x020C
+#define NPU_REG_OFM_CBLK_WIDTH_M1 0x0210
+#define NPU_REG_OFM_CBLK_HEIGHT_M1 0x0214
+#define NPU_REG_OFM_CBLK_DEPTH_M1 0x0218
+#define NPU_REG_IFM_CBLK_DEPTH_M1 0x021C
+#define NPU_REG_OFM_X 0x0220
+#define NPU_REG_OFM_Y 0x0224
+#define NPU_REG_OFM_Z 0x0228
+#define NPU_REG_IFM_Z 0x022C
+#define NPU_REG_PAD_TOP 0x0230
+#define NPU_REG_PAD_LEFT 0x0234
+#define NPU_REG_IFM_CBLK_WIDTH 0x0238
+#define NPU_REG_IFM_CBLK_HEIGHT 0x023C
+#define NPU_REG_DMA_IFM_SRC 0x0240
+#define NPU_REG_DMA_IFM_SRC_HI 0x0244
+#define NPU_REG_DMA_IFM_DST 0x0248
+#define NPU_REG_DMA_OFM_SRC 0x024C
+#define NPU_REG_DMA_OFM_DST 0x0250
+#define NPU_REG_DMA_OFM_DST_HI 0x0254
+#define NPU_REG_DMA_WEIGHT_SRC 0x0258
+#define NPU_REG_DMA_WEIGHT_SRC_HI 0x025C
+#define NPU_REG_DMA_CMD_SRC 0x0260
+#define NPU_REG_DMA_CMD_SRC_HI 0x0264
+#define NPU_REG_DMA_CMD_SIZE 0x0268
+#define NPU_REG_DMA_M2M_SRC 0x026C
+#define NPU_REG_DMA_M2M_SRC_HI 0x0270
+#define NPU_REG_DMA_M2M_DST 0x0274
+#define NPU_REG_DMA_M2M_DST_HI 0x0278
+#define NPU_REG_CURRENT_QREAD 0x027C
+#define NPU_REG_DMA_SCALE_SRC 0x0280
+#define NPU_REG_DMA_SCALE_SRC_HI 0x0284
+#define NPU_REG_CURRENT_BLOCK 0x02B4
+#define NPU_REG_CURRENT_OP 0x02B8
+#define NPU_REG_CURRENT_CMD 0x02BC
+#define TSU_DEBUG_REGISTERS_SIZE 0x02C0
+
+//
+// Register subpage PMU_COUNTERS
+//
+#define NPU_REG_PMEVCNTR_BASE 0x0300
+#define NPU_REG_PMEVCNTR_ARRLEN 0x0004
+#define NPU_REG_PMEVTYPER_BASE 0x0380
+#define NPU_REG_PMEVTYPER_ARRLEN 0x0004
+#define PMU_COUNTERS_REGISTERS_SIZE 0x0400
//
// Register subpage SHARED_BUFFER
//
-#define NPU_REG_SHARED_BUFFER0 0x0400
-#define NPU_REG_SHARED_BUFFER1 0x0404
-#define NPU_REG_SHARED_BUFFER2 0x0408
-#define NPU_REG_SHARED_BUFFER3 0x040C
-#define NPU_REG_SHARED_BUFFER4 0x0410
-#define NPU_REG_SHARED_BUFFER5 0x0414
-#define NPU_REG_SHARED_BUFFER6 0x0418
-#define NPU_REG_SHARED_BUFFER7 0x041C
-#define NPU_REG_SHARED_BUFFER8 0x0420
-#define NPU_REG_SHARED_BUFFER9 0x0424
-#define NPU_REG_SHARED_BUFFER10 0x0428
-#define NPU_REG_SHARED_BUFFER11 0x042C
-#define NPU_REG_SHARED_BUFFER12 0x0430
-#define NPU_REG_SHARED_BUFFER13 0x0434
-#define NPU_REG_SHARED_BUFFER14 0x0438
-#define NPU_REG_SHARED_BUFFER15 0x043C
-#define NPU_REG_SHARED_BUFFER16 0x0440
-#define NPU_REG_SHARED_BUFFER17 0x0444
-#define NPU_REG_SHARED_BUFFER18 0x0448
-#define NPU_REG_SHARED_BUFFER19 0x044C
-#define NPU_REG_SHARED_BUFFER20 0x0450
-#define NPU_REG_SHARED_BUFFER21 0x0454
-#define NPU_REG_SHARED_BUFFER22 0x0458
-#define NPU_REG_SHARED_BUFFER23 0x045C
-#define NPU_REG_SHARED_BUFFER24 0x0460
-#define NPU_REG_SHARED_BUFFER25 0x0464
-#define NPU_REG_SHARED_BUFFER26 0x0468
-#define NPU_REG_SHARED_BUFFER27 0x046C
-#define NPU_REG_SHARED_BUFFER28 0x0470
-#define NPU_REG_SHARED_BUFFER29 0x0474
-#define NPU_REG_SHARED_BUFFER30 0x0478
-#define NPU_REG_SHARED_BUFFER31 0x047C
-#define NPU_REG_SHARED_BUFFER32 0x0480
-#define NPU_REG_SHARED_BUFFER33 0x0484
-#define NPU_REG_SHARED_BUFFER34 0x0488
-#define NPU_REG_SHARED_BUFFER35 0x048C
-#define NPU_REG_SHARED_BUFFER36 0x0490
-#define NPU_REG_SHARED_BUFFER37 0x0494
-#define NPU_REG_SHARED_BUFFER38 0x0498
-#define NPU_REG_SHARED_BUFFER39 0x049C
-#define NPU_REG_SHARED_BUFFER40 0x04A0
-#define NPU_REG_SHARED_BUFFER41 0x04A4
-#define NPU_REG_SHARED_BUFFER42 0x04A8
-#define NPU_REG_SHARED_BUFFER43 0x04AC
-#define NPU_REG_SHARED_BUFFER44 0x04B0
-#define NPU_REG_SHARED_BUFFER45 0x04B4
-#define NPU_REG_SHARED_BUFFER46 0x04B8
-#define NPU_REG_SHARED_BUFFER47 0x04BC
-#define NPU_REG_SHARED_BUFFER48 0x04C0
-#define NPU_REG_SHARED_BUFFER49 0x04C4
-#define NPU_REG_SHARED_BUFFER50 0x04C8
-#define NPU_REG_SHARED_BUFFER51 0x04CC
-#define NPU_REG_SHARED_BUFFER52 0x04D0
-#define NPU_REG_SHARED_BUFFER53 0x04D4
-#define NPU_REG_SHARED_BUFFER54 0x04D8
-#define NPU_REG_SHARED_BUFFER55 0x04DC
-#define NPU_REG_SHARED_BUFFER56 0x04E0
-#define NPU_REG_SHARED_BUFFER57 0x04E4
-#define NPU_REG_SHARED_BUFFER58 0x04E8
-#define NPU_REG_SHARED_BUFFER59 0x04EC
-#define NPU_REG_SHARED_BUFFER60 0x04F0
-#define NPU_REG_SHARED_BUFFER61 0x04F4
-#define NPU_REG_SHARED_BUFFER62 0x04F8
-#define NPU_REG_SHARED_BUFFER63 0x04FC
-#define NPU_REG_SHARED_BUFFER64 0x0500
-#define NPU_REG_SHARED_BUFFER65 0x0504
-#define NPU_REG_SHARED_BUFFER66 0x0508
-#define NPU_REG_SHARED_BUFFER67 0x050C
-#define NPU_REG_SHARED_BUFFER68 0x0510
-#define NPU_REG_SHARED_BUFFER69 0x0514
-#define NPU_REG_SHARED_BUFFER70 0x0518
-#define NPU_REG_SHARED_BUFFER71 0x051C
-#define NPU_REG_SHARED_BUFFER72 0x0520
-#define NPU_REG_SHARED_BUFFER73 0x0524
-#define NPU_REG_SHARED_BUFFER74 0x0528
-#define NPU_REG_SHARED_BUFFER75 0x052C
-#define NPU_REG_SHARED_BUFFER76 0x0530
-#define NPU_REG_SHARED_BUFFER77 0x0534
-#define NPU_REG_SHARED_BUFFER78 0x0538
-#define NPU_REG_SHARED_BUFFER79 0x053C
-#define NPU_REG_SHARED_BUFFER80 0x0540
-#define NPU_REG_SHARED_BUFFER81 0x0544
-#define NPU_REG_SHARED_BUFFER82 0x0548
-#define NPU_REG_SHARED_BUFFER83 0x054C
-#define NPU_REG_SHARED_BUFFER84 0x0550
-#define NPU_REG_SHARED_BUFFER85 0x0554
-#define NPU_REG_SHARED_BUFFER86 0x0558
-#define NPU_REG_SHARED_BUFFER87 0x055C
-#define NPU_REG_SHARED_BUFFER88 0x0560
-#define NPU_REG_SHARED_BUFFER89 0x0564
-#define NPU_REG_SHARED_BUFFER90 0x0568
-#define NPU_REG_SHARED_BUFFER91 0x056C
-#define NPU_REG_SHARED_BUFFER92 0x0570
-#define NPU_REG_SHARED_BUFFER93 0x0574
-#define NPU_REG_SHARED_BUFFER94 0x0578
-#define NPU_REG_SHARED_BUFFER95 0x057C
-#define NPU_REG_SHARED_BUFFER96 0x0580
-#define NPU_REG_SHARED_BUFFER97 0x0584
-#define NPU_REG_SHARED_BUFFER98 0x0588
-#define NPU_REG_SHARED_BUFFER99 0x058C
-#define NPU_REG_SHARED_BUFFER100 0x0590
-#define NPU_REG_SHARED_BUFFER101 0x0594
-#define NPU_REG_SHARED_BUFFER102 0x0598
-#define NPU_REG_SHARED_BUFFER103 0x059C
-#define NPU_REG_SHARED_BUFFER104 0x05A0
-#define NPU_REG_SHARED_BUFFER105 0x05A4
-#define NPU_REG_SHARED_BUFFER106 0x05A8
-#define NPU_REG_SHARED_BUFFER107 0x05AC
-#define NPU_REG_SHARED_BUFFER108 0x05B0
-#define NPU_REG_SHARED_BUFFER109 0x05B4
-#define NPU_REG_SHARED_BUFFER110 0x05B8
-#define NPU_REG_SHARED_BUFFER111 0x05BC
-#define NPU_REG_SHARED_BUFFER112 0x05C0
-#define NPU_REG_SHARED_BUFFER113 0x05C4
-#define NPU_REG_SHARED_BUFFER114 0x05C8
-#define NPU_REG_SHARED_BUFFER115 0x05CC
-#define NPU_REG_SHARED_BUFFER116 0x05D0
-#define NPU_REG_SHARED_BUFFER117 0x05D4
-#define NPU_REG_SHARED_BUFFER118 0x05D8
-#define NPU_REG_SHARED_BUFFER119 0x05DC
-#define NPU_REG_SHARED_BUFFER120 0x05E0
-#define NPU_REG_SHARED_BUFFER121 0x05E4
-#define NPU_REG_SHARED_BUFFER122 0x05E8
-#define NPU_REG_SHARED_BUFFER123 0x05EC
-#define NPU_REG_SHARED_BUFFER124 0x05F0
-#define NPU_REG_SHARED_BUFFER125 0x05F4
-#define NPU_REG_SHARED_BUFFER126 0x05F8
-#define NPU_REG_SHARED_BUFFER127 0x05FC
-#define NPU_REG_SHARED_BUFFER128 0x0600
-#define NPU_REG_SHARED_BUFFER129 0x0604
-#define NPU_REG_SHARED_BUFFER130 0x0608
-#define NPU_REG_SHARED_BUFFER131 0x060C
-#define NPU_REG_SHARED_BUFFER132 0x0610
-#define NPU_REG_SHARED_BUFFER133 0x0614
-#define NPU_REG_SHARED_BUFFER134 0x0618
-#define NPU_REG_SHARED_BUFFER135 0x061C
-#define NPU_REG_SHARED_BUFFER136 0x0620
-#define NPU_REG_SHARED_BUFFER137 0x0624
-#define NPU_REG_SHARED_BUFFER138 0x0628
-#define NPU_REG_SHARED_BUFFER139 0x062C
-#define NPU_REG_SHARED_BUFFER140 0x0630
-#define NPU_REG_SHARED_BUFFER141 0x0634
-#define NPU_REG_SHARED_BUFFER142 0x0638
-#define NPU_REG_SHARED_BUFFER143 0x063C
-#define NPU_REG_SHARED_BUFFER144 0x0640
-#define NPU_REG_SHARED_BUFFER145 0x0644
-#define NPU_REG_SHARED_BUFFER146 0x0648
-#define NPU_REG_SHARED_BUFFER147 0x064C
-#define NPU_REG_SHARED_BUFFER148 0x0650
-#define NPU_REG_SHARED_BUFFER149 0x0654
-#define NPU_REG_SHARED_BUFFER150 0x0658
-#define NPU_REG_SHARED_BUFFER151 0x065C
-#define NPU_REG_SHARED_BUFFER152 0x0660
-#define NPU_REG_SHARED_BUFFER153 0x0664
-#define NPU_REG_SHARED_BUFFER154 0x0668
-#define NPU_REG_SHARED_BUFFER155 0x066C
-#define NPU_REG_SHARED_BUFFER156 0x0670
-#define NPU_REG_SHARED_BUFFER157 0x0674
-#define NPU_REG_SHARED_BUFFER158 0x0678
-#define NPU_REG_SHARED_BUFFER159 0x067C
-#define NPU_REG_SHARED_BUFFER160 0x0680
-#define NPU_REG_SHARED_BUFFER161 0x0684
-#define NPU_REG_SHARED_BUFFER162 0x0688
-#define NPU_REG_SHARED_BUFFER163 0x068C
-#define NPU_REG_SHARED_BUFFER164 0x0690
-#define NPU_REG_SHARED_BUFFER165 0x0694
-#define NPU_REG_SHARED_BUFFER166 0x0698
-#define NPU_REG_SHARED_BUFFER167 0x069C
-#define NPU_REG_SHARED_BUFFER168 0x06A0
-#define NPU_REG_SHARED_BUFFER169 0x06A4
-#define NPU_REG_SHARED_BUFFER170 0x06A8
-#define NPU_REG_SHARED_BUFFER171 0x06AC
-#define NPU_REG_SHARED_BUFFER172 0x06B0
-#define NPU_REG_SHARED_BUFFER173 0x06B4
-#define NPU_REG_SHARED_BUFFER174 0x06B8
-#define NPU_REG_SHARED_BUFFER175 0x06BC
-#define NPU_REG_SHARED_BUFFER176 0x06C0
-#define NPU_REG_SHARED_BUFFER177 0x06C4
-#define NPU_REG_SHARED_BUFFER178 0x06C8
-#define NPU_REG_SHARED_BUFFER179 0x06CC
-#define NPU_REG_SHARED_BUFFER180 0x06D0
-#define NPU_REG_SHARED_BUFFER181 0x06D4
-#define NPU_REG_SHARED_BUFFER182 0x06D8
-#define NPU_REG_SHARED_BUFFER183 0x06DC
-#define NPU_REG_SHARED_BUFFER184 0x06E0
-#define NPU_REG_SHARED_BUFFER185 0x06E4
-#define NPU_REG_SHARED_BUFFER186 0x06E8
-#define NPU_REG_SHARED_BUFFER187 0x06EC
-#define NPU_REG_SHARED_BUFFER188 0x06F0
-#define NPU_REG_SHARED_BUFFER189 0x06F4
-#define NPU_REG_SHARED_BUFFER190 0x06F8
-#define NPU_REG_SHARED_BUFFER191 0x06FC
-#define NPU_REG_SHARED_BUFFER192 0x0700
-#define NPU_REG_SHARED_BUFFER193 0x0704
-#define NPU_REG_SHARED_BUFFER194 0x0708
-#define NPU_REG_SHARED_BUFFER195 0x070C
-#define NPU_REG_SHARED_BUFFER196 0x0710
-#define NPU_REG_SHARED_BUFFER197 0x0714
-#define NPU_REG_SHARED_BUFFER198 0x0718
-#define NPU_REG_SHARED_BUFFER199 0x071C
-#define NPU_REG_SHARED_BUFFER200 0x0720
-#define NPU_REG_SHARED_BUFFER201 0x0724
-#define NPU_REG_SHARED_BUFFER202 0x0728
-#define NPU_REG_SHARED_BUFFER203 0x072C
-#define NPU_REG_SHARED_BUFFER204 0x0730
-#define NPU_REG_SHARED_BUFFER205 0x0734
-#define NPU_REG_SHARED_BUFFER206 0x0738
-#define NPU_REG_SHARED_BUFFER207 0x073C
-#define NPU_REG_SHARED_BUFFER208 0x0740
-#define NPU_REG_SHARED_BUFFER209 0x0744
-#define NPU_REG_SHARED_BUFFER210 0x0748
-#define NPU_REG_SHARED_BUFFER211 0x074C
-#define NPU_REG_SHARED_BUFFER212 0x0750
-#define NPU_REG_SHARED_BUFFER213 0x0754
-#define NPU_REG_SHARED_BUFFER214 0x0758
-#define NPU_REG_SHARED_BUFFER215 0x075C
-#define NPU_REG_SHARED_BUFFER216 0x0760
-#define NPU_REG_SHARED_BUFFER217 0x0764
-#define NPU_REG_SHARED_BUFFER218 0x0768
-#define NPU_REG_SHARED_BUFFER219 0x076C
-#define NPU_REG_SHARED_BUFFER220 0x0770
-#define NPU_REG_SHARED_BUFFER221 0x0774
-#define NPU_REG_SHARED_BUFFER222 0x0778
-#define NPU_REG_SHARED_BUFFER223 0x077C
-#define NPU_REG_SHARED_BUFFER224 0x0780
-#define NPU_REG_SHARED_BUFFER225 0x0784
-#define NPU_REG_SHARED_BUFFER226 0x0788
-#define NPU_REG_SHARED_BUFFER227 0x078C
-#define NPU_REG_SHARED_BUFFER228 0x0790
-#define NPU_REG_SHARED_BUFFER229 0x0794
-#define NPU_REG_SHARED_BUFFER230 0x0798
-#define NPU_REG_SHARED_BUFFER231 0x079C
-#define NPU_REG_SHARED_BUFFER232 0x07A0
-#define NPU_REG_SHARED_BUFFER233 0x07A4
-#define NPU_REG_SHARED_BUFFER234 0x07A8
-#define NPU_REG_SHARED_BUFFER235 0x07AC
-#define NPU_REG_SHARED_BUFFER236 0x07B0
-#define NPU_REG_SHARED_BUFFER237 0x07B4
-#define NPU_REG_SHARED_BUFFER238 0x07B8
-#define NPU_REG_SHARED_BUFFER239 0x07BC
-#define NPU_REG_SHARED_BUFFER240 0x07C0
-#define NPU_REG_SHARED_BUFFER241 0x07C4
-#define NPU_REG_SHARED_BUFFER242 0x07C8
-#define NPU_REG_SHARED_BUFFER243 0x07CC
-#define NPU_REG_SHARED_BUFFER244 0x07D0
-#define NPU_REG_SHARED_BUFFER245 0x07D4
-#define NPU_REG_SHARED_BUFFER246 0x07D8
-#define NPU_REG_SHARED_BUFFER247 0x07DC
-#define NPU_REG_SHARED_BUFFER248 0x07E0
-#define NPU_REG_SHARED_BUFFER249 0x07E4
-#define NPU_REG_SHARED_BUFFER250 0x07E8
-#define NPU_REG_SHARED_BUFFER251 0x07EC
-#define NPU_REG_SHARED_BUFFER252 0x07F0
-#define NPU_REG_SHARED_BUFFER253 0x07F4
-#define NPU_REG_SHARED_BUFFER254 0x07F8
-#define NPU_REG_SHARED_BUFFER255 0x07FC
+#define NPU_REG_SHARED_BUFFER_BASE 0x0400
+#define NPU_REG_SHARED_BUFFER_ARRLEN 0x0100
#define SHARED_BUFFER_REGISTERS_SIZE 0x0800
//
-// Register subpage TSU
+// Register subpage TSU_IFM
//
#define NPU_REG_IFM_PAD_TOP 0x0800
#define NPU_REG_IFM_PAD_LEFT 0x0804
@@ -421,6 +195,11 @@
#define NPU_REG_IFM_HEIGHT1_M1 0x0830
#define NPU_REG_IFM_IB_END 0x0834
#define NPU_REG_IFM_REGION 0x083C
+#define TSU_IFM_REGISTERS_SIZE 0x0840
+
+//
+// Register subpage TSU_OFM
+//
#define NPU_REG_OFM_WIDTH_M1 0x0844
#define NPU_REG_OFM_HEIGHT_M1 0x0848
#define NPU_REG_OFM_DEPTH_M1 0x084C
@@ -433,10 +212,14 @@
#define NPU_REG_OFM_HEIGHT0_M1 0x086C
#define NPU_REG_OFM_HEIGHT1_M1 0x0870
#define NPU_REG_OFM_REGION 0x087C
+#define TSU_OFM_REGISTERS_SIZE 0x0880
+
+//
+// Register subpage TSU_KERNEL
+//
#define NPU_REG_KERNEL_WIDTH_M1 0x0880
#define NPU_REG_KERNEL_HEIGHT_M1 0x0884
#define NPU_REG_KERNEL_STRIDE 0x0888
-#define NPU_REG_PARALLEL_MODE 0x088C
#define NPU_REG_ACC_FORMAT 0x0890
#define NPU_REG_ACTIVATION 0x0894
#define NPU_REG_ACTIVATION_MIN 0x0898
@@ -445,10 +228,20 @@
#define NPU_REG_SCALE_REGION 0x08A4
#define NPU_REG_AB_START 0x08B4
#define NPU_REG_BLOCKDEP 0x08BC
+#define TSU_KERNEL_REGISTERS_SIZE 0x08C0
+
+//
+// Register subpage TSU_DMA
+//
#define NPU_REG_DMA0_SRC_REGION 0x08C0
#define NPU_REG_DMA0_DST_REGION 0x08C4
#define NPU_REG_DMA0_SIZE0 0x08C8
#define NPU_REG_DMA0_SIZE1 0x08CC
+#define TSU_DMA_REGISTERS_SIZE 0x0900
+
+//
+// Register subpage TSU_IFM2
+//
#define NPU_REG_IFM2_BROADCAST 0x0900
#define NPU_REG_IFM2_SCALAR 0x0904
#define NPU_REG_IFM2_PRECISION 0x0914
@@ -458,6 +251,11 @@
#define NPU_REG_IFM2_HEIGHT1_M1 0x0930
#define NPU_REG_IFM2_IB_START 0x0934
#define NPU_REG_IFM2_REGION 0x093C
+#define TSU_IFM2_REGISTERS_SIZE 0x0940
+
+//
+// Register subpage TSU_IFM_BASE
+//
#define NPU_REG_IFM_BASE0 0x0A00
#define NPU_REG_IFM_BASE0_HI 0x0A04
#define NPU_REG_IFM_BASE1 0x0A08
@@ -472,6 +270,11 @@
#define NPU_REG_IFM_STRIDE_Y_HI 0x0A2C
#define NPU_REG_IFM_STRIDE_C 0x0A30
#define NPU_REG_IFM_STRIDE_C_HI 0x0A34
+#define TSU_IFM_BASE_REGISTERS_SIZE 0x0A40
+
+//
+// Register subpage TSU_OFM_BASE
+//
#define NPU_REG_OFM_BASE0 0x0A40
#define NPU_REG_OFM_BASE0_HI 0x0A44
#define NPU_REG_OFM_BASE1 0x0A48
@@ -486,27 +289,40 @@
#define NPU_REG_OFM_STRIDE_Y_HI 0x0A6C
#define NPU_REG_OFM_STRIDE_C 0x0A70
#define NPU_REG_OFM_STRIDE_C_HI 0x0A74
+#define TSU_OFM_BASE_REGISTERS_SIZE 0x0A80
+
+//
+// Register subpage TSU_WS_BASE
+//
#define NPU_REG_WEIGHT_BASE 0x0A80
#define NPU_REG_WEIGHT_BASE_HI 0x0A84
#define NPU_REG_WEIGHT_LENGTH 0x0A88
+#define NPU_REG_WEIGHT_LENGTH_HI 0x0A8C
#define NPU_REG_SCALE_BASE 0x0A90
#define NPU_REG_SCALE_BASE_HI 0x0A94
#define NPU_REG_SCALE_LENGTH 0x0A98
+#define NPU_REG_SCALE_LENGTH_HI 0x0A9C
#define NPU_REG_OFM_SCALE 0x0AA0
#define NPU_REG_OFM_SCALE_SHIFT 0x0AA4
#define NPU_REG_OPA_SCALE 0x0AA8
#define NPU_REG_OPA_SCALE_SHIFT 0x0AAC
#define NPU_REG_OPB_SCALE 0x0AB0
+#define TSU_WS_BASE_REGISTERS_SIZE 0x0AC0
+
+//
+// Register subpage TSU_DMA_BASE
+//
#define NPU_REG_DMA0_SRC 0x0AC0
#define NPU_REG_DMA0_SRC_HI 0x0AC4
#define NPU_REG_DMA0_DST 0x0AC8
#define NPU_REG_DMA0_DST_HI 0x0ACC
#define NPU_REG_DMA0_LEN 0x0AD0
#define NPU_REG_DMA0_LEN_HI 0x0AD4
-#define NPU_REG_DMA0_SKIP0 0x0AD8
-#define NPU_REG_DMA0_SKIP0_HI 0x0ADC
-#define NPU_REG_DMA0_SKIP1 0x0AE0
-#define NPU_REG_DMA0_SKIP1_HI 0x0AE4
+#define TSU_DMA_BASE_REGISTERS_SIZE 0x0B00
+
+//
+// Register subpage TSU_IFM2_BASE
+//
#define NPU_REG_IFM2_BASE0 0x0B00
#define NPU_REG_IFM2_BASE0_HI 0x0B04
#define NPU_REG_IFM2_BASE1 0x0B08
@@ -521,97 +337,53 @@
#define NPU_REG_IFM2_STRIDE_Y_HI 0x0B2C
#define NPU_REG_IFM2_STRIDE_C 0x0B30
#define NPU_REG_IFM2_STRIDE_C_HI 0x0B34
-#define NPU_REG_WEIGHT1_BASE 0x0B40
-#define NPU_REG_WEIGHT1_BASE_HI 0x0B44
-#define NPU_REG_WEIGHT1_LENGTH 0x0B48
-#define NPU_REG_SCALE1_BASE 0x0B50
-#define NPU_REG_SCALE1_BASE_HI 0x0B54
-#define NPU_REG_SCALE1_LENGTH 0x0B58
-#define TSU_REGISTERS_SIZE 0x0B5C
+#define TSU_IFM2_BASE_REGISTERS_SIZE 0x0B40
//
-// Register subpage TSU_DEBUG
+// Register subpage TSU_WS1_BASE
//
-#define NPU_REG_KERNEL_X 0x0200
-#define NPU_REG_KERNEL_Y 0x0204
-#define NPU_REG_KERNEL_W_M1 0x0208
-#define NPU_REG_KERNEL_H_M1 0x020C
-#define NPU_REG_OFM_CBLK_WIDTH_M1 0x0210
-#define NPU_REG_OFM_CBLK_HEIGHT_M1 0x0214
-#define NPU_REG_OFM_CBLK_DEPTH_M1 0x0218
-#define NPU_REG_IFM_CBLK_DEPTH_M1 0x021C
-#define NPU_REG_OFM_X 0x0220
-#define NPU_REG_OFM_Y 0x0224
-#define NPU_REG_OFM_Z 0x0228
-#define NPU_REG_IFM_Z 0x022C
-#define NPU_REG_PAD_TOP 0x0230
-#define NPU_REG_PAD_LEFT 0x0234
-#define NPU_REG_IFM_CBLK_WIDTH 0x0238
-#define NPU_REG_IFM_CBLK_HEIGHT 0x023C
-#define NPU_REG_DMA_IFM_SRC 0x0240
-#define NPU_REG_DMA_IFM_SRC_HI 0x0244
-#define NPU_REG_DMA_IFM_DST 0x0248
-#define NPU_REG_DMA_OFM_SRC 0x024C
-#define NPU_REG_DMA_OFM_DST 0x0250
-#define NPU_REG_DMA_OFM_DST_HI 0x0254
-#define NPU_REG_DMA_WEIGHT_SRC 0x0258
-#define NPU_REG_DMA_WEIGHT_SRC_HI 0x025C
-#define NPU_REG_DMA_CMD_SRC 0x0260
-#define NPU_REG_DMA_CMD_SRC_HI 0x0264
-#define NPU_REG_DMA_CMD_SIZE 0x0268
-#define NPU_REG_DMA_M2M_SRC 0x026C
-#define NPU_REG_DMA_M2M_SRC_HI 0x0270
-#define NPU_REG_DMA_M2M_DST 0x0274
-#define NPU_REG_DMA_M2M_DST_HI 0x0278
-#define NPU_REG_CURRENT_QREAD 0x027C
-#define NPU_REG_DMA_SCALE_SRC 0x0280
-#define NPU_REG_DMA_SCALE_SRC_HI 0x0284
-#define NPU_REG_CURRENT_BLOCK 0x02B4
-#define NPU_REG_CURRENT_OP 0x02B8
-#define NPU_REG_CURRENT_CMD 0x02BC
-#define TSU_DEBUG_REGISTERS_SIZE 0x02C0
-
-#ifdef __cplusplus
+#define TSU_WS1_BASE_REGISTERS_SIZE 0x0B80
-// Enum types
+//
+// Register subpage TSU_USER_BASE
+//
+#define NPU_REG_USER_DEFINED_BASE 0x0B80
+#define NPU_REG_USER_DEFINED_ARRLEN 0x0008
+#define TSU_USER_BASE_REGISTERS_SIZE 0x0BC0
-enum class acc_format : uint16_t
-{
- INT_32BIT = 0,
- INT_40BIT = 1,
- FP_S5_10 = 2,
-};
+//
+// Register subpage TSU_DMA_EBASE
+//
+#define TSU_DMA_EBASE_REGISTERS_SIZE 0x0C00
-enum class activation : uint16_t
-{
- NONE = 0,
- TANH = 3,
- SIGMOID = 4,
- LUT_START = 16,
- LUT_END = 23,
-};
+//
+// Register subpage ID
+//
+#define NPU_REG_REVISION 0x0FC0
+#define NPU_REG_PID4 0x0FD0
+#define NPU_REG_PID5 0x0FD4
+#define NPU_REG_PID6 0x0FD8
+#define NPU_REG_PID7 0x0FDC
+#define NPU_REG_PID0 0x0FE0
+#define NPU_REG_PID1 0x0FE4
+#define NPU_REG_PID2 0x0FE8
+#define NPU_REG_PID3 0x0FEC
+#define NPU_REG_CID0 0x0FF0
+#define NPU_REG_CID1 0x0FF4
+#define NPU_REG_CID2 0x0FF8
+#define NPU_REG_CID3 0x0FFC
+#define ID_REGISTERS_SIZE 0x1000
-enum class axi_mem_encoding_type : uint8_t
+#ifdef __cplusplus
+// Enum types
+enum class acc_format : uint8_t
{
- DEVICE_NON_BUFFERABLE = 0x0,
- DEVICE_BUFFERABLE = 0x1,
- NORMAL_NON_CACHEABLE_NON_BUFFERABLE = 0x2,
- NORMAL_NON_CACHEABLE_BUFFERABLE = 0x3,
- WRITE_THROUGH_NO_ALLOCATE = 0x4,
- WRITE_THROUGH_READ_ALLOCATE = 0x5,
- WRITE_THROUGH_WRITE_ALLOCATE = 0x6,
- WRITE_THROUGH_READ_AND_WRITE_ALLOCATE = 0x7,
- WRITE_BACK_NO_ALLOCATE = 0x8,
- WRITE_BACK_READ_ALLOCATE = 0x9,
- WRITE_BACK_WRITE_ALLOCATE = 0xA,
- WRITE_BACK_READ_AND_WRITE_ALLOCATE = 0xB,
- RESERVED_12 = 0xC,
- RESERVED_13 = 0xD,
- RESERVED_14 = 0xE,
- RESERVED_15 = 0xF,
+ I32 = 0,
+ I40 = 1,
+ F16 = 2,
};
-enum class clip_range : uint8_t
+enum class activation_clip_range : uint8_t
{
OFM_PRECISION = 0,
FORCE_UINT8 = 2,
@@ -619,656 +391,2100 @@ enum class clip_range : uint8_t
FORCE_INT16 = 5,
};
-enum class cmd0 : uint16_t
-{
- NPU_OP_STOP = 0x000,
- NPU_OP_IRQ = 0x001,
- NPU_OP_CONV = 0x002,
- NPU_OP_DEPTHWISE = 0x003,
- NPU_OP_POOL = 0x005,
- NPU_OP_ELEMENTWISE = 0x006,
- NPU_OP_DMA_START = 0x010,
- NPU_OP_DMA_WAIT = 0x011,
- NPU_OP_KERNEL_WAIT = 0x012,
- NPU_OP_PMU_MASK = 0x013,
- NPU_SET_IFM_PAD_TOP = 0x100,
- NPU_SET_IFM_PAD_LEFT = 0x101,
- NPU_SET_IFM_PAD_RIGHT = 0x102,
- NPU_SET_IFM_PAD_BOTTOM = 0x103,
- NPU_SET_IFM_DEPTH_M1 = 0x104,
- NPU_SET_IFM_PRECISION = 0x105,
- NPU_SET_IFM_UPSCALE = 0x107,
- NPU_SET_IFM_ZERO_POINT = 0x109,
- NPU_SET_IFM_WIDTH0_M1 = 0x10A,
- NPU_SET_IFM_HEIGHT0_M1 = 0x10B,
- NPU_SET_IFM_HEIGHT1_M1 = 0x10C,
- NPU_SET_IFM_IB_END = 0x10D,
- NPU_SET_IFM_REGION = 0x10F,
- NPU_SET_OFM_WIDTH_M1 = 0x111,
- NPU_SET_OFM_HEIGHT_M1 = 0x112,
- NPU_SET_OFM_DEPTH_M1 = 0x113,
- NPU_SET_OFM_PRECISION = 0x114,
- NPU_SET_OFM_BLK_WIDTH_M1 = 0x115,
- NPU_SET_OFM_BLK_HEIGHT_M1 = 0x116,
- NPU_SET_OFM_BLK_DEPTH_M1 = 0x117,
- NPU_SET_OFM_ZERO_POINT = 0x118,
- NPU_SET_OFM_WIDTH0_M1 = 0x11A,
- NPU_SET_OFM_HEIGHT0_M1 = 0x11B,
- NPU_SET_OFM_HEIGHT1_M1 = 0x11C,
- NPU_SET_OFM_REGION = 0x11F,
- NPU_SET_KERNEL_WIDTH_M1 = 0x120,
- NPU_SET_KERNEL_HEIGHT_M1 = 0x121,
- NPU_SET_KERNEL_STRIDE = 0x122,
- NPU_SET_PARALLEL_MODE = 0x123,
- NPU_SET_ACC_FORMAT = 0x124,
- NPU_SET_ACTIVATION = 0x125,
- NPU_SET_ACTIVATION_MIN = 0x126,
- NPU_SET_ACTIVATION_MAX = 0x127,
- NPU_SET_WEIGHT_REGION = 0x128,
- NPU_SET_SCALE_REGION = 0x129,
- NPU_SET_AB_START = 0x12D,
- NPU_SET_BLOCKDEP = 0x12F,
- NPU_SET_DMA0_SRC_REGION = 0x130,
- NPU_SET_DMA0_DST_REGION = 0x131,
- NPU_SET_DMA0_SIZE0 = 0x132,
- NPU_SET_DMA0_SIZE1 = 0x133,
- NPU_SET_IFM2_BROADCAST = 0x180,
- NPU_SET_IFM2_SCALAR = 0x181,
- NPU_SET_IFM2_PRECISION = 0x185,
- NPU_SET_IFM2_ZERO_POINT = 0x189,
- NPU_SET_IFM2_WIDTH0_M1 = 0x18A,
- NPU_SET_IFM2_HEIGHT0_M1 = 0x18B,
- NPU_SET_IFM2_HEIGHT1_M1 = 0x18C,
- NPU_SET_IFM2_IB_START = 0x18D,
- NPU_SET_IFM2_REGION = 0x18F,
-};
-
-enum class cmd1 : uint16_t
-{
- NPU_SET_IFM_BASE0 = 0x000,
- NPU_SET_IFM_BASE1 = 0x001,
- NPU_SET_IFM_BASE2 = 0x002,
- NPU_SET_IFM_BASE3 = 0x003,
- NPU_SET_IFM_STRIDE_X = 0x004,
- NPU_SET_IFM_STRIDE_Y = 0x005,
- NPU_SET_IFM_STRIDE_C = 0x006,
- NPU_SET_OFM_BASE0 = 0x010,
- NPU_SET_OFM_BASE1 = 0x011,
- NPU_SET_OFM_BASE2 = 0x012,
- NPU_SET_OFM_BASE3 = 0x013,
- NPU_SET_OFM_STRIDE_X = 0x014,
- NPU_SET_OFM_STRIDE_Y = 0x015,
- NPU_SET_OFM_STRIDE_C = 0x016,
- NPU_SET_WEIGHT_BASE = 0x020,
- NPU_SET_WEIGHT_LENGTH = 0x021,
- NPU_SET_SCALE_BASE = 0x022,
- NPU_SET_SCALE_LENGTH = 0x023,
- NPU_SET_OFM_SCALE = 0x024,
- NPU_SET_OPA_SCALE = 0x025,
- NPU_SET_OPB_SCALE = 0x026,
- NPU_SET_DMA0_SRC = 0x030,
- NPU_SET_DMA0_DST = 0x031,
- NPU_SET_DMA0_LEN = 0x032,
- NPU_SET_DMA0_SKIP0 = 0x033,
- NPU_SET_DMA0_SKIP1 = 0x034,
- NPU_SET_IFM2_BASE0 = 0x080,
- NPU_SET_IFM2_BASE1 = 0x081,
- NPU_SET_IFM2_BASE2 = 0x082,
- NPU_SET_IFM2_BASE3 = 0x083,
- NPU_SET_IFM2_STRIDE_X = 0x084,
- NPU_SET_IFM2_STRIDE_Y = 0x085,
- NPU_SET_IFM2_STRIDE_C = 0x086,
- NPU_SET_WEIGHT1_BASE = 0x090,
- NPU_SET_WEIGHT1_LENGTH = 0x091,
- NPU_SET_SCALE1_BASE = 0x092,
- NPU_SET_SCALE1_LENGTH = 0x093,
-};
-
-enum class data_format : uint8_t
+enum class activation_format : uint8_t
{
NHWC = 0,
NHCWB16 = 1,
};
-enum class elementwise_mode : uint16_t
+enum class activation_function : uint8_t
{
- MUL = 0,
- ADD = 1,
- SUB = 2,
- MIN = 3,
- MAX = 4,
- LRELU = 5,
- ABS = 6,
- CLZ = 7,
- SHR = 8,
- SHL = 9,
+ RELU = 0,
+ TANH = 3,
+ SIGMOID = 4,
+ TABLE_0 = 16,
+ TABLE_1 = 17,
+ TABLE_2 = 18,
+ TABLE_3 = 19,
+ TABLE_4 = 20,
+ TABLE_5 = 21,
+ TABLE_6 = 22,
+ TABLE_7 = 23,
};
-enum class ifm_precision : uint8_t
+enum class activation_precision : uint8_t
{
- U8 = 0,
- S8 = 1,
- U16 = 4,
- S16 = 5,
- S32 = 9,
+ B8 = 0,
+ B16 = 1,
+ B32 = 2,
+ B64 = 3,
};
-enum class ifm_scale_mode : uint8_t
+enum class activation_type : uint8_t
{
- SCALE_16BIT = 0,
- SCALE_OPA_32BIT = 1,
- SCALE_OPB_32BIT = 2,
+ UNSIGNED = 0,
+ SIGNED = 1,
};
-enum class macs_per_cc : uint8_t
+enum class axi_mem_encoding : uint8_t
{
- MACS_PER_CC_IS_5 = 0x5,
- MACS_PER_CC_IS_6 = 0x6,
- MACS_PER_CC_IS_7 = 0x7,
- MACS_PER_CC_IS_8 = 0x8,
+ DEVICE_NON_BUFFERABLE = 0,
+ DEVICE_BUFFERABLE = 1,
+ NORMAL_NON_CACHEABLE_NON_BUFFERABLE = 2,
+ NORMAL_NON_CACHEABLE_BUFFERABLE = 3,
+ WRITE_THROUGH_NO_ALLOCATE = 4,
+ WRITE_THROUGH_READ_ALLOCATE = 5,
+ WRITE_THROUGH_WRITE_ALLOCATE = 6,
+ WRITE_THROUGH_READ_AND_WRITE_ALLOCATE = 7,
+ WRITE_BACK_NO_ALLOCATE = 8,
+ WRITE_BACK_READ_ALLOCATE = 9,
+ WRITE_BACK_WRITE_ALLOCATE = 10,
+ WRITE_BACK_READ_AND_WRITE_ALLOCATE = 11,
};
-enum class memory_type : uint8_t
+enum class broadcast_mode : uint8_t
{
- AXI0_OUTSTANDING_COUNTER0 = 0,
- AXI0_OUTSTANDING_COUNTER1 = 1,
- AXI1_OUTSTANDING_COUNTER2 = 2,
- AXI1_OUTSTANDING_COUNTER3 = 3,
+ DISABLE = 0,
+ ENABLE = 1,
};
-enum class ofm_precision : uint8_t
-{
- U8 = 0,
- S8 = 1,
- U16 = 2,
- S16 = 3,
- S32 = 5,
-};
-
-enum class pmu_event_type : uint16_t
-{
- NO_EVENT = 0x00,
- CYCLE = 0x11,
- NPU_IDLE = 0x20,
- CC_STALLED_ON_BLOCKDEP = 0x21,
- CC_STALLED_ON_SHRAM_RECONFIG = 0x22,
- NPU_ACTIVE = 0x23,
- MAC_ACTIVE = 0x30,
- MAC_ACTIVE_8BIT = 0x31,
- MAC_ACTIVE_16BIT = 0x32,
- MAC_DPU_ACTIVE = 0x33,
- MAC_STALLED_BY_WD_ACC = 0x34,
- MAC_STALLED_BY_WD = 0x35,
- MAC_STALLED_BY_ACC = 0x36,
- MAC_STALLED_BY_IB = 0x37,
- MAC_ACTIVE_32BIT = 0x38,
- MAC_STALLED_BY_INT_W = 0x39,
- MAC_STALLED_BY_INT_ACC = 0x3A,
- AO_ACTIVE = 0x40,
- AO_ACTIVE_8BIT = 0x41,
- AO_ACTIVE_16BIT = 0x42,
- AO_STALLED_BY_OFMP_OB = 0x43,
- AO_STALLED_BY_OFMP = 0x44,
- AO_STALLED_BY_OB = 0x45,
- AO_STALLED_BY_ACC_IB = 0x46,
- AO_STALLED_BY_ACC = 0x47,
- AO_STALLED_BY_IB = 0x48,
- WD_ACTIVE = 0x50,
- WD_STALLED = 0x51,
- WD_STALLED_BY_WS = 0x52,
- WD_STALLED_BY_WD_BUF = 0x53,
- WD_PARSE_ACTIVE = 0x54,
- WD_PARSE_STALLED = 0x55,
- WD_PARSE_STALLED_IN = 0x56,
- WD_PARSE_STALLED_OUT = 0x57,
- WD_TRANS_WS = 0x58,
- WD_TRANS_WB = 0x59,
- WD_TRANS_DW0 = 0x5a,
- WD_TRANS_DW1 = 0x5b,
- AXI0_RD_TRANS_ACCEPTED = 0x80,
- AXI0_RD_TRANS_COMPLETED = 0x81,
- AXI0_RD_DATA_BEAT_RECEIVED = 0x82,
- AXI0_RD_TRAN_REQ_STALLED = 0x83,
- AXI0_WR_TRANS_ACCEPTED = 0x84,
- AXI0_WR_TRANS_COMPLETED_M = 0x85,
- AXI0_WR_TRANS_COMPLETED_S = 0x86,
- AXI0_WR_DATA_BEAT_WRITTEN = 0x87,
- AXI0_WR_TRAN_REQ_STALLED = 0x88,
- AXI0_WR_DATA_BEAT_STALLED = 0x89,
- AXI0_ENABLED_CYCLES = 0x8c,
- AXI0_RD_STALL_LIMIT = 0x8e,
- AXI0_WR_STALL_LIMIT = 0x8f,
- AXI1_RD_TRANS_ACCEPTED = 0x180,
- AXI1_RD_TRANS_COMPLETED = 0x181,
- AXI1_RD_DATA_BEAT_RECEIVED = 0x182,
- AXI1_RD_TRAN_REQ_STALLED = 0x183,
- AXI1_WR_TRANS_ACCEPTED = 0x184,
- AXI1_WR_TRANS_COMPLETED_M = 0x185,
- AXI1_WR_TRANS_COMPLETED_S = 0x186,
- AXI1_WR_DATA_BEAT_WRITTEN = 0x187,
- AXI1_WR_TRAN_REQ_STALLED = 0x188,
- AXI1_WR_DATA_BEAT_STALLED = 0x189,
- AXI1_ENABLED_CYCLES = 0x18c,
- AXI1_RD_STALL_LIMIT = 0x18e,
- AXI1_WR_STALL_LIMIT = 0x18f,
- AXI_LATENCY_ANY = 0xa0,
- AXI_LATENCY_32 = 0xa1,
- AXI_LATENCY_64 = 0xa2,
- AXI_LATENCY_128 = 0xa3,
- AXI_LATENCY_256 = 0xa4,
- AXI_LATENCY_512 = 0xa5,
- AXI_LATENCY_1024 = 0xa6,
- ECC_DMA = 0xb0,
- ECC_SB0 = 0xb1,
- ECC_SB1 = 0x1b1,
-};
-
-enum class pooling_mode : uint16_t
+enum class cmd0_opcode : uint16_t
{
- MAX = 0,
- AVERAGE = 1,
- REDUCE_SUM = 2,
+ NPU_OP_STOP = 0,
+ NPU_OP_IRQ = 1,
+ NPU_OP_CONV = 2,
+ NPU_OP_DEPTHWISE = 3,
+ NPU_OP_POOL = 5,
+ NPU_OP_ELEMENTWISE = 6,
+ NPU_OP_DMA_START = 16,
+ NPU_OP_DMA_WAIT = 17,
+ NPU_OP_KERNEL_WAIT = 18,
+ NPU_OP_PMU_MASK = 19,
+ NPU_SET_IFM_PAD_TOP = 256,
+ NPU_SET_IFM_PAD_LEFT = 257,
+ NPU_SET_IFM_PAD_RIGHT = 258,
+ NPU_SET_IFM_PAD_BOTTOM = 259,
+ NPU_SET_IFM_DEPTH_M1 = 260,
+ NPU_SET_IFM_PRECISION = 261,
+ NPU_SET_IFM_UPSCALE = 263,
+ NPU_SET_IFM_ZERO_POINT = 265,
+ NPU_SET_IFM_WIDTH0_M1 = 266,
+ NPU_SET_IFM_HEIGHT0_M1 = 267,
+ NPU_SET_IFM_HEIGHT1_M1 = 268,
+ NPU_SET_IFM_IB_END = 269,
+ NPU_SET_IFM_REGION = 271,
+ NPU_SET_OFM_WIDTH_M1 = 273,
+ NPU_SET_OFM_HEIGHT_M1 = 274,
+ NPU_SET_OFM_DEPTH_M1 = 275,
+ NPU_SET_OFM_PRECISION = 276,
+ NPU_SET_OFM_BLK_WIDTH_M1 = 277,
+ NPU_SET_OFM_BLK_HEIGHT_M1 = 278,
+ NPU_SET_OFM_BLK_DEPTH_M1 = 279,
+ NPU_SET_OFM_ZERO_POINT = 280,
+ NPU_SET_OFM_WIDTH0_M1 = 282,
+ NPU_SET_OFM_HEIGHT0_M1 = 283,
+ NPU_SET_OFM_HEIGHT1_M1 = 284,
+ NPU_SET_OFM_REGION = 287,
+ NPU_SET_KERNEL_WIDTH_M1 = 288,
+ NPU_SET_KERNEL_HEIGHT_M1 = 289,
+ NPU_SET_KERNEL_STRIDE = 290,
+ NPU_SET_ACC_FORMAT = 292,
+ NPU_SET_ACTIVATION = 293,
+ NPU_SET_ACTIVATION_MIN = 294,
+ NPU_SET_ACTIVATION_MAX = 295,
+ NPU_SET_WEIGHT_REGION = 296,
+ NPU_SET_SCALE_REGION = 297,
+ NPU_SET_AB_START = 301,
+ NPU_SET_BLOCKDEP = 303,
+ NPU_SET_DMA0_SRC_REGION = 304,
+ NPU_SET_DMA0_DST_REGION = 305,
+ NPU_SET_DMA0_SIZE0 = 306,
+ NPU_SET_DMA0_SIZE1 = 307,
+ NPU_SET_IFM2_BROADCAST = 384,
+ NPU_SET_IFM2_SCALAR = 385,
+ NPU_SET_IFM2_PRECISION = 389,
+ NPU_SET_IFM2_ZERO_POINT = 393,
+ NPU_SET_IFM2_WIDTH0_M1 = 394,
+ NPU_SET_IFM2_HEIGHT0_M1 = 395,
+ NPU_SET_IFM2_HEIGHT1_M1 = 396,
+ NPU_SET_IFM2_IB_START = 397,
+ NPU_SET_IFM2_REGION = 399,
};
-enum class privilege_level : uint8_t
+enum class cmd1_opcode : uint16_t
{
- USER = 0,
- PRIVILEGED = 1,
+ NPU_SET_IFM_BASE0 = 0,
+ NPU_SET_IFM_BASE1 = 1,
+ NPU_SET_IFM_BASE2 = 2,
+ NPU_SET_IFM_BASE3 = 3,
+ NPU_SET_IFM_STRIDE_X = 4,
+ NPU_SET_IFM_STRIDE_Y = 5,
+ NPU_SET_IFM_STRIDE_C = 6,
+ NPU_SET_OFM_BASE0 = 16,
+ NPU_SET_OFM_BASE1 = 17,
+ NPU_SET_OFM_BASE2 = 18,
+ NPU_SET_OFM_BASE3 = 19,
+ NPU_SET_OFM_STRIDE_X = 20,
+ NPU_SET_OFM_STRIDE_Y = 21,
+ NPU_SET_OFM_STRIDE_C = 22,
+ NPU_SET_WEIGHT_BASE = 32,
+ NPU_SET_WEIGHT_LENGTH = 33,
+ NPU_SET_SCALE_BASE = 34,
+ NPU_SET_SCALE_LENGTH = 35,
+ NPU_SET_OFM_SCALE = 36,
+ NPU_SET_OPA_SCALE = 37,
+ NPU_SET_OPB_SCALE = 38,
+ NPU_SET_DMA0_SRC = 48,
+ NPU_SET_DMA0_DST = 49,
+ NPU_SET_DMA0_LEN = 50,
+ NPU_SET_IFM2_BASE0 = 128,
+ NPU_SET_IFM2_BASE1 = 129,
+ NPU_SET_IFM2_BASE2 = 130,
+ NPU_SET_IFM2_BASE3 = 131,
+ NPU_SET_IFM2_STRIDE_X = 132,
+ NPU_SET_IFM2_STRIDE_Y = 133,
+ NPU_SET_IFM2_STRIDE_C = 134,
+ NPU_SET_USER_DEFINED0 = 160,
+ NPU_SET_USER_DEFINED1 = 161,
+ NPU_SET_USER_DEFINED2 = 162,
+ NPU_SET_USER_DEFINED3 = 163,
+ NPU_SET_USER_DEFINED4 = 164,
+ NPU_SET_USER_DEFINED5 = 165,
+ NPU_SET_USER_DEFINED6 = 166,
+ NPU_SET_USER_DEFINED7 = 167,
};
-enum class resampling_mode : uint8_t
+enum class cmd_ctrl : uint8_t
{
- NONE = 0,
- NEAREST = 1,
- TRANSPOSE = 2,
+ CMD0_CTRL = 0,
+ CMD1_CTRL = 1,
};
-enum class rounding : uint8_t
+enum class custom_dma_cs : uint8_t
{
- TFL = 0,
- TRUNCATE = 1,
- NATURAL = 2,
+ DISABLE = 0,
+ ENABLE = 1,
};
-enum class security_level : uint8_t
+enum class custom_dma : uint8_t
{
- SECURE = 0,
- NON_SECURE = 1,
+ NOT_IMPLEMENTED = 0,
+ IMPLEMENTED = 1,
};
-enum class shram_size : uint8_t
+enum class dma_fault_src : uint8_t
{
- SHRAM_96KB = 0x60,
- SHRAM_48KB = 0x30,
- SHRAM_24KB = 0x18,
- SHRAM_16KB = 0x10,
+ AXI_M0 = 0,
+ AXI_M1 = 1,
};
-enum class state : uint8_t
+enum class dma_region_mode : uint8_t
{
- STOPPED = 0,
- RUNNING = 1,
+ EXTERNAL = 0,
+ INTERNAL = 1,
};
-enum class stride_mode : uint8_t
+enum class dma_stride_mode : uint8_t
{
- STRIDE_MODE_1D = 0,
- STRIDE_MODE_2D = 1,
- STRIDE_MODE_3D = 2,
+ D1 = 0,
};
-#else
+enum class elementwise_mode : uint8_t
+{
+ MUL = 0,
+ ADD = 1,
+ SUB = 2,
+ MIN = 3,
+ MAX = 4,
+ LRELU = 5,
+ ABS = 6,
+ CLZ = 7,
+ SHR = 8,
+ SHL = 9,
+};
-enum acc_format
+enum class functional_safety : uint8_t
{
- ACC_FORMAT_INT_32BIT = 0,
- ACC_FORMAT_INT_40BIT = 1,
- ACC_FORMAT_FP_S5_10 = 2,
-};
-
-enum activation
-{
- ACTIVATION_NONE = 0,
- ACTIVATION_TANH = 3,
- ACTIVATION_SIGMOID = 4,
- ACTIVATION_LUT_START = 16,
- ACTIVATION_LUT_END = 23,
-};
-
-enum axi_mem_encoding_type
-{
- AXI_MEM_ENCODING_TYPE_DEVICE_NON_BUFFERABLE = 0x0,
- AXI_MEM_ENCODING_TYPE_DEVICE_BUFFERABLE = 0x1,
- AXI_MEM_ENCODING_TYPE_NORMAL_NON_CACHEABLE_NON_BUFFERABLE = 0x2,
- AXI_MEM_ENCODING_TYPE_NORMAL_NON_CACHEABLE_BUFFERABLE = 0x3,
- AXI_MEM_ENCODING_TYPE_WRITE_THROUGH_NO_ALLOCATE = 0x4,
- AXI_MEM_ENCODING_TYPE_WRITE_THROUGH_READ_ALLOCATE = 0x5,
- AXI_MEM_ENCODING_TYPE_WRITE_THROUGH_WRITE_ALLOCATE = 0x6,
- AXI_MEM_ENCODING_TYPE_WRITE_THROUGH_READ_AND_WRITE_ALLOCATE = 0x7,
- AXI_MEM_ENCODING_TYPE_WRITE_BACK_NO_ALLOCATE = 0x8,
- AXI_MEM_ENCODING_TYPE_WRITE_BACK_READ_ALLOCATE = 0x9,
- AXI_MEM_ENCODING_TYPE_WRITE_BACK_WRITE_ALLOCATE = 0xA,
- AXI_MEM_ENCODING_TYPE_WRITE_BACK_READ_AND_WRITE_ALLOCATE = 0xB,
- AXI_MEM_ENCODING_TYPE_RESERVED_12 = 0xC,
- AXI_MEM_ENCODING_TYPE_RESERVED_13 = 0xD,
- AXI_MEM_ENCODING_TYPE_RESERVED_14 = 0xE,
- AXI_MEM_ENCODING_TYPE_RESERVED_15 = 0xF,
-};
-
-enum clip_range
-{
- CLIP_RANGE_OFM_PRECISION = 0,
- CLIP_RANGE_FORCE_UINT8 = 2,
- CLIP_RANGE_FORCE_INT8 = 3,
- CLIP_RANGE_FORCE_INT16 = 5,
-};
-
-enum cmd0
-{
- CMD0_NPU_OP_STOP = 0x000,
- CMD0_NPU_OP_IRQ = 0x001,
- CMD0_NPU_OP_CONV = 0x002,
- CMD0_NPU_OP_DEPTHWISE = 0x003,
- CMD0_NPU_OP_POOL = 0x005,
- CMD0_NPU_OP_ELEMENTWISE = 0x006,
- CMD0_NPU_OP_DMA_START = 0x010,
- CMD0_NPU_OP_DMA_WAIT = 0x011,
- CMD0_NPU_OP_KERNEL_WAIT = 0x012,
- CMD0_NPU_OP_PMU_MASK = 0x013,
- CMD0_NPU_SET_IFM_PAD_TOP = 0x100,
- CMD0_NPU_SET_IFM_PAD_LEFT = 0x101,
- CMD0_NPU_SET_IFM_PAD_RIGHT = 0x102,
- CMD0_NPU_SET_IFM_PAD_BOTTOM = 0x103,
- CMD0_NPU_SET_IFM_DEPTH_M1 = 0x104,
- CMD0_NPU_SET_IFM_PRECISION = 0x105,
- CMD0_NPU_SET_IFM_UPSCALE = 0x107,
- CMD0_NPU_SET_IFM_ZERO_POINT = 0x109,
- CMD0_NPU_SET_IFM_WIDTH0_M1 = 0x10A,
- CMD0_NPU_SET_IFM_HEIGHT0_M1 = 0x10B,
- CMD0_NPU_SET_IFM_HEIGHT1_M1 = 0x10C,
- CMD0_NPU_SET_IFM_IB_END = 0x10D,
- CMD0_NPU_SET_IFM_REGION = 0x10F,
- CMD0_NPU_SET_OFM_WIDTH_M1 = 0x111,
- CMD0_NPU_SET_OFM_HEIGHT_M1 = 0x112,
- CMD0_NPU_SET_OFM_DEPTH_M1 = 0x113,
- CMD0_NPU_SET_OFM_PRECISION = 0x114,
- CMD0_NPU_SET_OFM_BLK_WIDTH_M1 = 0x115,
- CMD0_NPU_SET_OFM_BLK_HEIGHT_M1 = 0x116,
- CMD0_NPU_SET_OFM_BLK_DEPTH_M1 = 0x117,
- CMD0_NPU_SET_OFM_ZERO_POINT = 0x118,
- CMD0_NPU_SET_OFM_WIDTH0_M1 = 0x11A,
- CMD0_NPU_SET_OFM_HEIGHT0_M1 = 0x11B,
- CMD0_NPU_SET_OFM_HEIGHT1_M1 = 0x11C,
- CMD0_NPU_SET_OFM_REGION = 0x11F,
- CMD0_NPU_SET_KERNEL_WIDTH_M1 = 0x120,
- CMD0_NPU_SET_KERNEL_HEIGHT_M1 = 0x121,
- CMD0_NPU_SET_KERNEL_STRIDE = 0x122,
- CMD0_NPU_SET_PARALLEL_MODE = 0x123,
- CMD0_NPU_SET_ACC_FORMAT = 0x124,
- CMD0_NPU_SET_ACTIVATION = 0x125,
- CMD0_NPU_SET_ACTIVATION_MIN = 0x126,
- CMD0_NPU_SET_ACTIVATION_MAX = 0x127,
- CMD0_NPU_SET_WEIGHT_REGION = 0x128,
- CMD0_NPU_SET_SCALE_REGION = 0x129,
- CMD0_NPU_SET_AB_START = 0x12D,
- CMD0_NPU_SET_BLOCKDEP = 0x12F,
- CMD0_NPU_SET_DMA0_SRC_REGION = 0x130,
- CMD0_NPU_SET_DMA0_DST_REGION = 0x131,
- CMD0_NPU_SET_DMA0_SIZE0 = 0x132,
- CMD0_NPU_SET_DMA0_SIZE1 = 0x133,
- CMD0_NPU_SET_IFM2_BROADCAST = 0x180,
- CMD0_NPU_SET_IFM2_SCALAR = 0x181,
- CMD0_NPU_SET_IFM2_PRECISION = 0x185,
- CMD0_NPU_SET_IFM2_ZERO_POINT = 0x189,
- CMD0_NPU_SET_IFM2_WIDTH0_M1 = 0x18A,
- CMD0_NPU_SET_IFM2_HEIGHT0_M1 = 0x18B,
- CMD0_NPU_SET_IFM2_HEIGHT1_M1 = 0x18C,
- CMD0_NPU_SET_IFM2_IB_START = 0x18D,
- CMD0_NPU_SET_IFM2_REGION = 0x18F,
-};
-
-enum cmd1
-{
- CMD1_NPU_SET_IFM_BASE0 = 0x000,
- CMD1_NPU_SET_IFM_BASE1 = 0x001,
- CMD1_NPU_SET_IFM_BASE2 = 0x002,
- CMD1_NPU_SET_IFM_BASE3 = 0x003,
- CMD1_NPU_SET_IFM_STRIDE_X = 0x004,
- CMD1_NPU_SET_IFM_STRIDE_Y = 0x005,
- CMD1_NPU_SET_IFM_STRIDE_C = 0x006,
- CMD1_NPU_SET_OFM_BASE0 = 0x010,
- CMD1_NPU_SET_OFM_BASE1 = 0x011,
- CMD1_NPU_SET_OFM_BASE2 = 0x012,
- CMD1_NPU_SET_OFM_BASE3 = 0x013,
- CMD1_NPU_SET_OFM_STRIDE_X = 0x014,
- CMD1_NPU_SET_OFM_STRIDE_Y = 0x015,
- CMD1_NPU_SET_OFM_STRIDE_C = 0x016,
- CMD1_NPU_SET_WEIGHT_BASE = 0x020,
- CMD1_NPU_SET_WEIGHT_LENGTH = 0x021,
- CMD1_NPU_SET_SCALE_BASE = 0x022,
- CMD1_NPU_SET_SCALE_LENGTH = 0x023,
- CMD1_NPU_SET_OFM_SCALE = 0x024,
- CMD1_NPU_SET_OPA_SCALE = 0x025,
- CMD1_NPU_SET_OPB_SCALE = 0x026,
- CMD1_NPU_SET_DMA0_SRC = 0x030,
- CMD1_NPU_SET_DMA0_DST = 0x031,
- CMD1_NPU_SET_DMA0_LEN = 0x032,
- CMD1_NPU_SET_DMA0_SKIP0 = 0x033,
- CMD1_NPU_SET_DMA0_SKIP1 = 0x034,
- CMD1_NPU_SET_IFM2_BASE0 = 0x080,
- CMD1_NPU_SET_IFM2_BASE1 = 0x081,
- CMD1_NPU_SET_IFM2_BASE2 = 0x082,
- CMD1_NPU_SET_IFM2_BASE3 = 0x083,
- CMD1_NPU_SET_IFM2_STRIDE_X = 0x084,
- CMD1_NPU_SET_IFM2_STRIDE_Y = 0x085,
- CMD1_NPU_SET_IFM2_STRIDE_C = 0x086,
- CMD1_NPU_SET_WEIGHT1_BASE = 0x090,
- CMD1_NPU_SET_WEIGHT1_LENGTH = 0x091,
- CMD1_NPU_SET_SCALE1_BASE = 0x092,
- CMD1_NPU_SET_SCALE1_LENGTH = 0x093,
-};
-
-enum data_format
-{
- DATA_FORMAT_NHWC = 0,
- DATA_FORMAT_NHCWB16 = 1,
+ NOT_IMPLEMENTED = 0,
+ IMPLEMENTED = 1,
};
-enum elementwise_mode
+enum class ifm2_operand_order : uint8_t
{
- ELEMENTWISE_MODE_MUL = 0,
- ELEMENTWISE_MODE_ADD = 1,
- ELEMENTWISE_MODE_SUB = 2,
- ELEMENTWISE_MODE_MIN = 3,
- ELEMENTWISE_MODE_MAX = 4,
- ELEMENTWISE_MODE_LRELU = 5,
- ELEMENTWISE_MODE_ABS = 6,
- ELEMENTWISE_MODE_CLZ = 7,
- ELEMENTWISE_MODE_SHR = 8,
- ELEMENTWISE_MODE_SHL = 9,
+ ORDER_B = 0,
+ ORDER_A = 1,
};
-enum ifm_precision
+enum class ifm_scale_mode : uint8_t
{
- IFM_PRECISION_U8 = 0,
- IFM_PRECISION_S8 = 1,
- IFM_PRECISION_U16 = 4,
- IFM_PRECISION_S16 = 5,
- IFM_PRECISION_S32 = 9,
+ OPA_OPB_16 = 0,
+ OPA_32 = 1,
+ OPB_32 = 2,
};
-enum ifm_scale_mode
+enum class ifm_upscale_mode : uint8_t
{
- IFM_SCALE_MODE_SCALE_16BIT = 0,
- IFM_SCALE_MODE_SCALE_OPA_32BIT = 1,
- IFM_SCALE_MODE_SCALE_OPB_32BIT = 2,
-};
-
-enum macs_per_cc
-{
- MACS_PER_CC_MACS_PER_CC_IS_5 = 0x5,
- MACS_PER_CC_MACS_PER_CC_IS_6 = 0x6,
- MACS_PER_CC_MACS_PER_CC_IS_7 = 0x7,
- MACS_PER_CC_MACS_PER_CC_IS_8 = 0x8,
-};
-
-enum memory_type
-{
- MEMORY_TYPE_AXI0_OUTSTANDING_COUNTER0 = 0,
- MEMORY_TYPE_AXI0_OUTSTANDING_COUNTER1 = 1,
- MEMORY_TYPE_AXI1_OUTSTANDING_COUNTER2 = 2,
- MEMORY_TYPE_AXI1_OUTSTANDING_COUNTER3 = 3,
-};
-
-enum ofm_precision
-{
- OFM_PRECISION_U8 = 0,
- OFM_PRECISION_S8 = 1,
- OFM_PRECISION_U16 = 2,
- OFM_PRECISION_S16 = 3,
- OFM_PRECISION_S32 = 5,
-};
-
-enum pmu_event_type
-{
- PMU_EVENT_TYPE_NO_EVENT = 0x00,
- PMU_EVENT_TYPE_CYCLE = 0x11,
- PMU_EVENT_TYPE_NPU_IDLE = 0x20,
- PMU_EVENT_TYPE_CC_STALLED_ON_BLOCKDEP = 0x21,
- PMU_EVENT_TYPE_CC_STALLED_ON_SHRAM_RECONFIG = 0x22,
- PMU_EVENT_TYPE_NPU_ACTIVE = 0x23,
- PMU_EVENT_TYPE_MAC_ACTIVE = 0x30,
- PMU_EVENT_TYPE_MAC_ACTIVE_8BIT = 0x31,
- PMU_EVENT_TYPE_MAC_ACTIVE_16BIT = 0x32,
- PMU_EVENT_TYPE_MAC_DPU_ACTIVE = 0x33,
- PMU_EVENT_TYPE_MAC_STALLED_BY_WD_ACC = 0x34,
- PMU_EVENT_TYPE_MAC_STALLED_BY_WD = 0x35,
- PMU_EVENT_TYPE_MAC_STALLED_BY_ACC = 0x36,
- PMU_EVENT_TYPE_MAC_STALLED_BY_IB = 0x37,
- PMU_EVENT_TYPE_MAC_ACTIVE_32BIT = 0x38,
- PMU_EVENT_TYPE_MAC_STALLED_BY_INT_W = 0x39,
- PMU_EVENT_TYPE_MAC_STALLED_BY_INT_ACC = 0x3A,
- PMU_EVENT_TYPE_AO_ACTIVE = 0x40,
- PMU_EVENT_TYPE_AO_ACTIVE_8BIT = 0x41,
- PMU_EVENT_TYPE_AO_ACTIVE_16BIT = 0x42,
- PMU_EVENT_TYPE_AO_STALLED_BY_OFMP_OB = 0x43,
- PMU_EVENT_TYPE_AO_STALLED_BY_OFMP = 0x44,
- PMU_EVENT_TYPE_AO_STALLED_BY_OB = 0x45,
- PMU_EVENT_TYPE_AO_STALLED_BY_ACC_IB = 0x46,
- PMU_EVENT_TYPE_AO_STALLED_BY_ACC = 0x47,
- PMU_EVENT_TYPE_AO_STALLED_BY_IB = 0x48,
- PMU_EVENT_TYPE_WD_ACTIVE = 0x50,
- PMU_EVENT_TYPE_WD_STALLED = 0x51,
- PMU_EVENT_TYPE_WD_STALLED_BY_WS = 0x52,
- PMU_EVENT_TYPE_WD_STALLED_BY_WD_BUF = 0x53,
- PMU_EVENT_TYPE_WD_PARSE_ACTIVE = 0x54,
- PMU_EVENT_TYPE_WD_PARSE_STALLED = 0x55,
- PMU_EVENT_TYPE_WD_PARSE_STALLED_IN = 0x56,
- PMU_EVENT_TYPE_WD_PARSE_STALLED_OUT = 0x57,
- PMU_EVENT_TYPE_WD_TRANS_WS = 0x58,
- PMU_EVENT_TYPE_WD_TRANS_WB = 0x59,
- PMU_EVENT_TYPE_WD_TRANS_DW0 = 0x5a,
- PMU_EVENT_TYPE_WD_TRANS_DW1 = 0x5b,
- PMU_EVENT_TYPE_AXI0_RD_TRANS_ACCEPTED = 0x80,
- PMU_EVENT_TYPE_AXI0_RD_TRANS_COMPLETED = 0x81,
- PMU_EVENT_TYPE_AXI0_RD_DATA_BEAT_RECEIVED = 0x82,
- PMU_EVENT_TYPE_AXI0_RD_TRAN_REQ_STALLED = 0x83,
- PMU_EVENT_TYPE_AXI0_WR_TRANS_ACCEPTED = 0x84,
- PMU_EVENT_TYPE_AXI0_WR_TRANS_COMPLETED_M = 0x85,
- PMU_EVENT_TYPE_AXI0_WR_TRANS_COMPLETED_S = 0x86,
- PMU_EVENT_TYPE_AXI0_WR_DATA_BEAT_WRITTEN = 0x87,
- PMU_EVENT_TYPE_AXI0_WR_TRAN_REQ_STALLED = 0x88,
- PMU_EVENT_TYPE_AXI0_WR_DATA_BEAT_STALLED = 0x89,
- PMU_EVENT_TYPE_AXI0_ENABLED_CYCLES = 0x8c,
- PMU_EVENT_TYPE_AXI0_RD_STALL_LIMIT = 0x8e,
- PMU_EVENT_TYPE_AXI0_WR_STALL_LIMIT = 0x8f,
- PMU_EVENT_TYPE_AXI1_RD_TRANS_ACCEPTED = 0x180,
- PMU_EVENT_TYPE_AXI1_RD_TRANS_COMPLETED = 0x181,
- PMU_EVENT_TYPE_AXI1_RD_DATA_BEAT_RECEIVED = 0x182,
- PMU_EVENT_TYPE_AXI1_RD_TRAN_REQ_STALLED = 0x183,
- PMU_EVENT_TYPE_AXI1_WR_TRANS_ACCEPTED = 0x184,
- PMU_EVENT_TYPE_AXI1_WR_TRANS_COMPLETED_M = 0x185,
- PMU_EVENT_TYPE_AXI1_WR_TRANS_COMPLETED_S = 0x186,
- PMU_EVENT_TYPE_AXI1_WR_DATA_BEAT_WRITTEN = 0x187,
- PMU_EVENT_TYPE_AXI1_WR_TRAN_REQ_STALLED = 0x188,
- PMU_EVENT_TYPE_AXI1_WR_DATA_BEAT_STALLED = 0x189,
- PMU_EVENT_TYPE_AXI1_ENABLED_CYCLES = 0x18c,
- PMU_EVENT_TYPE_AXI1_RD_STALL_LIMIT = 0x18e,
- PMU_EVENT_TYPE_AXI1_WR_STALL_LIMIT = 0x18f,
- PMU_EVENT_TYPE_AXI_LATENCY_ANY = 0xa0,
- PMU_EVENT_TYPE_AXI_LATENCY_32 = 0xa1,
- PMU_EVENT_TYPE_AXI_LATENCY_64 = 0xa2,
- PMU_EVENT_TYPE_AXI_LATENCY_128 = 0xa3,
- PMU_EVENT_TYPE_AXI_LATENCY_256 = 0xa4,
- PMU_EVENT_TYPE_AXI_LATENCY_512 = 0xa5,
- PMU_EVENT_TYPE_AXI_LATENCY_1024 = 0xa6,
- PMU_EVENT_TYPE_ECC_DMA = 0xb0,
- PMU_EVENT_TYPE_ECC_SB0 = 0xb1,
- PMU_EVENT_TYPE_ECC_SB1 = 0x1b1,
+ NONE = 0,
+ NEAREST = 1,
+ ZEROS = 2,
};
-enum pooling_mode
+enum class kernel_decomposition : uint8_t
{
- POOLING_MODE_MAX = 0,
- POOLING_MODE_AVERAGE = 1,
- POOLING_MODE_REDUCE_SUM = 2,
+ D8X8 = 0,
+ D4X4 = 1,
};
-enum privilege_level
+enum class kernel_dilation : uint8_t
{
- PRIVILEGE_LEVEL_USER = 0,
- PRIVILEGE_LEVEL_PRIVILEGED = 1,
+ NONE = 0,
+ X2 = 1,
};
-enum resampling_mode
+enum class max_beats : uint8_t
{
- RESAMPLING_MODE_NONE = 0,
- RESAMPLING_MODE_NEAREST = 1,
- RESAMPLING_MODE_TRANSPOSE = 2,
+ B64 = 0,
+ B128 = 1,
+ B256 = 2,
};
-enum rounding
+enum class mem_attr : uint8_t
{
- ROUNDING_TFL = 0,
- ROUNDING_TRUNCATE = 1,
- ROUNDING_NATURAL = 2,
+ AXI0_OUTSTANDING_COUNTER0 = 0,
+ AXI0_OUTSTANDING_COUNTER1 = 1,
+ AXI1_OUTSTANDING_COUNTER2 = 2,
+ AXI1_OUTSTANDING_COUNTER3 = 3,
};
-enum security_level
+enum class ofm_scale_mode : uint8_t
{
- SECURITY_LEVEL_SECURE = 0,
- SECURITY_LEVEL_NON_SECURE = 1,
+ PER_CHANNEL = 0,
+ GLOBAL = 1,
};
-enum shram_size
+enum class pmu_axi_channel : uint8_t
{
- SHRAM_SIZE_SHRAM_96KB = 0x60,
- SHRAM_SIZE_SHRAM_48KB = 0x30,
- SHRAM_SIZE_SHRAM_24KB = 0x18,
- SHRAM_SIZE_SHRAM_16KB = 0x10,
+ RD_CMD = 0,
+ RD_IFM = 1,
+ RD_WEIGHTS = 2,
+ RD_SCALE_BIAS = 3,
+ RD_MEM2MEM = 4,
+ WR_OFM = 8,
+ WR_MEM2MEM = 9,
};
-enum state
+enum class pmu_event : uint16_t
{
- STATE_STOPPED = 0,
- STATE_RUNNING = 1,
+ NO_EVENT = 0,
+ CYCLE = 17,
+ NPU_IDLE = 32,
+ CC_STALLED_ON_BLOCKDEP = 33,
+ CC_STALLED_ON_SHRAM_RECONFIG = 34,
+ NPU_ACTIVE = 35,
+ MAC_ACTIVE = 48,
+ MAC_ACTIVE_8BIT = 49,
+ MAC_ACTIVE_16BIT = 50,
+ MAC_DPU_ACTIVE = 51,
+ MAC_STALLED_BY_WD_ACC = 52,
+ MAC_STALLED_BY_WD = 53,
+ MAC_STALLED_BY_ACC = 54,
+ MAC_STALLED_BY_IB = 55,
+ MAC_ACTIVE_32BIT = 56,
+ MAC_STALLED_BY_INT_W = 57,
+ MAC_STALLED_BY_INT_ACC = 58,
+ AO_ACTIVE = 64,
+ AO_ACTIVE_8BIT = 65,
+ AO_ACTIVE_16BIT = 66,
+ AO_STALLED_BY_OFMP_OB = 67,
+ AO_STALLED_BY_OFMP = 68,
+ AO_STALLED_BY_OB = 69,
+ AO_STALLED_BY_ACC_IB = 70,
+ AO_STALLED_BY_ACC = 71,
+ AO_STALLED_BY_IB = 72,
+ WD_ACTIVE = 80,
+ WD_STALLED = 81,
+ WD_STALLED_BY_WS = 82,
+ WD_STALLED_BY_WD_BUF = 83,
+ WD_PARSE_ACTIVE = 84,
+ WD_PARSE_STALLED = 85,
+ WD_PARSE_STALLED_IN = 86,
+ WD_PARSE_STALLED_OUT = 87,
+ WD_TRANS_WS = 88,
+ WD_TRANS_WB = 89,
+ WD_TRANS_DW0 = 90,
+ WD_TRANS_DW1 = 91,
+ AXI0_RD_TRANS_ACCEPTED = 128,
+ AXI0_RD_TRANS_COMPLETED = 129,
+ AXI0_RD_DATA_BEAT_RECEIVED = 130,
+ AXI0_RD_TRAN_REQ_STALLED = 131,
+ AXI0_WR_TRANS_ACCEPTED = 132,
+ AXI0_WR_TRANS_COMPLETED_M = 133,
+ AXI0_WR_TRANS_COMPLETED_S = 134,
+ AXI0_WR_DATA_BEAT_WRITTEN = 135,
+ AXI0_WR_TRAN_REQ_STALLED = 136,
+ AXI0_WR_DATA_BEAT_STALLED = 137,
+ AXI0_ENABLED_CYCLES = 140,
+ AXI0_RD_STALL_LIMIT = 142,
+ AXI0_WR_STALL_LIMIT = 143,
+ AXI_LATENCY_ANY = 160,
+ AXI_LATENCY_32 = 161,
+ AXI_LATENCY_64 = 162,
+ AXI_LATENCY_128 = 163,
+ AXI_LATENCY_256 = 164,
+ AXI_LATENCY_512 = 165,
+ AXI_LATENCY_1024 = 166,
+ ECC_DMA = 176,
+ ECC_SB0 = 177,
+ AXI1_RD_TRANS_ACCEPTED = 384,
+ AXI1_RD_TRANS_COMPLETED = 385,
+ AXI1_RD_DATA_BEAT_RECEIVED = 386,
+ AXI1_RD_TRAN_REQ_STALLED = 387,
+ AXI1_WR_TRANS_ACCEPTED = 388,
+ AXI1_WR_TRANS_COMPLETED_M = 389,
+ AXI1_WR_TRANS_COMPLETED_S = 390,
+ AXI1_WR_DATA_BEAT_WRITTEN = 391,
+ AXI1_WR_TRAN_REQ_STALLED = 392,
+ AXI1_WR_DATA_BEAT_STALLED = 393,
+ AXI1_ENABLED_CYCLES = 396,
+ AXI1_RD_STALL_LIMIT = 398,
+ AXI1_WR_STALL_LIMIT = 399,
+ ECC_SB1 = 433,
};
-enum stride_mode
+enum class pooling_mode : uint8_t
{
- STRIDE_MODE_STRIDE_MODE_1D = 0,
- STRIDE_MODE_STRIDE_MODE_2D = 1,
- STRIDE_MODE_STRIDE_MODE_3D = 2,
+ MAX = 0,
+ AVERAGE = 1,
+ REDUCE_SUM = 2,
};
-#endif
+enum class privilege_level : uint8_t
+{
+ USER = 0,
+ PRIVILEGED = 1,
+};
-// id_r - ID register
-struct id_r
+enum class round_mode : uint8_t
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+ DBL = 0,
+ TRUNCATE = 1,
+ NATURAL = 2,
+};
+
+enum class security_level : uint8_t
+{
+ SECURE = 0,
+ NON_SECURE = 1,
+};
+
+enum class state : uint8_t
+{
+ STOPPED = 0,
+ RUNNING = 1,
+};
+
+enum class wd_core_slice_state : uint8_t
+{
+ HEADER = 0,
+ PALETTE = 1,
+ WEIGHTS = 2,
+};
+
+enum class wd_ctrl_state : uint8_t
+{
+ IDLE = 0,
+ DRAIN = 1,
+ OFD_INIT = 2,
+ OFD_RUN = 3,
+};
+
+enum class weight_order : uint8_t
+{
+ DEPTH_FIRST = 0,
+ PART_KERNEL_FIRST = 1,
+};
+
+#else
+
+enum acc_format
+{
+ ACC_FORMAT_I32 = 0,
+ ACC_FORMAT_I40 = 1,
+ ACC_FORMAT_F16 = 2,
+};
+
+enum activation_clip_range
+{
+ ACTIVATION_CLIP_RANGE_OFM_PRECISION = 0,
+ ACTIVATION_CLIP_RANGE_FORCE_UINT8 = 2,
+ ACTIVATION_CLIP_RANGE_FORCE_INT8 = 3,
+ ACTIVATION_CLIP_RANGE_FORCE_INT16 = 5,
+};
+
+enum activation_format
+{
+ ACTIVATION_FORMAT_NHWC = 0,
+ ACTIVATION_FORMAT_NHCWB16 = 1,
+};
+
+enum activation_function
+{
+ ACTIVATION_FUNCTION_RELU = 0,
+ ACTIVATION_FUNCTION_TANH = 3,
+ ACTIVATION_FUNCTION_SIGMOID = 4,
+ ACTIVATION_FUNCTION_TABLE_0 = 16,
+ ACTIVATION_FUNCTION_TABLE_1 = 17,
+ ACTIVATION_FUNCTION_TABLE_2 = 18,
+ ACTIVATION_FUNCTION_TABLE_3 = 19,
+ ACTIVATION_FUNCTION_TABLE_4 = 20,
+ ACTIVATION_FUNCTION_TABLE_5 = 21,
+ ACTIVATION_FUNCTION_TABLE_6 = 22,
+ ACTIVATION_FUNCTION_TABLE_7 = 23,
+};
+
+enum activation_precision
+{
+ ACTIVATION_PRECISION_B8 = 0,
+ ACTIVATION_PRECISION_B16 = 1,
+ ACTIVATION_PRECISION_B32 = 2,
+ ACTIVATION_PRECISION_B64 = 3,
+};
+
+enum activation_type
+{
+ ACTIVATION_TYPE_UNSIGNED = 0,
+ ACTIVATION_TYPE_SIGNED = 1,
+};
+
+enum axi_mem_encoding
+{
+ AXI_MEM_ENCODING_DEVICE_NON_BUFFERABLE = 0,
+ AXI_MEM_ENCODING_DEVICE_BUFFERABLE = 1,
+ AXI_MEM_ENCODING_NORMAL_NON_CACHEABLE_NON_BUFFERABLE = 2,
+ AXI_MEM_ENCODING_NORMAL_NON_CACHEABLE_BUFFERABLE = 3,
+ AXI_MEM_ENCODING_WRITE_THROUGH_NO_ALLOCATE = 4,
+ AXI_MEM_ENCODING_WRITE_THROUGH_READ_ALLOCATE = 5,
+ AXI_MEM_ENCODING_WRITE_THROUGH_WRITE_ALLOCATE = 6,
+ AXI_MEM_ENCODING_WRITE_THROUGH_READ_AND_WRITE_ALLOCATE = 7,
+ AXI_MEM_ENCODING_WRITE_BACK_NO_ALLOCATE = 8,
+ AXI_MEM_ENCODING_WRITE_BACK_READ_ALLOCATE = 9,
+ AXI_MEM_ENCODING_WRITE_BACK_WRITE_ALLOCATE = 10,
+ AXI_MEM_ENCODING_WRITE_BACK_READ_AND_WRITE_ALLOCATE = 11,
+};
+
+enum broadcast_mode
+{
+ BROADCAST_MODE_DISABLE = 0,
+ BROADCAST_MODE_ENABLE = 1,
+};
+
+enum cmd0_opcode
+{
+ CMD0_OPCODE_NPU_OP_STOP = 0,
+ CMD0_OPCODE_NPU_OP_IRQ = 1,
+ CMD0_OPCODE_NPU_OP_CONV = 2,
+ CMD0_OPCODE_NPU_OP_DEPTHWISE = 3,
+ CMD0_OPCODE_NPU_OP_POOL = 5,
+ CMD0_OPCODE_NPU_OP_ELEMENTWISE = 6,
+ CMD0_OPCODE_NPU_OP_DMA_START = 16,
+ CMD0_OPCODE_NPU_OP_DMA_WAIT = 17,
+ CMD0_OPCODE_NPU_OP_KERNEL_WAIT = 18,
+ CMD0_OPCODE_NPU_OP_PMU_MASK = 19,
+ CMD0_OPCODE_NPU_SET_IFM_PAD_TOP = 256,
+ CMD0_OPCODE_NPU_SET_IFM_PAD_LEFT = 257,
+ CMD0_OPCODE_NPU_SET_IFM_PAD_RIGHT = 258,
+ CMD0_OPCODE_NPU_SET_IFM_PAD_BOTTOM = 259,
+ CMD0_OPCODE_NPU_SET_IFM_DEPTH_M1 = 260,
+ CMD0_OPCODE_NPU_SET_IFM_PRECISION = 261,
+ CMD0_OPCODE_NPU_SET_IFM_UPSCALE = 263,
+ CMD0_OPCODE_NPU_SET_IFM_ZERO_POINT = 265,
+ CMD0_OPCODE_NPU_SET_IFM_WIDTH0_M1 = 266,
+ CMD0_OPCODE_NPU_SET_IFM_HEIGHT0_M1 = 267,
+ CMD0_OPCODE_NPU_SET_IFM_HEIGHT1_M1 = 268,
+ CMD0_OPCODE_NPU_SET_IFM_IB_END = 269,
+ CMD0_OPCODE_NPU_SET_IFM_REGION = 271,
+ CMD0_OPCODE_NPU_SET_OFM_WIDTH_M1 = 273,
+ CMD0_OPCODE_NPU_SET_OFM_HEIGHT_M1 = 274,
+ CMD0_OPCODE_NPU_SET_OFM_DEPTH_M1 = 275,
+ CMD0_OPCODE_NPU_SET_OFM_PRECISION = 276,
+ CMD0_OPCODE_NPU_SET_OFM_BLK_WIDTH_M1 = 277,
+ CMD0_OPCODE_NPU_SET_OFM_BLK_HEIGHT_M1 = 278,
+ CMD0_OPCODE_NPU_SET_OFM_BLK_DEPTH_M1 = 279,
+ CMD0_OPCODE_NPU_SET_OFM_ZERO_POINT = 280,
+ CMD0_OPCODE_NPU_SET_OFM_WIDTH0_M1 = 282,
+ CMD0_OPCODE_NPU_SET_OFM_HEIGHT0_M1 = 283,
+ CMD0_OPCODE_NPU_SET_OFM_HEIGHT1_M1 = 284,
+ CMD0_OPCODE_NPU_SET_OFM_REGION = 287,
+ CMD0_OPCODE_NPU_SET_KERNEL_WIDTH_M1 = 288,
+ CMD0_OPCODE_NPU_SET_KERNEL_HEIGHT_M1 = 289,
+ CMD0_OPCODE_NPU_SET_KERNEL_STRIDE = 290,
+ CMD0_OPCODE_NPU_SET_ACC_FORMAT = 292,
+ CMD0_OPCODE_NPU_SET_ACTIVATION = 293,
+ CMD0_OPCODE_NPU_SET_ACTIVATION_MIN = 294,
+ CMD0_OPCODE_NPU_SET_ACTIVATION_MAX = 295,
+ CMD0_OPCODE_NPU_SET_WEIGHT_REGION = 296,
+ CMD0_OPCODE_NPU_SET_SCALE_REGION = 297,
+ CMD0_OPCODE_NPU_SET_AB_START = 301,
+ CMD0_OPCODE_NPU_SET_BLOCKDEP = 303,
+ CMD0_OPCODE_NPU_SET_DMA0_SRC_REGION = 304,
+ CMD0_OPCODE_NPU_SET_DMA0_DST_REGION = 305,
+ CMD0_OPCODE_NPU_SET_DMA0_SIZE0 = 306,
+ CMD0_OPCODE_NPU_SET_DMA0_SIZE1 = 307,
+ CMD0_OPCODE_NPU_SET_IFM2_BROADCAST = 384,
+ CMD0_OPCODE_NPU_SET_IFM2_SCALAR = 385,
+ CMD0_OPCODE_NPU_SET_IFM2_PRECISION = 389,
+ CMD0_OPCODE_NPU_SET_IFM2_ZERO_POINT = 393,
+ CMD0_OPCODE_NPU_SET_IFM2_WIDTH0_M1 = 394,
+ CMD0_OPCODE_NPU_SET_IFM2_HEIGHT0_M1 = 395,
+ CMD0_OPCODE_NPU_SET_IFM2_HEIGHT1_M1 = 396,
+ CMD0_OPCODE_NPU_SET_IFM2_IB_START = 397,
+ CMD0_OPCODE_NPU_SET_IFM2_REGION = 399,
+};
+
+enum cmd1_opcode
+{
+ CMD1_OPCODE_NPU_SET_IFM_BASE0 = 0,
+ CMD1_OPCODE_NPU_SET_IFM_BASE1 = 1,
+ CMD1_OPCODE_NPU_SET_IFM_BASE2 = 2,
+ CMD1_OPCODE_NPU_SET_IFM_BASE3 = 3,
+ CMD1_OPCODE_NPU_SET_IFM_STRIDE_X = 4,
+ CMD1_OPCODE_NPU_SET_IFM_STRIDE_Y = 5,
+ CMD1_OPCODE_NPU_SET_IFM_STRIDE_C = 6,
+ CMD1_OPCODE_NPU_SET_OFM_BASE0 = 16,
+ CMD1_OPCODE_NPU_SET_OFM_BASE1 = 17,
+ CMD1_OPCODE_NPU_SET_OFM_BASE2 = 18,
+ CMD1_OPCODE_NPU_SET_OFM_BASE3 = 19,
+ CMD1_OPCODE_NPU_SET_OFM_STRIDE_X = 20,
+ CMD1_OPCODE_NPU_SET_OFM_STRIDE_Y = 21,
+ CMD1_OPCODE_NPU_SET_OFM_STRIDE_C = 22,
+ CMD1_OPCODE_NPU_SET_WEIGHT_BASE = 32,
+ CMD1_OPCODE_NPU_SET_WEIGHT_LENGTH = 33,
+ CMD1_OPCODE_NPU_SET_SCALE_BASE = 34,
+ CMD1_OPCODE_NPU_SET_SCALE_LENGTH = 35,
+ CMD1_OPCODE_NPU_SET_OFM_SCALE = 36,
+ CMD1_OPCODE_NPU_SET_OPA_SCALE = 37,
+ CMD1_OPCODE_NPU_SET_OPB_SCALE = 38,
+ CMD1_OPCODE_NPU_SET_DMA0_SRC = 48,
+ CMD1_OPCODE_NPU_SET_DMA0_DST = 49,
+ CMD1_OPCODE_NPU_SET_DMA0_LEN = 50,
+ CMD1_OPCODE_NPU_SET_IFM2_BASE0 = 128,
+ CMD1_OPCODE_NPU_SET_IFM2_BASE1 = 129,
+ CMD1_OPCODE_NPU_SET_IFM2_BASE2 = 130,
+ CMD1_OPCODE_NPU_SET_IFM2_BASE3 = 131,
+ CMD1_OPCODE_NPU_SET_IFM2_STRIDE_X = 132,
+ CMD1_OPCODE_NPU_SET_IFM2_STRIDE_Y = 133,
+ CMD1_OPCODE_NPU_SET_IFM2_STRIDE_C = 134,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED0 = 160,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED1 = 161,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED2 = 162,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED3 = 163,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED4 = 164,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED5 = 165,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED6 = 166,
+ CMD1_OPCODE_NPU_SET_USER_DEFINED7 = 167,
+};
+
+enum cmd_ctrl
+{
+ CMD_CTRL_CMD0_CTRL = 0,
+ CMD_CTRL_CMD1_CTRL = 1,
+};
+
+enum custom_dma_cs
+{
+ CUSTOM_DMA_CS_DISABLE = 0,
+ CUSTOM_DMA_CS_ENABLE = 1,
+};
+
+enum custom_dma
+{
+ CUSTOM_DMA_NOT_IMPLEMENTED = 0,
+ CUSTOM_DMA_IMPLEMENTED = 1,
+};
+
+enum dma_fault_src
+{
+ DMA_FAULT_SRC_AXI_M0 = 0,
+ DMA_FAULT_SRC_AXI_M1 = 1,
+};
+
+enum dma_region_mode
+{
+ DMA_REGION_MODE_EXTERNAL = 0,
+ DMA_REGION_MODE_INTERNAL = 1,
+};
+
+enum dma_stride_mode
+{
+ DMA_STRIDE_MODE_D1 = 0,
+};
+
+enum elementwise_mode
+{
+ ELEMENTWISE_MODE_MUL = 0,
+ ELEMENTWISE_MODE_ADD = 1,
+ ELEMENTWISE_MODE_SUB = 2,
+ ELEMENTWISE_MODE_MIN = 3,
+ ELEMENTWISE_MODE_MAX = 4,
+ ELEMENTWISE_MODE_LRELU = 5,
+ ELEMENTWISE_MODE_ABS = 6,
+ ELEMENTWISE_MODE_CLZ = 7,
+ ELEMENTWISE_MODE_SHR = 8,
+ ELEMENTWISE_MODE_SHL = 9,
+};
+
+enum functional_safety
+{
+ FUNCTIONAL_SAFETY_NOT_IMPLEMENTED = 0,
+ FUNCTIONAL_SAFETY_IMPLEMENTED = 1,
+};
+
+enum ifm2_operand_order
+{
+ IFM2_OPERAND_ORDER_ORDER_B = 0,
+ IFM2_OPERAND_ORDER_ORDER_A = 1,
+};
+
+enum ifm_scale_mode
+{
+ IFM_SCALE_MODE_OPA_OPB_16 = 0,
+ IFM_SCALE_MODE_OPA_32 = 1,
+ IFM_SCALE_MODE_OPB_32 = 2,
+};
+
+enum ifm_upscale_mode
+{
+ IFM_UPSCALE_MODE_NONE = 0,
+ IFM_UPSCALE_MODE_NEAREST = 1,
+ IFM_UPSCALE_MODE_ZEROS = 2,
+};
+
+enum kernel_decomposition
+{
+ KERNEL_DECOMPOSITION_D8X8 = 0,
+ KERNEL_DECOMPOSITION_D4X4 = 1,
+};
+
+enum kernel_dilation
+{
+ KERNEL_DILATION_NONE = 0,
+ KERNEL_DILATION_X2 = 1,
+};
+
+enum max_beats
+{
+ MAX_BEATS_B64 = 0,
+ MAX_BEATS_B128 = 1,
+ MAX_BEATS_B256 = 2,
+};
+
+enum mem_attr
+{
+ MEM_ATTR_AXI0_OUTSTANDING_COUNTER0 = 0,
+ MEM_ATTR_AXI0_OUTSTANDING_COUNTER1 = 1,
+ MEM_ATTR_AXI1_OUTSTANDING_COUNTER2 = 2,
+ MEM_ATTR_AXI1_OUTSTANDING_COUNTER3 = 3,
+};
+
+enum ofm_scale_mode
+{
+ OFM_SCALE_MODE_PER_CHANNEL = 0,
+ OFM_SCALE_MODE_GLOBAL = 1,
+};
+
+enum pmu_axi_channel
+{
+ PMU_AXI_CHANNEL_RD_CMD = 0,
+ PMU_AXI_CHANNEL_RD_IFM = 1,
+ PMU_AXI_CHANNEL_RD_WEIGHTS = 2,
+ PMU_AXI_CHANNEL_RD_SCALE_BIAS = 3,
+ PMU_AXI_CHANNEL_RD_MEM2MEM = 4,
+ PMU_AXI_CHANNEL_WR_OFM = 8,
+ PMU_AXI_CHANNEL_WR_MEM2MEM = 9,
+};
+
+enum pmu_event
+{
+ PMU_EVENT_NO_EVENT = 0,
+ PMU_EVENT_CYCLE = 17,
+ PMU_EVENT_NPU_IDLE = 32,
+ PMU_EVENT_CC_STALLED_ON_BLOCKDEP = 33,
+ PMU_EVENT_CC_STALLED_ON_SHRAM_RECONFIG = 34,
+ PMU_EVENT_NPU_ACTIVE = 35,
+ PMU_EVENT_MAC_ACTIVE = 48,
+ PMU_EVENT_MAC_ACTIVE_8BIT = 49,
+ PMU_EVENT_MAC_ACTIVE_16BIT = 50,
+ PMU_EVENT_MAC_DPU_ACTIVE = 51,
+ PMU_EVENT_MAC_STALLED_BY_WD_ACC = 52,
+ PMU_EVENT_MAC_STALLED_BY_WD = 53,
+ PMU_EVENT_MAC_STALLED_BY_ACC = 54,
+ PMU_EVENT_MAC_STALLED_BY_IB = 55,
+ PMU_EVENT_MAC_ACTIVE_32BIT = 56,
+ PMU_EVENT_MAC_STALLED_BY_INT_W = 57,
+ PMU_EVENT_MAC_STALLED_BY_INT_ACC = 58,
+ PMU_EVENT_AO_ACTIVE = 64,
+ PMU_EVENT_AO_ACTIVE_8BIT = 65,
+ PMU_EVENT_AO_ACTIVE_16BIT = 66,
+ PMU_EVENT_AO_STALLED_BY_OFMP_OB = 67,
+ PMU_EVENT_AO_STALLED_BY_OFMP = 68,
+ PMU_EVENT_AO_STALLED_BY_OB = 69,
+ PMU_EVENT_AO_STALLED_BY_ACC_IB = 70,
+ PMU_EVENT_AO_STALLED_BY_ACC = 71,
+ PMU_EVENT_AO_STALLED_BY_IB = 72,
+ PMU_EVENT_WD_ACTIVE = 80,
+ PMU_EVENT_WD_STALLED = 81,
+ PMU_EVENT_WD_STALLED_BY_WS = 82,
+ PMU_EVENT_WD_STALLED_BY_WD_BUF = 83,
+ PMU_EVENT_WD_PARSE_ACTIVE = 84,
+ PMU_EVENT_WD_PARSE_STALLED = 85,
+ PMU_EVENT_WD_PARSE_STALLED_IN = 86,
+ PMU_EVENT_WD_PARSE_STALLED_OUT = 87,
+ PMU_EVENT_WD_TRANS_WS = 88,
+ PMU_EVENT_WD_TRANS_WB = 89,
+ PMU_EVENT_WD_TRANS_DW0 = 90,
+ PMU_EVENT_WD_TRANS_DW1 = 91,
+ PMU_EVENT_AXI0_RD_TRANS_ACCEPTED = 128,
+ PMU_EVENT_AXI0_RD_TRANS_COMPLETED = 129,
+ PMU_EVENT_AXI0_RD_DATA_BEAT_RECEIVED = 130,
+ PMU_EVENT_AXI0_RD_TRAN_REQ_STALLED = 131,
+ PMU_EVENT_AXI0_WR_TRANS_ACCEPTED = 132,
+ PMU_EVENT_AXI0_WR_TRANS_COMPLETED_M = 133,
+ PMU_EVENT_AXI0_WR_TRANS_COMPLETED_S = 134,
+ PMU_EVENT_AXI0_WR_DATA_BEAT_WRITTEN = 135,
+ PMU_EVENT_AXI0_WR_TRAN_REQ_STALLED = 136,
+ PMU_EVENT_AXI0_WR_DATA_BEAT_STALLED = 137,
+ PMU_EVENT_AXI0_ENABLED_CYCLES = 140,
+ PMU_EVENT_AXI0_RD_STALL_LIMIT = 142,
+ PMU_EVENT_AXI0_WR_STALL_LIMIT = 143,
+ PMU_EVENT_AXI_LATENCY_ANY = 160,
+ PMU_EVENT_AXI_LATENCY_32 = 161,
+ PMU_EVENT_AXI_LATENCY_64 = 162,
+ PMU_EVENT_AXI_LATENCY_128 = 163,
+ PMU_EVENT_AXI_LATENCY_256 = 164,
+ PMU_EVENT_AXI_LATENCY_512 = 165,
+ PMU_EVENT_AXI_LATENCY_1024 = 166,
+ PMU_EVENT_ECC_DMA = 176,
+ PMU_EVENT_ECC_SB0 = 177,
+ PMU_EVENT_AXI1_RD_TRANS_ACCEPTED = 384,
+ PMU_EVENT_AXI1_RD_TRANS_COMPLETED = 385,
+ PMU_EVENT_AXI1_RD_DATA_BEAT_RECEIVED = 386,
+ PMU_EVENT_AXI1_RD_TRAN_REQ_STALLED = 387,
+ PMU_EVENT_AXI1_WR_TRANS_ACCEPTED = 388,
+ PMU_EVENT_AXI1_WR_TRANS_COMPLETED_M = 389,
+ PMU_EVENT_AXI1_WR_TRANS_COMPLETED_S = 390,
+ PMU_EVENT_AXI1_WR_DATA_BEAT_WRITTEN = 391,
+ PMU_EVENT_AXI1_WR_TRAN_REQ_STALLED = 392,
+ PMU_EVENT_AXI1_WR_DATA_BEAT_STALLED = 393,
+ PMU_EVENT_AXI1_ENABLED_CYCLES = 396,
+ PMU_EVENT_AXI1_RD_STALL_LIMIT = 398,
+ PMU_EVENT_AXI1_WR_STALL_LIMIT = 399,
+ PMU_EVENT_ECC_SB1 = 433,
+};
+
+enum pooling_mode
+{
+ POOLING_MODE_MAX = 0,
+ POOLING_MODE_AVERAGE = 1,
+ POOLING_MODE_REDUCE_SUM = 2,
+};
+
+enum privilege_level
+{
+ PRIVILEGE_LEVEL_USER = 0,
+ PRIVILEGE_LEVEL_PRIVILEGED = 1,
+};
+
+enum round_mode
+{
+ ROUND_MODE_DBL = 0,
+ ROUND_MODE_TRUNCATE = 1,
+ ROUND_MODE_NATURAL = 2,
+};
+
+enum security_level
+{
+ SECURITY_LEVEL_SECURE = 0,
+ SECURITY_LEVEL_NON_SECURE = 1,
+};
+
+enum state
+{
+ STATE_STOPPED = 0,
+ STATE_RUNNING = 1,
+};
+
+enum wd_core_slice_state
+{
+ WD_CORE_SLICE_STATE_HEADER = 0,
+ WD_CORE_SLICE_STATE_PALETTE = 1,
+ WD_CORE_SLICE_STATE_WEIGHTS = 2,
+};
+
+enum wd_ctrl_state
+{
+ WD_CTRL_STATE_IDLE = 0,
+ WD_CTRL_STATE_DRAIN = 1,
+ WD_CTRL_STATE_OFD_INIT = 2,
+ WD_CTRL_STATE_OFD_RUN = 3,
+};
+
+enum weight_order
+{
+ WEIGHT_ORDER_DEPTH_FIRST = 0,
+ WEIGHT_ORDER_PART_KERNEL_FIRST = 1,
+};
+
+#endif
+
+#ifdef NPU_DISASSEMBLE
+
+static const char *acc_format_str[] = {
+ "ACC_FORMAT_I32",
+ "ACC_FORMAT_I40",
+ "ACC_FORMAT_F16",
+};
+
+static const char *activation_clip_range_str[] = {
+ "ACTIVATION_CLIP_RANGE_OFM_PRECISION",
+ "****",
+ "ACTIVATION_CLIP_RANGE_FORCE_UINT8",
+ "ACTIVATION_CLIP_RANGE_FORCE_INT8",
+ "****",
+ "ACTIVATION_CLIP_RANGE_FORCE_INT16",
+};
+
+static const char *activation_format_str[] = {
+ "ACTIVATION_FORMAT_NHWC",
+ "ACTIVATION_FORMAT_NHCWB16",
+};
+
+static const char *activation_function_str[] = {
+ "ACTIVATION_FUNCTION_RELU",
+ "****",
+ "****",
+ "ACTIVATION_FUNCTION_TANH",
+ "ACTIVATION_FUNCTION_SIGMOID",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "ACTIVATION_FUNCTION_TABLE_0",
+ "ACTIVATION_FUNCTION_TABLE_1",
+ "ACTIVATION_FUNCTION_TABLE_2",
+ "ACTIVATION_FUNCTION_TABLE_3",
+ "ACTIVATION_FUNCTION_TABLE_4",
+ "ACTIVATION_FUNCTION_TABLE_5",
+ "ACTIVATION_FUNCTION_TABLE_6",
+ "ACTIVATION_FUNCTION_TABLE_7",
+};
+
+static const char *activation_precision_str[] = {
+ "ACTIVATION_PRECISION_B8",
+ "ACTIVATION_PRECISION_B16",
+ "ACTIVATION_PRECISION_B32",
+ "ACTIVATION_PRECISION_B64",
+};
+
+static const char *activation_type_str[] = {
+ "ACTIVATION_TYPE_UNSIGNED",
+ "ACTIVATION_TYPE_SIGNED",
+};
+
+static const char *axi_mem_encoding_str[] = {
+ "AXI_MEM_ENCODING_DEVICE_NON_BUFFERABLE",
+ "AXI_MEM_ENCODING_DEVICE_BUFFERABLE",
+ "AXI_MEM_ENCODING_NORMAL_NON_CACHEABLE_NON_BUFFERABLE",
+ "AXI_MEM_ENCODING_NORMAL_NON_CACHEABLE_BUFFERABLE",
+ "AXI_MEM_ENCODING_WRITE_THROUGH_NO_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_THROUGH_READ_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_THROUGH_WRITE_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_THROUGH_READ_AND_WRITE_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_BACK_NO_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_BACK_READ_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_BACK_WRITE_ALLOCATE",
+ "AXI_MEM_ENCODING_WRITE_BACK_READ_AND_WRITE_ALLOCATE",
+};
+
+static const char *broadcast_mode_str[] = {
+ "BROADCAST_MODE_DISABLE",
+ "BROADCAST_MODE_ENABLE",
+};
+
+static const char *cmd0_opcode_str[] = {
+ "CMD0_OPCODE_NPU_OP_STOP",
+ "CMD0_OPCODE_NPU_OP_IRQ",
+ "CMD0_OPCODE_NPU_OP_CONV",
+ "CMD0_OPCODE_NPU_OP_DEPTHWISE",
+ "****",
+ "CMD0_OPCODE_NPU_OP_POOL",
+ "CMD0_OPCODE_NPU_OP_ELEMENTWISE",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_OP_DMA_START",
+ "CMD0_OPCODE_NPU_OP_DMA_WAIT",
+ "CMD0_OPCODE_NPU_OP_KERNEL_WAIT",
+ "CMD0_OPCODE_NPU_OP_PMU_MASK",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM_PAD_TOP",
+ "CMD0_OPCODE_NPU_SET_IFM_PAD_LEFT",
+ "CMD0_OPCODE_NPU_SET_IFM_PAD_RIGHT",
+ "CMD0_OPCODE_NPU_SET_IFM_PAD_BOTTOM",
+ "CMD0_OPCODE_NPU_SET_IFM_DEPTH_M1",
+ "CMD0_OPCODE_NPU_SET_IFM_PRECISION",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM_UPSCALE",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM_ZERO_POINT",
+ "CMD0_OPCODE_NPU_SET_IFM_WIDTH0_M1",
+ "CMD0_OPCODE_NPU_SET_IFM_HEIGHT0_M1",
+ "CMD0_OPCODE_NPU_SET_IFM_HEIGHT1_M1",
+ "CMD0_OPCODE_NPU_SET_IFM_IB_END",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM_REGION",
+ "****",
+ "CMD0_OPCODE_NPU_SET_OFM_WIDTH_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_HEIGHT_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_DEPTH_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_PRECISION",
+ "CMD0_OPCODE_NPU_SET_OFM_BLK_WIDTH_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_BLK_HEIGHT_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_BLK_DEPTH_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_ZERO_POINT",
+ "****",
+ "CMD0_OPCODE_NPU_SET_OFM_WIDTH0_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_HEIGHT0_M1",
+ "CMD0_OPCODE_NPU_SET_OFM_HEIGHT1_M1",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_SET_OFM_REGION",
+ "CMD0_OPCODE_NPU_SET_KERNEL_WIDTH_M1",
+ "CMD0_OPCODE_NPU_SET_KERNEL_HEIGHT_M1",
+ "CMD0_OPCODE_NPU_SET_KERNEL_STRIDE",
+ "****",
+ "CMD0_OPCODE_NPU_SET_ACC_FORMAT",
+ "CMD0_OPCODE_NPU_SET_ACTIVATION",
+ "CMD0_OPCODE_NPU_SET_ACTIVATION_MIN",
+ "CMD0_OPCODE_NPU_SET_ACTIVATION_MAX",
+ "CMD0_OPCODE_NPU_SET_WEIGHT_REGION",
+ "CMD0_OPCODE_NPU_SET_SCALE_REGION",
+ "****",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_SET_AB_START",
+ "****",
+ "CMD0_OPCODE_NPU_SET_BLOCKDEP",
+ "CMD0_OPCODE_NPU_SET_DMA0_SRC_REGION",
+ "CMD0_OPCODE_NPU_SET_DMA0_DST_REGION",
+ "CMD0_OPCODE_NPU_SET_DMA0_SIZE0",
+ "CMD0_OPCODE_NPU_SET_DMA0_SIZE1",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM2_BROADCAST",
+ "CMD0_OPCODE_NPU_SET_IFM2_SCALAR",
+ "****",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM2_PRECISION",
+ "****",
+ "****",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM2_ZERO_POINT",
+ "CMD0_OPCODE_NPU_SET_IFM2_WIDTH0_M1",
+ "CMD0_OPCODE_NPU_SET_IFM2_HEIGHT0_M1",
+ "CMD0_OPCODE_NPU_SET_IFM2_HEIGHT1_M1",
+ "CMD0_OPCODE_NPU_SET_IFM2_IB_START",
+ "****",
+ "CMD0_OPCODE_NPU_SET_IFM2_REGION",
+};
+
+static const char *cmd1_opcode_str[] = {
+ "CMD1_OPCODE_NPU_SET_IFM_BASE0",
+ "CMD1_OPCODE_NPU_SET_IFM_BASE1",
+ "CMD1_OPCODE_NPU_SET_IFM_BASE2",
+ "CMD1_OPCODE_NPU_SET_IFM_BASE3",
+ "CMD1_OPCODE_NPU_SET_IFM_STRIDE_X",
+ "CMD1_OPCODE_NPU_SET_IFM_STRIDE_Y",
+ "CMD1_OPCODE_NPU_SET_IFM_STRIDE_C",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD1_OPCODE_NPU_SET_OFM_BASE0",
+ "CMD1_OPCODE_NPU_SET_OFM_BASE1",
+ "CMD1_OPCODE_NPU_SET_OFM_BASE2",
+ "CMD1_OPCODE_NPU_SET_OFM_BASE3",
+ "CMD1_OPCODE_NPU_SET_OFM_STRIDE_X",
+ "CMD1_OPCODE_NPU_SET_OFM_STRIDE_Y",
+ "CMD1_OPCODE_NPU_SET_OFM_STRIDE_C",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD1_OPCODE_NPU_SET_WEIGHT_BASE",
+ "CMD1_OPCODE_NPU_SET_WEIGHT_LENGTH",
+ "CMD1_OPCODE_NPU_SET_SCALE_BASE",
+ "CMD1_OPCODE_NPU_SET_SCALE_LENGTH",
+ "CMD1_OPCODE_NPU_SET_OFM_SCALE",
+ "CMD1_OPCODE_NPU_SET_OPA_SCALE",
+ "CMD1_OPCODE_NPU_SET_OPB_SCALE",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD1_OPCODE_NPU_SET_DMA0_SRC",
+ "CMD1_OPCODE_NPU_SET_DMA0_DST",
+ "CMD1_OPCODE_NPU_SET_DMA0_LEN",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD1_OPCODE_NPU_SET_IFM2_BASE0",
+ "CMD1_OPCODE_NPU_SET_IFM2_BASE1",
+ "CMD1_OPCODE_NPU_SET_IFM2_BASE2",
+ "CMD1_OPCODE_NPU_SET_IFM2_BASE3",
+ "CMD1_OPCODE_NPU_SET_IFM2_STRIDE_X",
+ "CMD1_OPCODE_NPU_SET_IFM2_STRIDE_Y",
+ "CMD1_OPCODE_NPU_SET_IFM2_STRIDE_C",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED0",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED1",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED2",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED3",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED4",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED5",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED6",
+ "CMD1_OPCODE_NPU_SET_USER_DEFINED7",
+};
+
+static const char *cmd_ctrl_str[] = {
+ "CMD_CTRL_CMD0_CTRL",
+ "CMD_CTRL_CMD1_CTRL",
+};
+
+static const char *custom_dma_cs_str[] = {
+ "CUSTOM_DMA_CS_DISABLE",
+ "CUSTOM_DMA_CS_ENABLE",
+};
+
+static const char *custom_dma_str[] = {
+ "CUSTOM_DMA_NOT_IMPLEMENTED",
+ "CUSTOM_DMA_IMPLEMENTED",
+};
+
+static const char *dma_fault_src_str[] = {
+ "DMA_FAULT_SRC_AXI_M0",
+ "DMA_FAULT_SRC_AXI_M1",
+};
+
+static const char *dma_region_mode_str[] = {
+ "DMA_REGION_MODE_EXTERNAL",
+ "DMA_REGION_MODE_INTERNAL",
+};
+
+static const char *dma_stride_mode_str[] = {
+ "DMA_STRIDE_MODE_D1",
+};
+
+static const char *elementwise_mode_str[] = {
+ "ELEMENTWISE_MODE_MUL",
+ "ELEMENTWISE_MODE_ADD",
+ "ELEMENTWISE_MODE_SUB",
+ "ELEMENTWISE_MODE_MIN",
+ "ELEMENTWISE_MODE_MAX",
+ "ELEMENTWISE_MODE_LRELU",
+ "ELEMENTWISE_MODE_ABS",
+ "ELEMENTWISE_MODE_CLZ",
+ "ELEMENTWISE_MODE_SHR",
+ "ELEMENTWISE_MODE_SHL",
+};
+
+static const char *functional_safety_str[] = {
+ "FUNCTIONAL_SAFETY_NOT_IMPLEMENTED",
+ "FUNCTIONAL_SAFETY_IMPLEMENTED",
+};
+
+static const char *ifm2_operand_order_str[] = {
+ "IFM2_OPERAND_ORDER_ORDER_B",
+ "IFM2_OPERAND_ORDER_ORDER_A",
+};
+
+static const char *ifm_scale_mode_str[] = {
+ "IFM_SCALE_MODE_OPA_OPB_16",
+ "IFM_SCALE_MODE_OPA_32",
+ "IFM_SCALE_MODE_OPB_32",
+};
+
+static const char *ifm_upscale_mode_str[] = {
+ "IFM_UPSCALE_MODE_NONE",
+ "IFM_UPSCALE_MODE_NEAREST",
+ "IFM_UPSCALE_MODE_ZEROS",
+};
+
+static const char *kernel_decomposition_str[] = {
+ "KERNEL_DECOMPOSITION_D8X8",
+ "KERNEL_DECOMPOSITION_D4X4",
+};
+
+static const char *kernel_dilation_str[] = {
+ "KERNEL_DILATION_NONE",
+ "KERNEL_DILATION_X2",
+};
+
+static const char *max_beats_str[] = {
+ "MAX_BEATS_B64",
+ "MAX_BEATS_B128",
+ "MAX_BEATS_B256",
+};
+
+static const char *mem_attr_str[] = {
+ "MEM_ATTR_AXI0_OUTSTANDING_COUNTER0",
+ "MEM_ATTR_AXI0_OUTSTANDING_COUNTER1",
+ "MEM_ATTR_AXI1_OUTSTANDING_COUNTER2",
+ "MEM_ATTR_AXI1_OUTSTANDING_COUNTER3",
+};
+
+static const char *ofm_scale_mode_str[] = {
+ "OFM_SCALE_MODE_PER_CHANNEL",
+ "OFM_SCALE_MODE_GLOBAL",
+};
+
+static const char *pmu_axi_channel_str[] = {
+ "PMU_AXI_CHANNEL_RD_CMD",
+ "PMU_AXI_CHANNEL_RD_IFM",
+ "PMU_AXI_CHANNEL_RD_WEIGHTS",
+ "PMU_AXI_CHANNEL_RD_SCALE_BIAS",
+ "PMU_AXI_CHANNEL_RD_MEM2MEM",
+ "****",
+ "****",
+ "****",
+ "PMU_AXI_CHANNEL_WR_OFM",
+ "PMU_AXI_CHANNEL_WR_MEM2MEM",
+};
+
+static const char *pmu_event_str[] = {
+ "PMU_EVENT_NO_EVENT",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_CYCLE",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_NPU_IDLE",
+ "PMU_EVENT_CC_STALLED_ON_BLOCKDEP",
+ "PMU_EVENT_CC_STALLED_ON_SHRAM_RECONFIG",
+ "PMU_EVENT_NPU_ACTIVE",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_MAC_ACTIVE",
+ "PMU_EVENT_MAC_ACTIVE_8BIT",
+ "PMU_EVENT_MAC_ACTIVE_16BIT",
+ "PMU_EVENT_MAC_DPU_ACTIVE",
+ "PMU_EVENT_MAC_STALLED_BY_WD_ACC",
+ "PMU_EVENT_MAC_STALLED_BY_WD",
+ "PMU_EVENT_MAC_STALLED_BY_ACC",
+ "PMU_EVENT_MAC_STALLED_BY_IB",
+ "PMU_EVENT_MAC_ACTIVE_32BIT",
+ "PMU_EVENT_MAC_STALLED_BY_INT_W",
+ "PMU_EVENT_MAC_STALLED_BY_INT_ACC",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_AO_ACTIVE",
+ "PMU_EVENT_AO_ACTIVE_8BIT",
+ "PMU_EVENT_AO_ACTIVE_16BIT",
+ "PMU_EVENT_AO_STALLED_BY_OFMP_OB",
+ "PMU_EVENT_AO_STALLED_BY_OFMP",
+ "PMU_EVENT_AO_STALLED_BY_OB",
+ "PMU_EVENT_AO_STALLED_BY_ACC_IB",
+ "PMU_EVENT_AO_STALLED_BY_ACC",
+ "PMU_EVENT_AO_STALLED_BY_IB",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_WD_ACTIVE",
+ "PMU_EVENT_WD_STALLED",
+ "PMU_EVENT_WD_STALLED_BY_WS",
+ "PMU_EVENT_WD_STALLED_BY_WD_BUF",
+ "PMU_EVENT_WD_PARSE_ACTIVE",
+ "PMU_EVENT_WD_PARSE_STALLED",
+ "PMU_EVENT_WD_PARSE_STALLED_IN",
+ "PMU_EVENT_WD_PARSE_STALLED_OUT",
+ "PMU_EVENT_WD_TRANS_WS",
+ "PMU_EVENT_WD_TRANS_WB",
+ "PMU_EVENT_WD_TRANS_DW0",
+ "PMU_EVENT_WD_TRANS_DW1",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_AXI0_RD_TRANS_ACCEPTED",
+ "PMU_EVENT_AXI0_RD_TRANS_COMPLETED",
+ "PMU_EVENT_AXI0_RD_DATA_BEAT_RECEIVED",
+ "PMU_EVENT_AXI0_RD_TRAN_REQ_STALLED",
+ "PMU_EVENT_AXI0_WR_TRANS_ACCEPTED",
+ "PMU_EVENT_AXI0_WR_TRANS_COMPLETED_M",
+ "PMU_EVENT_AXI0_WR_TRANS_COMPLETED_S",
+ "PMU_EVENT_AXI0_WR_DATA_BEAT_WRITTEN",
+ "PMU_EVENT_AXI0_WR_TRAN_REQ_STALLED",
+ "PMU_EVENT_AXI0_WR_DATA_BEAT_STALLED",
+ "****",
+ "****",
+ "PMU_EVENT_AXI0_ENABLED_CYCLES",
+ "****",
+ "PMU_EVENT_AXI0_RD_STALL_LIMIT",
+ "PMU_EVENT_AXI0_WR_STALL_LIMIT",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_AXI_LATENCY_ANY",
+ "PMU_EVENT_AXI_LATENCY_32",
+ "PMU_EVENT_AXI_LATENCY_64",
+ "PMU_EVENT_AXI_LATENCY_128",
+ "PMU_EVENT_AXI_LATENCY_256",
+ "PMU_EVENT_AXI_LATENCY_512",
+ "PMU_EVENT_AXI_LATENCY_1024",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_ECC_DMA",
+ "PMU_EVENT_ECC_SB0",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_AXI1_RD_TRANS_ACCEPTED",
+ "PMU_EVENT_AXI1_RD_TRANS_COMPLETED",
+ "PMU_EVENT_AXI1_RD_DATA_BEAT_RECEIVED",
+ "PMU_EVENT_AXI1_RD_TRAN_REQ_STALLED",
+ "PMU_EVENT_AXI1_WR_TRANS_ACCEPTED",
+ "PMU_EVENT_AXI1_WR_TRANS_COMPLETED_M",
+ "PMU_EVENT_AXI1_WR_TRANS_COMPLETED_S",
+ "PMU_EVENT_AXI1_WR_DATA_BEAT_WRITTEN",
+ "PMU_EVENT_AXI1_WR_TRAN_REQ_STALLED",
+ "PMU_EVENT_AXI1_WR_DATA_BEAT_STALLED",
+ "****",
+ "****",
+ "PMU_EVENT_AXI1_ENABLED_CYCLES",
+ "****",
+ "PMU_EVENT_AXI1_RD_STALL_LIMIT",
+ "PMU_EVENT_AXI1_WR_STALL_LIMIT",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "****",
+ "PMU_EVENT_ECC_SB1",
+};
+
+static const char *pooling_mode_str[] = {
+ "POOLING_MODE_MAX",
+ "POOLING_MODE_AVERAGE",
+ "POOLING_MODE_REDUCE_SUM",
+};
+
+static const char *privilege_level_str[] = {
+ "PRIVILEGE_LEVEL_USER",
+ "PRIVILEGE_LEVEL_PRIVILEGED",
+};
+
+static const char *round_mode_str[] = {
+ "ROUND_MODE_DBL",
+ "ROUND_MODE_TRUNCATE",
+ "ROUND_MODE_NATURAL",
+};
+
+static const char *security_level_str[] = {
+ "SECURITY_LEVEL_SECURE",
+ "SECURITY_LEVEL_NON_SECURE",
+};
+
+static const char *state_str[] = {
+ "STATE_STOPPED",
+ "STATE_RUNNING",
+};
+
+static const char *wd_core_slice_state_str[] = {
+ "WD_CORE_SLICE_STATE_HEADER",
+ "WD_CORE_SLICE_STATE_PALETTE",
+ "WD_CORE_SLICE_STATE_WEIGHTS",
+};
+
+static const char *wd_ctrl_state_str[] = {
+ "WD_CTRL_STATE_IDLE",
+ "WD_CTRL_STATE_DRAIN",
+ "WD_CTRL_STATE_OFD_INIT",
+ "WD_CTRL_STATE_OFD_RUN",
+};
+
+static const char *weight_order_str[] = {
+ "WEIGHT_ORDER_DEPTH_FIRST",
+ "WEIGHT_ORDER_PART_KERNEL_FIRST",
+};
+
+#endif
+
+// Register type structs
+// id_r - ID register
+struct id_r
+{
+#ifndef __cplusplus
union
{
struct
@@ -1276,7 +2492,7 @@ struct id_r
uint32_t version_status : 4; // This is the version of the product
uint32_t version_minor : 4; // This is the n for the P part of an RnPn release number
uint32_t version_major : 4; // This is the n for the R part of an RnPn release number
- uint32_t product_major : 4; // This is the X part of the ML00X product number
+ uint32_t product_major : 4; // Product major ID number (unique per base product)
uint32_t arch_patch_rev : 4; // This is the patch number of the architecture version a.b
uint32_t
arch_minor_rev : 8; // This is the minor architecture version number, b in the architecture version a.b
@@ -1285,31 +2501,28 @@ struct id_r
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR id_r() :
- version_status(static_cast(1)), version_minor(static_cast(0x0)),
- version_major(static_cast(0x1)), product_major(static_cast(4)),
- arch_patch_rev(static_cast(6)), arch_minor_rev(static_cast(0)),
- arch_major_rev(static_cast(1))
- {
- }
- CONSTEXPR id_r(uint32_t init) : word(init) {}
+ CONSTEXPR id_r() : word0(269500929) {}
+ CONSTEXPR id_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
id_r copy() volatile
{
@@ -1317,118 +2530,151 @@ struct id_r
}
CONSTEXPR uint32_t get_version_status() const
{
- uint32_t value = static_cast(version_status);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 0);
return value;
}
uint32_t get_version_status() const volatile
{
- uint32_t value = static_cast(version_status);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 0);
return value;
}
CONSTEXPR id_r &set_version_status(uint32_t value)
{
- version_status = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 0) & word0) | ((((1U << 4) - 1) & value) << 0);
+ return *this;
+ }
+ volatile id_r &set_version_status(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 0) & word0) | ((((1U << 4) - 1) & value) << 0);
return *this;
}
CONSTEXPR uint32_t get_version_minor() const
{
- uint32_t value = static_cast(version_minor);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 4);
return value;
}
uint32_t get_version_minor() const volatile
{
- uint32_t value = static_cast(version_minor);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 4);
return value;
}
CONSTEXPR id_r &set_version_minor(uint32_t value)
{
- version_minor = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 4) & word0) | ((((1U << 4) - 1) & value) << 4);
+ return *this;
+ }
+ volatile id_r &set_version_minor(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 4) & word0) | ((((1U << 4) - 1) & value) << 4);
return *this;
}
CONSTEXPR uint32_t get_version_major() const
{
- uint32_t value = static_cast(version_major);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 8);
return value;
}
uint32_t get_version_major() const volatile
{
- uint32_t value = static_cast(version_major);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 8);
return value;
}
CONSTEXPR id_r &set_version_major(uint32_t value)
{
- version_major = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 8) & word0) | ((((1U << 4) - 1) & value) << 8);
return *this;
}
- CONSTEXPR uint32_t get_product_major() const
+ volatile id_r &set_version_major(uint32_t value) volatile
{
- uint32_t value = static_cast(product_major);
+ word0 = (((~((1U << 4) - 1)) << 8) & word0) | ((((1U << 4) - 1) & value) << 8);
+ return *this;
+ }
+ CONSTEXPR uint32_t get_product_major() const
+ {
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 12);
return value;
}
uint32_t get_product_major() const volatile
{
- uint32_t value = static_cast(product_major);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 12);
return value;
}
CONSTEXPR id_r &set_product_major(uint32_t value)
{
- product_major = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 12) & word0) | ((((1U << 4) - 1) & value) << 12);
+ return *this;
+ }
+ volatile id_r &set_product_major(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 12) & word0) | ((((1U << 4) - 1) & value) << 12);
return *this;
}
CONSTEXPR uint32_t get_arch_patch_rev() const
{
- uint32_t value = static_cast(arch_patch_rev);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 16);
return value;
}
uint32_t get_arch_patch_rev() const volatile
{
- uint32_t value = static_cast(arch_patch_rev);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 16);
return value;
}
CONSTEXPR id_r &set_arch_patch_rev(uint32_t value)
{
- arch_patch_rev = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 16) & word0) | ((((1U << 4) - 1) & value) << 16);
+ return *this;
+ }
+ volatile id_r &set_arch_patch_rev(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 16) & word0) | ((((1U << 4) - 1) & value) << 16);
return *this;
}
CONSTEXPR uint32_t get_arch_minor_rev() const
{
- uint32_t value = static_cast(arch_minor_rev);
+ uint32_t value = ((1U << 8) - 1) & (word0 >> 20);
return value;
}
uint32_t get_arch_minor_rev() const volatile
{
- uint32_t value = static_cast(arch_minor_rev);
+ uint32_t value = ((1U << 8) - 1) & (word0 >> 20);
return value;
}
CONSTEXPR id_r &set_arch_minor_rev(uint32_t value)
{
- arch_minor_rev = ((1u << 8) - 1) & static_cast(value);
+ word0 = (((~((1U << 8) - 1)) << 20) & word0) | ((((1U << 8) - 1) & value) << 20);
+ return *this;
+ }
+ volatile id_r &set_arch_minor_rev(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 8) - 1)) << 20) & word0) | ((((1U << 8) - 1) & value) << 20);
return *this;
}
CONSTEXPR uint32_t get_arch_major_rev() const
{
- uint32_t value = static_cast(arch_major_rev);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 28);
return value;
}
uint32_t get_arch_major_rev() const volatile
{
- uint32_t value = static_cast(arch_major_rev);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 28);
return value;
}
CONSTEXPR id_r &set_arch_major_rev(uint32_t value)
{
- arch_major_rev = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 28) & word0) | ((((1U << 4) - 1) & value) << 28);
+ return *this;
+ }
+ volatile id_r &set_arch_major_rev(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 28) & word0) | ((((1U << 4) - 1) & value) << 28);
return *this;
}
-#endif //__cplusplus
+#endif
};
// status_r - Register describes the current operating status of the NPU
struct status_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
struct
@@ -1452,235 +2698,287 @@ struct status_r
uint32_t ecc_fault : 1; // ECC state for internal RAMs: 0=no fault 1=ECC fault signalled. Can only be
// cleared by reset
uint32_t reserved0 : 2;
- uint32_t faulting_interface : 1; // Faulting interface on bus abort. 0=AXI-M0 1=AXI-M1
+ uint32_t faulting_interface : 1; // Faulting interface on bus abort
uint32_t faulting_channel : 4; // Faulting channel on a bus abort. Read: 0=Cmd 1=IFM 2=Weights 3=Scale+Bias
// 4=Mem2Mem; Write: 8=OFM 9=Mem2Mem
uint32_t irq_history_mask : 16; // IRQ History mask
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR status_r() :
- state(static_cast(::state::STOPPED)), irq_raised(static_cast(0x0)),
- bus_status(static_cast(0x0)), reset_status(static_cast(0x1)),
- cmd_parse_error(static_cast(0x0)), cmd_end_reached(static_cast(0x0)),
- pmu_irq_raised(static_cast(0x0)), wd_fault(static_cast(0x0)),
- ecc_fault(static_cast(0x0)), reserved0(static_cast(0)),
- faulting_interface(static_cast(0x0)), faulting_channel(static_cast(0x0)),
- irq_history_mask(static_cast(0x0))
- {
- }
- CONSTEXPR status_r(uint32_t init) : word(init) {}
+ CONSTEXPR status_r() : word0(8) {}
+ CONSTEXPR status_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
status_r copy() volatile
{
return *this;
}
- CONSTEXPR ::state get_state() const
+ CONSTEXPR NPU_NAMESPACE::state get_state() const
{
- ::state value = static_cast<::state>(state);
+ NPU_NAMESPACE::state value = static_cast(((1U << 1) - 1) & (word0 >> 0));
return value;
}
- ::state get_state() const volatile
+ NPU_NAMESPACE::state get_state() const volatile
{
- ::state value = static_cast<::state>(state);
+ NPU_NAMESPACE::state value = static_cast(((1U << 1) - 1) & (word0 >> 0));
return value;
}
- CONSTEXPR status_r &set_state(::state value)
+ CONSTEXPR status_r &set_state(NPU_NAMESPACE::state value)
+ {
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 0);
+ return *this;
+ }
+ volatile status_r &set_state(NPU_NAMESPACE::state value) volatile
{
- state = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 0);
return *this;
}
CONSTEXPR uint32_t get_irq_raised() const
{
- uint32_t value = static_cast(irq_raised);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 1);
return value;
}
uint32_t get_irq_raised() const volatile
{
- uint32_t value = static_cast(irq_raised);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 1);
return value;
}
CONSTEXPR status_r &set_irq_raised(uint32_t value)
{
- irq_raised = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & value) << 1);
+ return *this;
+ }
+ volatile status_r &set_irq_raised(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & value) << 1);
return *this;
}
CONSTEXPR uint32_t get_bus_status() const
{
- uint32_t value = static_cast(bus_status);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 2);
return value;
}
uint32_t get_bus_status() const volatile
{
- uint32_t value = static_cast(bus_status);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 2);
return value;
}
CONSTEXPR status_r &set_bus_status(uint32_t value)
{
- bus_status = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 2) & word0) | ((((1U << 1) - 1) & value) << 2);
+ return *this;
+ }
+ volatile status_r &set_bus_status(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 2) & word0) | ((((1U << 1) - 1) & value) << 2);
return *this;
}
CONSTEXPR uint32_t get_reset_status() const
{
- uint32_t value = static_cast(reset_status);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 3);
return value;
}
uint32_t get_reset_status() const volatile
{
- uint32_t value = static_cast(reset_status);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 3);
return value;
}
CONSTEXPR status_r &set_reset_status(uint32_t value)
{
- reset_status = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 3) & word0) | ((((1U << 1) - 1) & value) << 3);
+ return *this;
+ }
+ volatile status_r &set_reset_status(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 3) & word0) | ((((1U << 1) - 1) & value) << 3);
return *this;
}
CONSTEXPR uint32_t get_cmd_parse_error() const
{
- uint32_t value = static_cast(cmd_parse_error);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 4);
return value;
}
uint32_t get_cmd_parse_error() const volatile
{
- uint32_t value = static_cast(cmd_parse_error);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 4);
return value;
}
CONSTEXPR status_r &set_cmd_parse_error(uint32_t value)
{
- cmd_parse_error = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 4) & word0) | ((((1U << 1) - 1) & value) << 4);
+ return *this;
+ }
+ volatile status_r &set_cmd_parse_error(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 4) & word0) | ((((1U << 1) - 1) & value) << 4);
return *this;
}
CONSTEXPR uint32_t get_cmd_end_reached() const
{
- uint32_t value = static_cast(cmd_end_reached);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 5);
return value;
}
uint32_t get_cmd_end_reached() const volatile
{
- uint32_t value = static_cast(cmd_end_reached);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 5);
return value;
}
CONSTEXPR status_r &set_cmd_end_reached(uint32_t value)
{
- cmd_end_reached = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 5) & word0) | ((((1U << 1) - 1) & value) << 5);
+ return *this;
+ }
+ volatile status_r &set_cmd_end_reached(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 5) & word0) | ((((1U << 1) - 1) & value) << 5);
return *this;
}
CONSTEXPR uint32_t get_pmu_irq_raised() const
{
- uint32_t value = static_cast(pmu_irq_raised);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 6);
return value;
}
uint32_t get_pmu_irq_raised() const volatile
{
- uint32_t value = static_cast(pmu_irq_raised);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 6);
return value;
}
CONSTEXPR status_r &set_pmu_irq_raised(uint32_t value)
{
- pmu_irq_raised = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 6) & word0) | ((((1U << 1) - 1) & value) << 6);
+ return *this;
+ }
+ volatile status_r &set_pmu_irq_raised(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 6) & word0) | ((((1U << 1) - 1) & value) << 6);
return *this;
}
CONSTEXPR uint32_t get_wd_fault() const
{
- uint32_t value = static_cast(wd_fault);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 7);
return value;
}
uint32_t get_wd_fault() const volatile
{
- uint32_t value = static_cast(wd_fault);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 7);
return value;
}
CONSTEXPR status_r &set_wd_fault(uint32_t value)
{
- wd_fault = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 7) & word0) | ((((1U << 1) - 1) & value) << 7);
+ return *this;
+ }
+ volatile status_r &set_wd_fault(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 7) & word0) | ((((1U << 1) - 1) & value) << 7);
return *this;
}
CONSTEXPR uint32_t get_ecc_fault() const
{
- uint32_t value = static_cast(ecc_fault);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 8);
return value;
}
uint32_t get_ecc_fault() const volatile
{
- uint32_t value = static_cast(ecc_fault);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 8);
return value;
}
CONSTEXPR status_r &set_ecc_fault(uint32_t value)
{
- ecc_fault = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 8) & word0) | ((((1U << 1) - 1) & value) << 8);
+ return *this;
+ }
+ volatile status_r &set_ecc_fault(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 8) & word0) | ((((1U << 1) - 1) & value) << 8);
return *this;
}
- CONSTEXPR uint32_t get_faulting_interface() const
+ CONSTEXPR NPU_NAMESPACE::dma_fault_src get_faulting_interface() const
{
- uint32_t value = static_cast(faulting_interface);
+ NPU_NAMESPACE::dma_fault_src value = static_cast(((1U << 1) - 1) & (word0 >> 11));
return value;
}
- uint32_t get_faulting_interface() const volatile
+ NPU_NAMESPACE::dma_fault_src get_faulting_interface() const volatile
{
- uint32_t value = static_cast(faulting_interface);
+ NPU_NAMESPACE::dma_fault_src value = static_cast(((1U << 1) - 1) & (word0 >> 11));
return value;
}
- CONSTEXPR status_r &set_faulting_interface(uint32_t value)
+ CONSTEXPR status_r &set_faulting_interface(NPU_NAMESPACE::dma_fault_src value)
+ {
+ word0 = (((~((1U << 1) - 1)) << 11) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 11);
+ return *this;
+ }
+ volatile status_r &set_faulting_interface(NPU_NAMESPACE::dma_fault_src value) volatile
{
- faulting_interface = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 11) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 11);
return *this;
}
CONSTEXPR uint32_t get_faulting_channel() const
{
- uint32_t value = static_cast(faulting_channel);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 12);
return value;
}
uint32_t get_faulting_channel() const volatile
{
- uint32_t value = static_cast(faulting_channel);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 12);
return value;
}
CONSTEXPR status_r &set_faulting_channel(uint32_t value)
{
- faulting_channel = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 12) & word0) | ((((1U << 4) - 1) & value) << 12);
+ return *this;
+ }
+ volatile status_r &set_faulting_channel(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 12) & word0) | ((((1U << 4) - 1) & value) << 12);
return *this;
}
CONSTEXPR uint32_t get_irq_history_mask() const
{
- uint32_t value = static_cast(irq_history_mask);
+ uint32_t value = ((1U << 16) - 1) & (word0 >> 16);
return value;
}
uint32_t get_irq_history_mask() const volatile
{
- uint32_t value = static_cast(irq_history_mask);
+ uint32_t value = ((1U << 16) - 1) & (word0 >> 16);
return value;
}
CONSTEXPR status_r &set_irq_history_mask(uint32_t value)
{
- irq_history_mask = ((1u << 16) - 1) & static_cast(value);
+ word0 = (((~((1U << 16) - 1)) << 16) & word0) | ((((1U << 16) - 1) & value) << 16);
+ return *this;
+ }
+ volatile status_r &set_irq_history_mask(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 16) - 1)) << 16) & word0) | ((((1U << 16) - 1) & value) << 16);
return *this;
}
-#endif //__cplusplus
+#endif
};
// cmd_r - Command register, reads as last written command
struct cmd_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
struct
@@ -1689,7 +2987,7 @@ struct cmd_r
// no effect
uint32_t clear_irq : 1; // Write 1 to clear the IRQ status in the STATUS register. Writing 0 has no effect
uint32_t clock_q_enable : 1; // Write 1 to this bit to enable clock off using clock q-interface and enable
- // the master clock gate
+ // the requester clock gate
uint32_t power_q_enable : 1; // Write 1 to this bit to enable power off using power q-interface
uint32_t
stop_request : 1; // Write 1 to this bit to request STOP after completing any already-started commands
@@ -1698,31 +2996,28 @@ struct cmd_r
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR cmd_r() :
- transition_to_running_state(static_cast(0x0)), clear_irq(static_cast(0x0)),
- clock_q_enable(static_cast(0x1)), power_q_enable(static_cast(0x1)),
- stop_request(static_cast(0x0)), reserved0(static_cast(0)),
- clear_irq_history(static_cast(0x0))
- {
- }
- CONSTEXPR cmd_r(uint32_t init) : word(init) {}
+ CONSTEXPR cmd_r() : word0(12) {}
+ CONSTEXPR cmd_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
cmd_r copy() volatile
{
@@ -1730,103 +3025,131 @@ struct cmd_r
}
CONSTEXPR uint32_t get_transition_to_running_state() const
{
- uint32_t value = static_cast(transition_to_running_state);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 0);
return value;
}
uint32_t get_transition_to_running_state() const volatile
{
- uint32_t value = static_cast(transition_to_running_state);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 0);
return value;
}
CONSTEXPR cmd_r &set_transition_to_running_state(uint32_t value)
{
- transition_to_running_state = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & value) << 0);
+ return *this;
+ }
+ volatile cmd_r &set_transition_to_running_state(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & value) << 0);
return *this;
}
CONSTEXPR uint32_t get_clear_irq() const
{
- uint32_t value = static_cast(clear_irq);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 1);
return value;
}
uint32_t get_clear_irq() const volatile
{
- uint32_t value = static_cast(clear_irq);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 1);
return value;
}
CONSTEXPR cmd_r &set_clear_irq(uint32_t value)
{
- clear_irq = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & value) << 1);
+ return *this;
+ }
+ volatile cmd_r &set_clear_irq(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & value) << 1);
return *this;
}
CONSTEXPR uint32_t get_clock_q_enable() const
{
- uint32_t value = static_cast(clock_q_enable);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 2);
return value;
}
uint32_t get_clock_q_enable() const volatile
{
- uint32_t value = static_cast(clock_q_enable);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 2);
return value;
}
CONSTEXPR cmd_r &set_clock_q_enable(uint32_t value)
{
- clock_q_enable = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 2) & word0) | ((((1U << 1) - 1) & value) << 2);
+ return *this;
+ }
+ volatile cmd_r &set_clock_q_enable(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 2) & word0) | ((((1U << 1) - 1) & value) << 2);
return *this;
}
CONSTEXPR uint32_t get_power_q_enable() const
{
- uint32_t value = static_cast(power_q_enable);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 3);
return value;
}
uint32_t get_power_q_enable() const volatile
{
- uint32_t value = static_cast(power_q_enable);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 3);
return value;
}
CONSTEXPR cmd_r &set_power_q_enable(uint32_t value)
{
- power_q_enable = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 3) & word0) | ((((1U << 1) - 1) & value) << 3);
+ return *this;
+ }
+ volatile cmd_r &set_power_q_enable(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 3) & word0) | ((((1U << 1) - 1) & value) << 3);
return *this;
}
CONSTEXPR uint32_t get_stop_request() const
{
- uint32_t value = static_cast(stop_request);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 4);
return value;
}
uint32_t get_stop_request() const volatile
{
- uint32_t value = static_cast(stop_request);
+ uint32_t value = ((1U << 1) - 1) & (word0 >> 4);
return value;
}
CONSTEXPR cmd_r &set_stop_request(uint32_t value)
{
- stop_request = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 4) & word0) | ((((1U << 1) - 1) & value) << 4);
+ return *this;
+ }
+ volatile cmd_r &set_stop_request(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 4) & word0) | ((((1U << 1) - 1) & value) << 4);
return *this;
}
CONSTEXPR uint32_t get_clear_irq_history() const
{
- uint32_t value = static_cast(clear_irq_history);
+ uint32_t value = ((1U << 16) - 1) & (word0 >> 16);
return value;
}
uint32_t get_clear_irq_history() const volatile
{
- uint32_t value = static_cast(clear_irq_history);
+ uint32_t value = ((1U << 16) - 1) & (word0 >> 16);
return value;
}
CONSTEXPR cmd_r &set_clear_irq_history(uint32_t value)
{
- clear_irq_history = ((1u << 16) - 1) & static_cast(value);
+ word0 = (((~((1U << 16) - 1)) << 16) & word0) | ((((1U << 16) - 1) & value) << 16);
+ return *this;
+ }
+ volatile cmd_r &set_clear_irq_history(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 16) - 1)) << 16) & word0) | ((((1U << 16) - 1) & value) << 16);
return *this;
}
-#endif //__cplusplus
+#endif
};
// reset_r - Request Reset and new security mode
struct reset_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
struct
@@ -1837,203 +3160,164 @@ struct reset_r
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR reset_r() :
- pending_CPL(static_cast(::privilege_level::USER)),
- pending_CSL(static_cast(::security_level::SECURE)), reserved0(static_cast(0))
- {
- }
- CONSTEXPR reset_r(uint32_t init) : word(init) {}
+ CONSTEXPR reset_r() : word0(0) {}
+ CONSTEXPR reset_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
reset_r copy() volatile
{
return *this;
}
- CONSTEXPR ::privilege_level get_pending_CPL() const
+ CONSTEXPR NPU_NAMESPACE::privilege_level get_pending_CPL() const
{
- ::privilege_level value = static_cast<::privilege_level>(pending_CPL);
+ NPU_NAMESPACE::privilege_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 0));
return value;
}
- ::privilege_level get_pending_CPL() const volatile
+ NPU_NAMESPACE::privilege_level get_pending_CPL() const volatile
{
- ::privilege_level value = static_cast<::privilege_level>(pending_CPL);
+ NPU_NAMESPACE::privilege_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 0));
return value;
}
- CONSTEXPR reset_r &set_pending_CPL(::privilege_level value)
+ CONSTEXPR reset_r &set_pending_CPL(NPU_NAMESPACE::privilege_level value)
{
- pending_CPL = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 0);
return *this;
}
- CONSTEXPR ::security_level get_pending_CSL() const
- {
- ::security_level value = static_cast<::security_level>(pending_CSL);
- return value;
- }
- ::security_level get_pending_CSL() const volatile
- {
- ::security_level value = static_cast<::security_level>(pending_CSL);
- return value;
- }
- CONSTEXPR reset_r &set_pending_CSL(::security_level value)
+ volatile reset_r &set_pending_CPL(NPU_NAMESPACE::privilege_level value) volatile
{
- pending_CSL = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 0);
return *this;
}
-#endif //__cplusplus
-};
-
-// qbase0_r - Base address of command queue bits [31:0]. The address is 4 byte aligned
-struct qbase0_r
-{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
- union
- {
- uint32_t QBASE0; // The 4 byte aligned lower bytes of the base address value for the command stream
- uint32_t word;
- };
-#ifdef __cplusplus
- public:
- CONSTEXPR qbase0_r() : QBASE0(static_cast(0x00000000)) {}
- CONSTEXPR qbase0_r(uint32_t init) : word(init) {}
- CONSTEXPR void operator=(uint32_t value)
- {
- word = value;
- }
- void operator=(uint32_t value) volatile
- {
- word = value;
- }
- CONSTEXPR operator uint32_t()
- {
- return word;
- }
- operator uint32_t() volatile
- {
- return word;
- }
- qbase0_r copy() volatile
+ CONSTEXPR NPU_NAMESPACE::security_level get_pending_CSL() const
{
- return *this;
+ NPU_NAMESPACE::security_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 1));
+ return value;
}
- CONSTEXPR uint32_t get_QBASE0() const
+ NPU_NAMESPACE::security_level get_pending_CSL() const volatile
{
- uint32_t value = static_cast(QBASE0);
+ NPU_NAMESPACE::security_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 1));
return value;
}
- uint32_t get_QBASE0() const volatile
+ CONSTEXPR reset_r &set_pending_CSL(NPU_NAMESPACE::security_level value)
{
- uint32_t value = static_cast(QBASE0);
- return value;
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 1);
+ return *this;
}
- CONSTEXPR qbase0_r &set_QBASE0(uint32_t value)
+ volatile reset_r &set_pending_CSL(NPU_NAMESPACE::security_level value) volatile
{
- QBASE0 = static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 1);
return *this;
}
-#endif //__cplusplus
+#endif
};
-// qbase1_r - Address extension bits [47:32] bits for queue base
-struct qbase1_r
+// qbase_r - Base address of the command stream in bytes
+struct qbase_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
- uint32_t QBASE1; // The 4 byte aligned upper bytes of the base address value for the command stream
- uint32_t word;
+ struct
+ {
+ uint32_t offset : 32; // Offset
+ uint32_t reserved0 : 32;
+ };
+ uint32_t word[2];
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+ uint32_t word1;
+
public:
- CONSTEXPR qbase1_r() : QBASE1(static_cast(0x00000000)) {}
- CONSTEXPR qbase1_r(uint32_t init) : word(init) {}
- CONSTEXPR void operator=(uint32_t value)
- {
- word = value;
- }
- void operator=(uint32_t value) volatile
- {
- word = value;
- }
- CONSTEXPR operator uint32_t()
+ CONSTEXPR qbase_r() : word0(0), word1(0) {}
+ CONSTEXPR qbase_r(uint64_t init) :
+ word0(static_cast((init)&std::numeric_limits::max())),
+ word1(static_cast((init >> 32) & std::numeric_limits::max()))
{
- return word;
}
- operator uint32_t() volatile
+ CONSTEXPR void operator=(uint64_t value)
{
- return word;
+ word0 = static_cast((value)&std::numeric_limits::max());
+ word1 = static_cast((value >> 32) & std::numeric_limits::max());
}
- qbase1_r copy() volatile
+ void operator=(uint64_t value) volatile
{
- return *this;
+ word0 = static_cast((value)&std::numeric_limits::max());
+ word1 = static_cast((value >> 32) & std::numeric_limits::max());
}
- CONSTEXPR uint32_t get_QBASE1() const
+ CONSTEXPR operator uint64_t()
{
- uint32_t value = static_cast(QBASE1);
- return value;
+ return (static_cast(word1) << 32) | word0;
}
- uint32_t get_QBASE1() const volatile
+ operator uint64_t() volatile
{
- uint32_t value = static_cast(QBASE1);
- return value;
+ return (static_cast(word1) << 32) | word0;
}
- CONSTEXPR qbase1_r &set_QBASE1(uint32_t value)
+ qbase_r copy() volatile
{
- QBASE1 = static_cast(value);
return *this;
}
-#endif //__cplusplus
+#endif
};
// qread_r - Read offset in the command stream in bytes. Multiple of 4 in the range 0 to 16 MB
struct qread_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
- uint32_t QREAD; // The read offset of the current command under execution
+ struct
+ {
+ uint32_t QREAD : 32; // The read offset of the current command under execution
+ };
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR qread_r() : QREAD(static_cast(0x00000000)) {}
- CONSTEXPR qread_r(uint32_t init) : word(init) {}
+ CONSTEXPR qread_r() : word0(0) {}
+ CONSTEXPR qread_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
qread_r copy() volatile
{
@@ -2041,105 +3325,124 @@ struct qread_r
}
CONSTEXPR uint32_t get_QREAD() const
{
- uint32_t value = static_cast(QREAD);
+ uint32_t value = word0;
return value;
}
uint32_t get_QREAD() const volatile
{
- uint32_t value = static_cast(QREAD);
+ uint32_t value = word0;
return value;
}
CONSTEXPR qread_r &set_QREAD(uint32_t value)
{
- QREAD = static_cast(value);
+ word0 = value;
+ return *this;
+ }
+ volatile qread_r &set_QREAD(uint32_t value) volatile
+ {
+ word0 = value;
return *this;
}
-#endif //__cplusplus
+#endif
};
// qconfig_r - AXI configuration for the command stream in the range 0-3. Same encoding as for REGIONCFG
struct qconfig_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
- uint32_t QCONFIG; // AXI configuration for the command stream in the range 0-3
+ struct
+ {
+ uint32_t cmd_region0 : 2; // Command region configuration
+ uint32_t reserved0 : 30;
+ };
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR qconfig_r() : QCONFIG(static_cast(0x00000000)) {}
- CONSTEXPR qconfig_r(uint32_t init) : word(init) {}
+ CONSTEXPR qconfig_r() : word0(0) {}
+ CONSTEXPR qconfig_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
qconfig_r copy() volatile
{
return *this;
}
- CONSTEXPR uint32_t get_QCONFIG() const
+ CONSTEXPR NPU_NAMESPACE::mem_attr get_cmd_region0() const
{
- uint32_t value = static_cast(QCONFIG);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 0));
return value;
}
- uint32_t get_QCONFIG() const volatile
+ NPU_NAMESPACE::mem_attr get_cmd_region0() const volatile
{
- uint32_t value = static_cast(QCONFIG);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 0));
return value;
}
- CONSTEXPR qconfig_r &set_QCONFIG(uint32_t value)
+ CONSTEXPR qconfig_r &set_cmd_region0(NPU_NAMESPACE::mem_attr value)
+ {
+ word0 = (((~((1U << 2) - 1)) << 0) & word0) | ((((1U << 2) - 1) & static_cast(value)) << 0);
+ return *this;
+ }
+ volatile qconfig_r &set_cmd_region0(NPU_NAMESPACE::mem_attr value) volatile
{
- QCONFIG = static_cast(value);
+ word0 = (((~((1U << 2) - 1)) << 0) & word0) | ((((1U << 2) - 1) & static_cast(value)) << 0);
return *this;
}
-#endif //__cplusplus
+#endif
};
// qsize_r - Size of the command stream in bytes. Multiple of 4 in the range 0 to 16 MB
struct qsize_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
- uint32_t QSIZE; // Size of the next command stream to be executed by the NPU
+ struct
+ {
+ uint32_t QSIZE : 32; // Size of the next command stream to be executed by the NPU
+ };
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR qsize_r() : QSIZE(static_cast(0x00000000)) {}
- CONSTEXPR qsize_r(uint32_t init) : word(init) {}
+ CONSTEXPR qsize_r() : word0(0) {}
+ CONSTEXPR qsize_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
qsize_r copy() volatile
{
@@ -2147,28 +3450,31 @@ struct qsize_r
}
CONSTEXPR uint32_t get_QSIZE() const
{
- uint32_t value = static_cast(QSIZE);
+ uint32_t value = word0;
return value;
}
uint32_t get_QSIZE() const volatile
{
- uint32_t value = static_cast(QSIZE);
+ uint32_t value = word0;
return value;
}
CONSTEXPR qsize_r &set_QSIZE(uint32_t value)
{
- QSIZE = static_cast(value);
+ word0 = value;
return *this;
}
-#endif //__cplusplus
+ volatile qsize_r &set_QSIZE(uint32_t value) volatile
+ {
+ word0 = value;
+ return *this;
+ }
+#endif
};
-// prot_r - Protection level configured for the NPU when acting as an AXI master
+// prot_r - Protection level configured for the NPU when acting as an AXI requester
struct prot_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
struct
@@ -2179,208 +3485,284 @@ struct prot_r
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR prot_r() :
- active_CPL(static_cast(::privilege_level::USER)),
- active_CSL(static_cast(::security_level::SECURE)), reserved0(static_cast(0))
- {
- }
- CONSTEXPR prot_r(uint32_t init) : word(init) {}
+ CONSTEXPR prot_r() : word0(0) {}
+ CONSTEXPR prot_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
prot_r copy() volatile
{
return *this;
}
- CONSTEXPR ::privilege_level get_active_CPL() const
+ CONSTEXPR NPU_NAMESPACE::privilege_level get_active_CPL() const
{
- ::privilege_level value = static_cast<::privilege_level>(active_CPL);
+ NPU_NAMESPACE::privilege_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 0));
return value;
}
- ::privilege_level get_active_CPL() const volatile
+ NPU_NAMESPACE::privilege_level get_active_CPL() const volatile
{
- ::privilege_level value = static_cast<::privilege_level>(active_CPL);
+ NPU_NAMESPACE::privilege_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 0));
return value;
}
- CONSTEXPR prot_r &set_active_CPL(::privilege_level value)
+ CONSTEXPR prot_r &set_active_CPL(NPU_NAMESPACE::privilege_level value)
+ {
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 0);
+ return *this;
+ }
+ volatile prot_r &set_active_CPL(NPU_NAMESPACE::privilege_level value) volatile
{
- active_CPL = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 0) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 0);
return *this;
}
- CONSTEXPR ::security_level get_active_CSL() const
+ CONSTEXPR NPU_NAMESPACE::security_level get_active_CSL() const
{
- ::security_level value = static_cast<::security_level>(active_CSL);
+ NPU_NAMESPACE::security_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 1));
return value;
}
- ::security_level get_active_CSL() const volatile
+ NPU_NAMESPACE::security_level get_active_CSL() const volatile
{
- ::security_level value = static_cast<::security_level>(active_CSL);
+ NPU_NAMESPACE::security_level value =
+ static_cast(((1U << 1) - 1) & (word0 >> 1));
return value;
}
- CONSTEXPR prot_r &set_active_CSL(::security_level value)
+ CONSTEXPR prot_r &set_active_CSL(NPU_NAMESPACE::security_level value)
{
- active_CSL = ((1u << 1) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 1);
return *this;
}
-#endif //__cplusplus
+ volatile prot_r &set_active_CSL(NPU_NAMESPACE::security_level value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 1) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 1);
+ return *this;
+ }
+#endif
};
// config_r - RTL configuration
struct config_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
struct
{
- uint32_t macs_per_cc : 4; // The log2(macs/clock cycle). Valid encoding range is 5 to 8 for 32 to 256
- // MACs/clock cycle.
- uint32_t cmd_stream_version : 4; // command stream version accepted by this NPU.
- uint32_t shram_size : 8; // Size in KB of SHRAM in the range 8 to 48.
- uint32_t reserved0 : 11;
- uint32_t custom_dma : 1; // Custom DMA enable bit.
- uint32_t product : 4; // Product configuration
+ uint32_t macs_per_cc : 4; // The log2(macs/clock cycle)
+ uint32_t cmd_stream_version : 4; // command stream version accepted by this NPU
+ uint32_t shram_size : 8; // Total size in KB of internal SHRAM
+ uint32_t reserved0 : 10;
+ uint32_t functional_safety : 1; // Functional safety configuration
+ uint32_t custom_dma : 1; // Custom DMA configuration
+ uint32_t product : 4; // Product configuration
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR config_r() :
- macs_per_cc(static_cast(0)), cmd_stream_version(static_cast(0x0)),
- shram_size(static_cast(0)), reserved0(static_cast(0)), product(static_cast(0))
- {
- }
- CONSTEXPR config_r(uint32_t init) : word(init) {}
+ CONSTEXPR config_r() : word0(0) {}
+ CONSTEXPR config_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
config_r copy() volatile
{
return *this;
}
- CONSTEXPR ::macs_per_cc get_macs_per_cc() const
+ CONSTEXPR uint32_t get_macs_per_cc() const
{
- ::macs_per_cc value = static_cast<::macs_per_cc>(macs_per_cc);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 0);
return value;
}
- ::macs_per_cc get_macs_per_cc() const volatile
+ uint32_t get_macs_per_cc() const volatile
{
- ::macs_per_cc value = static_cast<::macs_per_cc>(macs_per_cc);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 0);
return value;
}
- CONSTEXPR config_r &set_macs_per_cc(::macs_per_cc value)
+ CONSTEXPR config_r &set_macs_per_cc(uint32_t value)
+ {
+ word0 = (((~((1U << 4) - 1)) << 0) & word0) | ((((1U << 4) - 1) & value) << 0);
+ return *this;
+ }
+ volatile config_r &set_macs_per_cc(uint32_t value) volatile
{
- macs_per_cc = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 0) & word0) | ((((1U << 4) - 1) & value) << 0);
return *this;
}
CONSTEXPR uint32_t get_cmd_stream_version() const
{
- uint32_t value = static_cast(cmd_stream_version);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 4);
return value;
}
uint32_t get_cmd_stream_version() const volatile
{
- uint32_t value = static_cast(cmd_stream_version);
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 4);
return value;
}
CONSTEXPR config_r &set_cmd_stream_version(uint32_t value)
{
- cmd_stream_version = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 4) - 1)) << 4) & word0) | ((((1U << 4) - 1) & value) << 4);
+ return *this;
+ }
+ volatile config_r &set_cmd_stream_version(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 4) & word0) | ((((1U << 4) - 1) & value) << 4);
return *this;
}
- CONSTEXPR ::shram_size get_shram_size() const
+ CONSTEXPR uint32_t get_shram_size() const
{
- ::shram_size value = static_cast<::shram_size>(shram_size);
+ uint32_t value = ((1U << 8) - 1) & (word0 >> 8);
return value;
}
- ::shram_size get_shram_size() const volatile
+ uint32_t get_shram_size() const volatile
{
- ::shram_size value = static_cast<::shram_size>(shram_size);
+ uint32_t value = ((1U << 8) - 1) & (word0 >> 8);
return value;
}
- CONSTEXPR config_r &set_shram_size(::shram_size value)
+ CONSTEXPR config_r &set_shram_size(uint32_t value)
{
- shram_size = ((1u << 8) - 1) & static_cast(value);
+ word0 = (((~((1U << 8) - 1)) << 8) & word0) | ((((1U << 8) - 1) & value) << 8);
return *this;
}
- CONSTEXPR uint32_t get_product() const
+ volatile config_r &set_shram_size(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 8) - 1)) << 8) & word0) | ((((1U << 8) - 1) & value) << 8);
+ return *this;
+ }
+ CONSTEXPR NPU_NAMESPACE::functional_safety get_functional_safety() const
{
- uint32_t value = static_cast(product);
+ NPU_NAMESPACE::functional_safety value =
+ static_cast(((1U << 1) - 1) & (word0 >> 26));
return value;
}
- uint32_t get_product() const volatile
+ NPU_NAMESPACE::functional_safety get_functional_safety() const volatile
{
- uint32_t value = static_cast(product);
+ NPU_NAMESPACE::functional_safety value =
+ static_cast(((1U << 1) - 1) & (word0 >> 26));
return value;
}
- CONSTEXPR config_r &set_product(uint32_t value)
+ CONSTEXPR config_r &set_functional_safety(NPU_NAMESPACE::functional_safety value)
{
- product = ((1u << 4) - 1) & static_cast(value);
+ word0 = (((~((1U << 1) - 1)) << 26) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 26);
return *this;
}
-#endif //__cplusplus
-};
-
-// lock_r - Lock register. This register is designed for driver use and does not affect NPU functionality
-struct lock_r
-{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
- union
- {
- uint32_t LOCK; // 32 bit value for LOCK configuration
- uint32_t word;
- };
-#ifdef __cplusplus
- public:
- CONSTEXPR lock_r() : LOCK(static_cast(0x00000000)) {}
- CONSTEXPR lock_r(uint32_t init) : word(init) {}
- CONSTEXPR void operator=(uint32_t value)
+ volatile config_r &set_functional_safety(NPU_NAMESPACE::functional_safety value) volatile
{
- word = value;
+ word0 = (((~((1U << 1) - 1)) << 26) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 26);
+ return *this;
}
- void operator=(uint32_t value) volatile
+ CONSTEXPR NPU_NAMESPACE::custom_dma get_custom_dma() const
{
- word = value;
+ NPU_NAMESPACE::custom_dma value = static_cast(((1U << 1) - 1) & (word0 >> 27));
+ return value;
}
- CONSTEXPR operator uint32_t()
+ NPU_NAMESPACE::custom_dma get_custom_dma() const volatile
{
- return word;
+ NPU_NAMESPACE::custom_dma value = static_cast(((1U << 1) - 1) & (word0 >> 27));
+ return value;
+ }
+ CONSTEXPR config_r &set_custom_dma(NPU_NAMESPACE::custom_dma value)
+ {
+ word0 = (((~((1U << 1) - 1)) << 27) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 27);
+ return *this;
+ }
+ volatile config_r &set_custom_dma(NPU_NAMESPACE::custom_dma value) volatile
+ {
+ word0 = (((~((1U << 1) - 1)) << 27) & word0) | ((((1U << 1) - 1) & static_cast(value)) << 27);
+ return *this;
+ }
+ CONSTEXPR uint32_t get_product() const
+ {
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 28);
+ return value;
+ }
+ uint32_t get_product() const volatile
+ {
+ uint32_t value = ((1U << 4) - 1) & (word0 >> 28);
+ return value;
+ }
+ CONSTEXPR config_r &set_product(uint32_t value)
+ {
+ word0 = (((~((1U << 4) - 1)) << 28) & word0) | ((((1U << 4) - 1) & value) << 28);
+ return *this;
+ }
+ volatile config_r &set_product(uint32_t value) volatile
+ {
+ word0 = (((~((1U << 4) - 1)) << 28) & word0) | ((((1U << 4) - 1) & value) << 28);
+ return *this;
+ }
+#endif
+};
+
+// lock_r - Lock register. This register is designed for driver use and does not affect NPU functionality
+struct lock_r
+{
+#ifndef __cplusplus
+ union
+ {
+ struct
+ {
+ uint32_t LOCK : 32; // 32 bit value for LOCK configuration
+ };
+ uint32_t word;
+ };
+#else
+ private:
+ uint32_t word0;
+
+ public:
+ CONSTEXPR lock_r() : word0(0) {}
+ CONSTEXPR lock_r(uint32_t init) : word0(init) {}
+ CONSTEXPR void operator=(uint32_t value)
+ {
+ word0 = value;
+ }
+ void operator=(uint32_t value) volatile
+ {
+ word0 = value;
+ }
+ CONSTEXPR operator uint32_t()
+ {
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
lock_r copy() volatile
{
@@ -2388,6371 +3770,12576 @@ struct lock_r
}
CONSTEXPR uint32_t get_LOCK() const
{
- uint32_t value = static_cast(LOCK);
+ uint32_t value = word0;
return value;
}
uint32_t get_LOCK() const volatile
{
- uint32_t value = static_cast(LOCK);
+ uint32_t value = word0;
return value;
}
CONSTEXPR lock_r &set_LOCK(uint32_t value)
{
- LOCK = static_cast(value);
+ word0 = value;
+ return *this;
+ }
+ volatile lock_r &set_LOCK(uint32_t value) volatile
+ {
+ word0 = value;
return *this;
}
-#endif //__cplusplus
+#endif
};
// regioncfg_r - Region memory type configuration. Bits[2*k+1:2*k] give the memory type for REGION[k]
struct regioncfg_r
{
-#ifdef __cplusplus
- private:
-#endif //__cplusplus
+#ifndef __cplusplus
union
{
struct
{
- uint32_t region0 : 2; // Bits for Region0 Configurion
- uint32_t region1 : 2; // Bits for Region1 Configurion
- uint32_t region2 : 2; // Bits for Region2 Configurion
- uint32_t region3 : 2; // Bits for Region3 Configurion
- uint32_t region4 : 2; // Bits for Region4 Configurion
- uint32_t region5 : 2; // Bits for Region5 Configurion
- uint32_t region6 : 2; // Bits for Region6 Configurion
- uint32_t region7 : 2; // Bits for Region7 Configurion
+ uint32_t region0 : 2; // Bits for Region0 Configuration
+ uint32_t region1 : 2; // Bits for Region1 Configuration
+ uint32_t region2 : 2; // Bits for Region2 Configuration
+ uint32_t region3 : 2; // Bits for Region3 Configuration
+ uint32_t region4 : 2; // Bits for Region4 Configuration
+ uint32_t region5 : 2; // Bits for Region5 Configuration
+ uint32_t region6 : 2; // Bits for Region6 Configuration
+ uint32_t region7 : 2; // Bits for Region7 Configuration
uint32_t reserved0 : 16;
};
uint32_t word;
};
-#ifdef __cplusplus
+#else
+ private:
+ uint32_t word0;
+
public:
- CONSTEXPR regioncfg_r() :
- region0(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region1(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region2(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region3(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region4(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region5(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region6(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)),
- region7(static_cast(::memory_type::AXI0_OUTSTANDING_COUNTER0)), reserved0(static_cast(0))
- {
- }
- CONSTEXPR regioncfg_r(uint32_t init) : word(init) {}
+ CONSTEXPR regioncfg_r() : word0(0) {}
+ CONSTEXPR regioncfg_r(uint32_t init) : word0(init) {}
CONSTEXPR void operator=(uint32_t value)
{
- word = value;
+ word0 = value;
}
void operator=(uint32_t value) volatile
{
- word = value;
+ word0 = value;
}
CONSTEXPR operator uint32_t()
{
- return word;
+ return word0;
}
operator uint32_t() volatile
{
- return word;
+ return word0;
}
regioncfg_r copy() volatile
{
return *this;
}
- CONSTEXPR ::memory_type get_region0() const
+ CONSTEXPR NPU_NAMESPACE::mem_attr get_region0() const
{
- ::memory_type value = static_cast<::memory_type>(region0);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 0));
return value;
}
- ::memory_type get_region0() const volatile
+ NPU_NAMESPACE::mem_attr get_region0() const volatile
{
- ::memory_type value = static_cast<::memory_type>(region0);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 0));
return value;
}
- CONSTEXPR regioncfg_r &set_region0(::memory_type value)
+ CONSTEXPR regioncfg_r &set_region0(NPU_NAMESPACE::mem_attr value)
+ {
+ word0 = (((~((1U << 2) - 1)) << 0) & word0) | ((((1U << 2) - 1) & static_cast(value)) << 0);
+ return *this;
+ }
+ volatile regioncfg_r &set_region0(NPU_NAMESPACE::mem_attr value) volatile
{
- region0 = ((1u << 2) - 1) & static_cast(value);
+ word0 = (((~((1U << 2) - 1)) << 0) & word0) | ((((1U << 2) - 1) & static_cast(value)) << 0);
return *this;
}
- CONSTEXPR ::memory_type get_region1() const
+ CONSTEXPR NPU_NAMESPACE::mem_attr get_region1() const
{
- ::memory_type value = static_cast<::memory_type>(region1);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 2));
return value;
}
- ::memory_type get_region1() const volatile
+ NPU_NAMESPACE::mem_attr get_region1() const volatile
{
- ::memory_type value = static_cast<::memory_type>(region1);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 2));
return value;
}
- CONSTEXPR regioncfg_r &set_region1(::memory_type value)
+ CONSTEXPR regioncfg_r &set_region1(NPU_NAMESPACE::mem_attr value)
+ {
+ word0 = (((~((1U << 2) - 1)) << 2) & word0) | ((((1U << 2) - 1) & static_cast(value)) << 2);
+ return *this;
+ }
+ volatile regioncfg_r &set_region1(NPU_NAMESPACE::mem_attr value) volatile
{
- region1 = ((1u << 2) - 1) & static_cast(value);
+ word0 = (((~((1U << 2) - 1)) << 2) & word0) | ((((1U << 2) - 1) & static_cast(value)) << 2);
return *this;
}
- CONSTEXPR ::memory_type get_region2() const
+ CONSTEXPR NPU_NAMESPACE::mem_attr get_region2() const
{
- ::memory_type value = static_cast<::memory_type>(region2);
+ NPU_NAMESPACE::mem_attr value = static_cast(((1U << 2) - 1) & (word0 >> 4));
return value;
}
- ::memory_type get_region2() const volatile
+ NPU_NAMESPACE::mem_attr get_region2() const volatile
{
- ::memory_type value = static_cast<::memory_type>(region2);
+ NPU_NAMESPACE::mem_attr value = static_cast