# Generated module

A conversion writes a self-contained module: the emitted C, the headers a firmware project includes, and the build file its build system reads. What follows is the module produced from one small fixture model, so the shapes and the file names are real rather than illustrative.

| Fixture setting | Value |
| --- | --- |
| Module name | `demo` |
| Symbol prefix | `aot` |
| Operators | `CONV_2D` → `MAX_POOL_2D` → `CONV_2D` → `AVERAGE_POOL_2D` → `RESHAPE` → `SVDF` → `FULLY_CONNECTED` → `SOFTMAX` |
| Target | `apollo510_evb` |

:::note[Names follow the prefix]
The declarations below use this fixture’s module prefix, `aot`. A conversion that sets `module.prefix` to something else names its generated symbols under that prefix. Per-node symbols and optional interfaces still depend on the model and settings.
:::

## Module types

The `module.type` setting decides the build system the module is written for. The tree is the same module in each case; the build files and the placement differ.

### neuralspot

| Property | Value |
| --- | --- |
| Module root | `demo` |
| Build manifest | `module.mk` |
| Files | 37 |

```text
LICENSE
README.md
aot_plan.json
aot_report.json
aot_residency.json  # only with memory.dump_residency_json
includes-api/aot_average_pool_2d_3.h
includes-api/aot_common.h
includes-api/aot_compiler.h
includes-api/aot_context.h
includes-api/aot_conv_2d_0.h
includes-api/aot_conv_2d_2.h
includes-api/aot_fully_connected_6.h
includes-api/aot_kernels.h
includes-api/aot_max_pool_2d_1.h
includes-api/aot_model.h
includes-api/aot_operators.h
includes-api/aot_platform.h
includes-api/aot_reshape_4.h
includes-api/aot_softmax_7.h
includes-api/aot_svdf_5.h
includes-api/aot_tensors.h
includes-api/aot_test_case.h  # only with test.enabled
module.mk
src/aot_average_pool_2d_3.c
src/aot_constants.c
src/aot_context.c
src/aot_conv_2d_0.c
src/aot_conv_2d_2.c
src/aot_fully_connected_6.c
src/aot_kernels.c
src/aot_max_pool_2d_1.c
src/aot_model.c
src/aot_reshape_4.c
src/aot_softmax_7.c
src/aot_svdf_5.c
src/aot_tensors.c
src/aot_test_case.c  # only with test.enabled
```

| Variant | Settings | Adds | Removes |
| --- | --- | --- | --- |
| `external_arenas` | `memory.allocate_arenas=false`, `memory.dump_residency_json=true`, `test.enabled=true` | `aot_arena_const_dtcm__blob.bin` | — |

### zephyr

| Property | Value |
| --- | --- |
| Module root | `demo` |
| Build manifest | `zephyr/CMakeLists.txt`, `zephyr/Kconfig`, `zephyr/module.yml` |
| Files | 39 |

```text
LICENSE
README.md
aot_plan.json
aot_report.json
aot_residency.json  # only with memory.dump_residency_json
includes-api/aot_average_pool_2d_3.h
includes-api/aot_common.h
includes-api/aot_compiler.h
includes-api/aot_context.h
includes-api/aot_conv_2d_0.h
includes-api/aot_conv_2d_2.h
includes-api/aot_fully_connected_6.h
includes-api/aot_kernels.h
includes-api/aot_max_pool_2d_1.h
includes-api/aot_model.h
includes-api/aot_operators.h
includes-api/aot_platform.h
includes-api/aot_reshape_4.h
includes-api/aot_softmax_7.h
includes-api/aot_svdf_5.h
includes-api/aot_tensors.h
includes-api/aot_test_case.h  # only with test.enabled
src/aot_average_pool_2d_3.c
src/aot_constants.c
src/aot_context.c
src/aot_conv_2d_0.c
src/aot_conv_2d_2.c
src/aot_fully_connected_6.c
src/aot_kernels.c
src/aot_max_pool_2d_1.c
src/aot_model.c
src/aot_reshape_4.c
src/aot_softmax_7.c
src/aot_svdf_5.c
src/aot_tensors.c
src/aot_test_case.c  # only with test.enabled
zephyr/CMakeLists.txt
zephyr/Kconfig
zephyr/module.yml
```

### cmake

| Property | Value |
| --- | --- |
| Module root | `demo` |
| Build manifest | `CMakeLists.txt` |
| Files | 37 |

```text
CMakeLists.txt
LICENSE
README.md
aot_plan.json
aot_report.json
aot_residency.json  # only with memory.dump_residency_json
includes-api/aot_average_pool_2d_3.h
includes-api/aot_common.h
includes-api/aot_compiler.h
includes-api/aot_context.h
includes-api/aot_conv_2d_0.h
includes-api/aot_conv_2d_2.h
includes-api/aot_fully_connected_6.h
includes-api/aot_kernels.h
includes-api/aot_max_pool_2d_1.h
includes-api/aot_model.h
includes-api/aot_operators.h
includes-api/aot_platform.h
includes-api/aot_reshape_4.h
includes-api/aot_softmax_7.h
includes-api/aot_svdf_5.h
includes-api/aot_tensors.h
includes-api/aot_test_case.h  # only with test.enabled
src/aot_average_pool_2d_3.c
src/aot_constants.c
src/aot_context.c
src/aot_conv_2d_0.c
src/aot_conv_2d_2.c
src/aot_fully_connected_6.c
src/aot_kernels.c
src/aot_max_pool_2d_1.c
src/aot_model.c
src/aot_reshape_4.c
src/aot_softmax_7.c
src/aot_svdf_5.c
src/aot_tensors.c
src/aot_test_case.c  # only with test.enabled
```

| Variant | Settings | Adds | Removes |
| --- | --- | --- | --- |
| `external_arenas` | `memory.allocate_arenas=false`, `memory.dump_residency_json=true`, `test.enabled=true` | `aot_arena_const_dtcm__blob.bin` | — |

### nsx

| Property | Value |
| --- | --- |
| Module root | `demo` |
| Build manifest | `CMakeLists.txt`, `nsx-module.yaml` |
| Files | 38 |

```text
CMakeLists.txt
LICENSE
README.md
aot_plan.json
aot_report.json
aot_residency.json  # only with memory.dump_residency_json
includes-api/aot_average_pool_2d_3.h
includes-api/aot_common.h
includes-api/aot_compiler.h
includes-api/aot_context.h
includes-api/aot_conv_2d_0.h
includes-api/aot_conv_2d_2.h
includes-api/aot_fully_connected_6.h
includes-api/aot_kernels.h
includes-api/aot_max_pool_2d_1.h
includes-api/aot_model.h
includes-api/aot_operators.h
includes-api/aot_platform.h
includes-api/aot_reshape_4.h
includes-api/aot_softmax_7.h
includes-api/aot_svdf_5.h
includes-api/aot_tensors.h
includes-api/aot_test_case.h  # only with test.enabled
nsx-module.yaml
src/aot_average_pool_2d_3.c
src/aot_constants.c
src/aot_context.c
src/aot_conv_2d_0.c
src/aot_conv_2d_2.c
src/aot_fully_connected_6.c
src/aot_kernels.c
src/aot_max_pool_2d_1.c
src/aot_model.c
src/aot_reshape_4.c
src/aot_softmax_7.c
src/aot_svdf_5.c
src/aot_tensors.c
src/aot_test_case.c  # only with test.enabled
```

### cmsis_pack

| Property | Value |
| --- | --- |
| Module root | `demo` |
| Build manifest | `Ambiq.demo.pdsc` |
| Files | 37 |

```text
Ambiq.demo.pdsc
LICENSE
README.md
aot_plan.json
aot_report.json
aot_residency.json  # only with memory.dump_residency_json
includes-api/aot_average_pool_2d_3.h
includes-api/aot_common.h
includes-api/aot_compiler.h
includes-api/aot_context.h
includes-api/aot_conv_2d_0.h
includes-api/aot_conv_2d_2.h
includes-api/aot_fully_connected_6.h
includes-api/aot_kernels.h
includes-api/aot_max_pool_2d_1.h
includes-api/aot_model.h
includes-api/aot_operators.h
includes-api/aot_platform.h
includes-api/aot_reshape_4.h
includes-api/aot_softmax_7.h
includes-api/aot_svdf_5.h
includes-api/aot_tensors.h
includes-api/aot_test_case.h  # only with test.enabled
src/aot_average_pool_2d_3.c
src/aot_constants.c
src/aot_context.c
src/aot_conv_2d_0.c
src/aot_conv_2d_2.c
src/aot_fully_connected_6.c
src/aot_kernels.c
src/aot_max_pool_2d_1.c
src/aot_model.c
src/aot_reshape_4.c
src/aot_softmax_7.c
src/aot_svdf_5.c
src/aot_tensors.c
src/aot_test_case.c  # only with test.enabled
```

:::note[A default conversion writes fewer files]
The fixture turns on `memory.dump_residency_json` and `test.enabled`. A conversion that leaves those at their defaults writes the same module without the files marked in the trees above.
:::

## Public C API

Start with the generated model header and its model_init/model_run entry points. Check initialization and run status before using I/O views. Initialization resets persistent state and hydrates staged constants before operator initialization; repeated runs carry state until reset. Arena bindings and hydration state are module-global, so two context structs do not create independent instances. Serialize module use and keep arena storage alive.

The context input/output views and callback/user_data fields are application interfaces. Fields such as _lifecycle_state and tensor_ptrs describe implementation state and must not be modified by ordinary consumers. Optional arena binding and hydration interfaces are advanced integration contracts; test-case functions exist only when tests are enabled. See [Firmware integration](https://ambiqai.github.io/helia-aot/getting-started/integrate/) and [Memory placement](https://ambiqai.github.io/helia-aot/guide/memory-placement/) for complete usage.

The complete header inventory below also includes fixture-specific operator wrappers and shared kernel helpers. A file living in includes-api/ does not make every declaration a stable application API.

## Fixture declaration inventory

### aot_average_pool_2d_3.h

Declared in `includes-api/aot_average_pool_2d_3.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_average_pool_2d_3_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_average_pool_2d_3_run(aot_model_context_t *ctx)` | always |

### aot_context.h

Declared in `includes-api/aot_context.h`. Integration header; the declaration inventory includes internal fields and optional interfaces. Follow the public lifecycle and ownership contracts above.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_context_init(aot_model_context_t *ctx)` | always |

**aot_operator_state_t**

| Member | Value |
| --- | --- |
| `aot_op_state_init_started` | `0` |
| `aot_op_state_init_finished` | next |
| `aot_op_state_run_started` | next |
| `aot_op_state_run_finished` | next |

**aot_model_context_t**

| Field | Type | Extent |
| --- | --- | --- |
| `callback` | `aot_operator_callback` | — |
| `user_data` | `void *` | — |
| `arena_buffers` | `const void * const *` | — |
| `arena_sizes` | `const size_t *` | — |
| `_lifecycle_state` | `uint32_t` | — |
| `tensor_ptrs` | `int8_t *` | `aot_num_tensors` |
| `inputs` | `aot_tensor_io_t` | `aot_num_inputs` |
| `outputs` | `aot_tensor_io_t` | `aot_num_outputs` |

**aot_operator_callback**

| Signature | Kind |
| --- | --- |
| `void (*aot_operator_callback)(int32_t op, aot_operator_state_t state, int32_t status, void *user_data)` | function pointer |

### aot_conv_2d_0.h

Declared in `includes-api/aot_conv_2d_0.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_conv_2d_0_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_conv_2d_0_run(aot_model_context_t *ctx)` | always |

### aot_conv_2d_2.h

Declared in `includes-api/aot_conv_2d_2.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_conv_2d_2_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_conv_2d_2_run(aot_model_context_t *ctx)` | always |

### aot_fully_connected_6.h

Declared in `includes-api/aot_fully_connected_6.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_fully_connected_6_run(aot_model_context_t *ctx)` | always |

### aot_kernels.h

Declared in `includes-api/aot_kernels.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_kernel_fc_per_channel_s8(aot_model_context_t *ctx, const aot_fc_per_channel_s8_desc_t *d)` | always |

**aot_fc_per_channel_s8_desc_t**

| Field | Type | Extent |
| --- | --- | --- |
| `input_id` | `int32_t` | — |
| `output_id` | `int32_t` | — |
| `weights_id` | `int32_t` | — |
| `bias_id` | `int32_t` | — |
| `multiplier_id` | `int32_t` | — |
| `shift_id` | `int32_t` | — |
| `weight_sum_id` | `int32_t` | — |
| `weight_sum_bytes` | `int32_t` | — |
| `input_dims` | `cmsis_nn_dims` | — |
| `filter_dims` | `cmsis_nn_dims` | — |
| `bias_dims` | `cmsis_nn_dims` | — |
| `output_dims` | `cmsis_nn_dims` | — |
| `input_offset` | `int32_t` | — |
| `filter_offset` | `int32_t` | — |
| `output_offset` | `int32_t` | — |
| `activation_min` | `int32_t` | — |
| `activation_max` | `int32_t` | — |

### aot_max_pool_2d_1.h

Declared in `includes-api/aot_max_pool_2d_1.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_max_pool_2d_1_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_max_pool_2d_1_run(aot_model_context_t *ctx)` | always |

### aot_model.h

Declared in `includes-api/aot_model.h`. Integration header; the declaration inventory includes internal fields and optional interfaces. Follow the public lifecycle and ownership contracts above.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_model_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_model_run(aot_model_context_t *ctx)` | always |

### aot_platform.h

Declared in `includes-api/aot_platform.h`. Integration header; the declaration inventory includes internal fields and optional interfaces. Follow the public lifecycle and ownership contracts above.

**Macros**

| Macro | Value | Defined when |
| --- | --- | --- |
| `AOT_PUT_IN_DRAM` | — | `!defined(AOT_PUT_IN_DRAM)` |
| `AOT_PUT_IN_DRAM_INIT` | — | `!defined(AOT_PUT_IN_DRAM_INIT)` |
| `AOT_PUT_IN_MRAM_INIT` | — | `!defined(AOT_PUT_IN_MRAM_INIT)` |
| `AOT_PUT_IN_PSRAM` | — | `!defined(AOT_PUT_IN_PSRAM)` |
| `AOT_PUT_IN_PSRAM_INIT` | — | `!defined(AOT_PUT_IN_PSRAM_INIT)` |

**Macros that differ by module type**

| Macro | Module type | Value | Defined when |
| --- | --- | --- | --- |
| `AOT_PRINTF` | `neuralspot` | `ns_lp_printf` | `!defined(AOT_PRINTF)` |
| `AOT_PRINTF(...)` | `zephyr` | `printk(__VA_ARGS__)` | `(!defined(AOT_PRINTF)) && (defined(CONFIG_PRINTK))` |
| `AOT_PRINTF(...)` | `zephyr` | `((void)0)` | `(!defined(AOT_PRINTF)) && (!(defined(CONFIG_PRINTK)))` |
| `AOT_PRINTF(...)` | `cmake` | `((void)0)` | `!defined(AOT_PRINTF)` |
| `AOT_PRINTF(...)` | `nsx` | `((void)0)` | `!defined(AOT_PRINTF)` |
| `AOT_PRINTF(...)` | `cmsis_pack` | `((void)0)` | `!defined(AOT_PRINTF)` |
| `AOT_PUT_CODE_IN_ITCM` | `neuralspot` | `__attribute__((section(".itcm_text")))` | `(!defined(AOT_PUT_CODE_IN_ITCM)) && (defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION))` |
| `AOT_PUT_CODE_IN_ITCM` | `neuralspot` | — | `(!defined(AOT_PUT_CODE_IN_ITCM)) && (!(defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION)))` |
| `AOT_PUT_CODE_IN_ITCM` | `zephyr` | `__itcm_section` | `!defined(AOT_PUT_CODE_IN_ITCM)` |
| `AOT_PUT_CODE_IN_ITCM` | `cmake` | — | `!defined(AOT_PUT_CODE_IN_ITCM)` |
| `AOT_PUT_CODE_IN_ITCM` | `nsx` | `__attribute__((section(".itcm_text")))` | `(!defined(AOT_PUT_CODE_IN_ITCM)) && (defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION))` |
| `AOT_PUT_CODE_IN_ITCM` | `nsx` | — | `(!defined(AOT_PUT_CODE_IN_ITCM)) && (!(defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION)))` |
| `AOT_PUT_CODE_IN_ITCM` | `cmsis_pack` | — | `!defined(AOT_PUT_CODE_IN_ITCM)` |
| `AOT_PUT_IN_DTCM` | `neuralspot` | `NS_PUT_IN_TCM` | `!defined(AOT_PUT_IN_DTCM)` |
| `AOT_PUT_IN_DTCM` | `zephyr` | `__dtcm_bss_section` | `!defined(AOT_PUT_IN_DTCM)` |
| `AOT_PUT_IN_DTCM` | `cmake` | — | `!defined(AOT_PUT_IN_DTCM)` |
| `AOT_PUT_IN_DTCM` | `nsx` | — | `!defined(AOT_PUT_IN_DTCM)` |
| `AOT_PUT_IN_DTCM` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_DTCM)` |
| `AOT_PUT_IN_DTCM_INIT` | `neuralspot` | `NS_PUT_IN_TCM` | `!defined(AOT_PUT_IN_DTCM_INIT)` |
| `AOT_PUT_IN_DTCM_INIT` | `zephyr` | `__dtcm_data_section` | `!defined(AOT_PUT_IN_DTCM_INIT)` |
| `AOT_PUT_IN_DTCM_INIT` | `cmake` | — | `!defined(AOT_PUT_IN_DTCM_INIT)` |
| `AOT_PUT_IN_DTCM_INIT` | `nsx` | — | `!defined(AOT_PUT_IN_DTCM_INIT)` |
| `AOT_PUT_IN_DTCM_INIT` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_DTCM_INIT)` |
| `AOT_PUT_IN_ITCM` | `neuralspot` | `__attribute__((section(".itcm_text")))` | `(!defined(AOT_PUT_IN_ITCM)) && (defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION))` |
| `AOT_PUT_IN_ITCM` | `neuralspot` | — | `(!defined(AOT_PUT_IN_ITCM)) && (!(defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION)))` |
| `AOT_PUT_IN_ITCM` | `zephyr` | `__itcm_section` | `!defined(AOT_PUT_IN_ITCM)` |
| `AOT_PUT_IN_ITCM` | `cmake` | — | `!defined(AOT_PUT_IN_ITCM)` |
| `AOT_PUT_IN_ITCM` | `nsx` | — | `!defined(AOT_PUT_IN_ITCM)` |
| `AOT_PUT_IN_ITCM` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_ITCM)` |
| `AOT_PUT_IN_ITCM_INIT` | `neuralspot` | `__attribute__((section(".itcm_text")))` | `(!defined(AOT_PUT_IN_ITCM_INIT)) && (defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION))` |
| `AOT_PUT_IN_ITCM_INIT` | `neuralspot` | — | `(!defined(AOT_PUT_IN_ITCM_INIT)) && (!(defined(__GNUC__) \|\| defined(__clang__) \|\| defined(__ARMCC_VERSION)))` |
| `AOT_PUT_IN_ITCM_INIT` | `zephyr` | `__itcm_section` | `!defined(AOT_PUT_IN_ITCM_INIT)` |
| `AOT_PUT_IN_ITCM_INIT` | `cmake` | — | `!defined(AOT_PUT_IN_ITCM_INIT)` |
| `AOT_PUT_IN_ITCM_INIT` | `nsx` | — | `!defined(AOT_PUT_IN_ITCM_INIT)` |
| `AOT_PUT_IN_ITCM_INIT` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_ITCM_INIT)` |
| `AOT_PUT_IN_MRAM` | `neuralspot` | `const` | `!defined(AOT_PUT_IN_MRAM)` |
| `AOT_PUT_IN_MRAM` | `zephyr` | `const` | `!defined(AOT_PUT_IN_MRAM)` |
| `AOT_PUT_IN_MRAM` | `cmake` | — | `!defined(AOT_PUT_IN_MRAM)` |
| `AOT_PUT_IN_MRAM` | `nsx` | — | `!defined(AOT_PUT_IN_MRAM)` |
| `AOT_PUT_IN_MRAM` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_MRAM)` |
| `AOT_PUT_IN_SRAM` | `neuralspot` | `AM_SHARED_RW` | `!defined(AOT_PUT_IN_SRAM)` |
| `AOT_PUT_IN_SRAM` | `zephyr` | — | `!defined(AOT_PUT_IN_SRAM)` |
| `AOT_PUT_IN_SRAM` | `cmake` | — | `!defined(AOT_PUT_IN_SRAM)` |
| `AOT_PUT_IN_SRAM` | `nsx` | — | `!defined(AOT_PUT_IN_SRAM)` |
| `AOT_PUT_IN_SRAM` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_SRAM)` |
| `AOT_PUT_IN_SRAM_INIT` | `neuralspot` | `AM_SHARED_RW` | `!defined(AOT_PUT_IN_SRAM_INIT)` |
| `AOT_PUT_IN_SRAM_INIT` | `zephyr` | — | `!defined(AOT_PUT_IN_SRAM_INIT)` |
| `AOT_PUT_IN_SRAM_INIT` | `cmake` | — | `!defined(AOT_PUT_IN_SRAM_INIT)` |
| `AOT_PUT_IN_SRAM_INIT` | `nsx` | — | `!defined(AOT_PUT_IN_SRAM_INIT)` |
| `AOT_PUT_IN_SRAM_INIT` | `cmsis_pack` | — | `!defined(AOT_PUT_IN_SRAM_INIT)` |

### aot_reshape_4.h

Declared in `includes-api/aot_reshape_4.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_reshape_4_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_reshape_4_run(aot_model_context_t *ctx)` | always |

### aot_softmax_7.h

Declared in `includes-api/aot_softmax_7.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_softmax_7_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_softmax_7_run(aot_model_context_t *ctx)` | always |

### aot_svdf_5.h

Declared in `includes-api/aot_svdf_5.h`. Fixture implementation header. Per-node wrappers, descriptors and kernel helpers are not stable application entry points.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_svdf_5_init(aot_model_context_t *ctx)` | always |
| `int32_t aot_svdf_5_run(aot_model_context_t *ctx)` | always |

### aot_tensors.h

Declared in `includes-api/aot_tensors.h`. Integration header; the declaration inventory includes internal fields and optional interfaces. Follow the public lifecycle and ownership contracts above.

**aot_arena_region_t**

| Member | Value |
| --- | --- |
| `aot_arena_dtcm` | `0` |
| `aot_arena_persistent_dtcm` | `1` |
| `aot_arena_const_dtcm` | `2` |
| `aot_num_arena_buffers` | `3` |

**aot_status_t**

| Member | Value |
| --- | --- |
| `aot_status_ok` | `0` |
| `aot_status_bind_unknown_region` | `1` |
| `aot_status_bind_null_buffer` | `2` |
| `aot_status_bind_undersized` | `3` |
| `aot_status_bind_misaligned` | `4` |
| `aot_status_context_arena_unbound` | `10` |
| `aot_status_hydrate_uninited_context` | `11` |
| `aot_status_hydrate_null_blob` | `12` |
| `aot_status_null_context` | `13` |
| `aot_status_not_initialized` | `14` |
| `aot_status_bind_bulk_null_argument` | `100` |
| `aot_status_bind_bulk_wrong_count` | `101` |
| `aot_status_hydration_required` | `200` |

**aot_tensor_ident_t**

| Member | Value |
| --- | --- |
| `aot_tensor_0` | `0` |
| `aot_tensor_1` | `1` |
| `aot_tensor_3` | `2` |
| `aot_tensor_4` | `3` |
| `aot_tensor_5` | `4` |
| `aot_tensor_7` | `5` |
| `aot_tensor_8` | `6` |
| `aot_tensor_9` | `7` |
| `aot_tensor_10` | `8` |
| `aot_tensor_11` | `9` |
| `aot_tensor_12` | `10` |
| `aot_tensor_13` | `11` |
| `aot_tensor_14` | `12` |
| `aot_tensor_15` | `13` |
| `aot_tensor_16` | `14` |
| `aot_tensor_18` | `15` |
| `aot_tensor_19` | `16` |
| `aot_tensor_conv_2d_0_scratch` | `17` |
| `aot_tensor_conv_2d_0_weight_sum` | `18` |
| `aot_tensor_conv_2d_0_multiplier` | `19` |
| `aot_tensor_conv_2d_0_shift` | `20` |
| `aot_tensor_conv_2d_2_scratch` | `21` |
| `aot_tensor_conv_2d_2_weight_sum` | `22` |
| `aot_tensor_conv_2d_2_multiplier` | `23` |
| `aot_tensor_conv_2d_2_shift` | `24` |
| `aot_tensor_svdf_5_scratch_a` | `25` |
| `aot_tensor_svdf_5_scratch_b` | `26` |
| `aot_tensor_svdf_5_weight_sum` | `27` |
| `aot_tensor_fully_connected_6_weight_sum` | `28` |
| `aot_tensor_fully_connected_6_multiplier` | `29` |
| `aot_tensor_fully_connected_6_shift` | `30` |
| `aot_num_tensors` | `31` |

**aot_tensor_type_t**

| Member | Value |
| --- | --- |
| `aot_tensor_type_constant` | next |
| `aot_tensor_type_persistent` | next |
| `aot_tensor_type_scratch` | next |

**aot_tensor_descriptor_t**

| Field | Type | Extent |
| --- | --- | --- |
| `type` | `aot_tensor_type_t` | — |
| `region` | `aot_arena_region_t` | — |
| `offset` | `size_t` | — |
| `size` | `size_t` | — |

**aot_tensor_io_t**

| Field | Type | Extent |
| --- | --- | --- |
| `id` | `aot_tensor_ident_t` | — |
| `data` | `int8_t *` | — |
| `size` | `size_t` | — |
| `zero_point` | `int32_t` | — |
| `scale` | `float` | — |

**Data**

| Name | Type | Extent |
| --- | --- | --- |
| `aot_arena_alignments` | `const size_t` | `aot_num_arena_buffers` |
| `aot_arena_buffers` | `const void * const` | `aot_num_arena_buffers` |
| `aot_arena_sizes` | `const size_t` | `aot_num_arena_buffers` |
| `aot_inputs_id` | `const aot_tensor_ident_t` | `aot_num_inputs` |
| `aot_inputs_len` | `const int32_t` | `aot_num_inputs` |
| `aot_inputs_scale` | `const float` | `aot_num_inputs` |
| `aot_inputs_zero_point` | `const int32_t` | `aot_num_inputs` |
| `aot_outputs_id` | `const aot_tensor_ident_t` | `aot_num_outputs` |
| `aot_outputs_len` | `const int32_t` | `aot_num_outputs` |
| `aot_outputs_scale` | `const float` | `aot_num_outputs` |
| `aot_outputs_zero_point` | `const int32_t` | `aot_num_outputs` |
| `aot_tensor_descriptors` | `const aot_tensor_descriptor_t` | `aot_num_tensors` |

**Macros**

| Macro | Value | Defined when |
| --- | --- | --- |
| `AOT_PLAN_HASH` | `"2d9dd7d2dcf7b35f"` | always |
| `aot_arena_const_dtcm_alignment` | `16` | always |
| `aot_arena_const_dtcm_size` | `44104` | always |
| `aot_arena_dtcm_alignment` | `16` | always |
| `aot_arena_dtcm_size` | `5888` | always |
| `aot_arena_persistent_dtcm_alignment` | `16` | always |
| `aot_arena_persistent_dtcm_size` | `256` | always |
| `aot_input_0_nbytes` | `(768)` | always |
| `aot_input_0_size` | `(768)` | always |
| `aot_num_inputs` | `1` | always |
| `aot_num_outputs` | `1` | always |
| `aot_output_0_nbytes` | `(10)` | always |
| `aot_output_0_size` | `(10)` | always |

### aot_test_case.h

Declared in `includes-api/aot_test_case.h`. Integration header; the declaration inventory includes internal fields and optional interfaces. Follow the public lifecycle and ownership contracts above.

**Functions**

| Signature | Declared when |
| --- | --- |
| `int32_t aot_test_case_init(void)` | always |
| `int32_t aot_test_case_run(void)` | always |

### With external arenas

A module converted with `memory.allocate_arenas=false` leaves the arena memory to the caller and declares what it needs to be given:

| Declaration | Kind | Header | Module types |
| --- | --- | --- | --- |
| `int8_t aot_arena_buffers_table_any_unbound(void)` | function | `includes-api/aot_tensors.h` | `neuralspot`, `cmake` |
| `const void * const aot_arena_buffers_table_view(void)` | function | `includes-api/aot_tensors.h` | `neuralspot`, `cmake` |
| `int32_t aot_bind_arena(aot_arena_region_t region, void *buffer, size_t size)` | function | `includes-api/aot_tensors.h` | `neuralspot`, `cmake` |
| `int32_t aot_bind_arenas(void * const *buffers, const size_t *sizes, size_t n)` | function | `includes-api/aot_tensors.h` | `neuralspot`, `cmake` |

## Residency report

A conversion that sets `memory.dump_residency_json` writes `aot_residency.json` beside the module: where the planner put every tensor, and how much of each arena that used. The table illustrates the observed shape of this fixture, using the first element of each array; it is not a complete residency JSON schema. The full fixture follows verbatim.

| Field | Type |
| --- | --- |
| `arenas` | object |
| `arenas.constant` | array |
| `arenas.constant[].alignment` | number |
| `arenas.constant[].kind` | string |
| `arenas.constant[].memory` | string |
| `arenas.constant[].region_id` | number |
| `arenas.constant[].source_memory` | string |
| `arenas.constant[].tensor_count` | number |
| `arenas.constant[].total_size` | number |
| `arenas.constant[].used` | number |
| `arenas.persistent` | array |
| `arenas.persistent[].alignment` | number |
| `arenas.persistent[].memory` | string |
| `arenas.persistent[].region_id` | number |
| `arenas.persistent[].total_size` | number |
| `arenas.persistent[].used` | number |
| `arenas.scratch` | array |
| `arenas.scratch[].alignment` | number |
| `arenas.scratch[].fragmentation` | number |
| `arenas.scratch[].memory` | string |
| `arenas.scratch[].peak_live` | number |
| `arenas.scratch[].region_id` | number |
| `arenas.scratch[].total_size` | number |
| `arenas.scratch[].used` | number |
| `module_prefix` | string |
| `plan_hash` | string |
| `schema_version` | number |
| `tensor_layout_hash` | string |
| `tensors` | array |
| `tensors[].id` | string |
| `tensors[].memory` | string |
| `tensors[].offset` | number |
| `tensors[].role` | string |
| `tensors[].size` | number |
| `tensors[].source_memory` | string |

```json
{
  "arenas": {
    "constant": [
      {
        "alignment": 16,
        "kind": "cold",
        "memory": "dtcm",
        "region_id": 2,
        "source_memory": "dtcm",
        "tensor_count": 16,
        "total_size": 44104,
        "used": 44104
      }
    ],
    "persistent": [
      {
        "alignment": 16,
        "memory": "dtcm",
        "region_id": 1,
        "total_size": 256,
        "used": 256
      }
    ],
    "scratch": [
      {
        "alignment": 16,
        "fragmentation": 192,
        "memory": "dtcm",
        "peak_live": 5696,
        "region_id": 0,
        "total_size": 463544,
        "used": 5888
      }
    ]
  },
  "module_prefix": "aot",
  "plan_hash": "2d9dd7d2dcf7b35f",
  "schema_version": 4,
  "tensor_layout_hash": "5b408f45e8840559",
  "tensors": [
    {
      "id": "0",
      "memory": "dtcm",
      "offset": 0,
      "role": "scratch",
      "size": 768,
      "source_memory": "dtcm"
    },
    {
      "id": "1",
      "memory": "dtcm",
      "offset": 0,
      "role": "constant",
      "size": 432,
      "source_memory": "dtcm"
    },
    {
      "id": "3",
      "memory": "dtcm",
      "offset": 768,
      "role": "scratch",
      "size": 4096,
      "source_memory": "dtcm"
    },
    {
      "id": "4",
      "memory": "dtcm",
      "offset": 4864,
      "role": "scratch",
      "size": 1024,
      "source_memory": "dtcm"
    },
    {
      "id": "5",
      "memory": "dtcm",
      "offset": 624,
      "role": "constant",
      "size": 9216,
      "source_memory": "dtcm"
    },
    {
      "id": "7",
      "memory": "dtcm",
      "offset": 0,
      "role": "scratch",
      "size": 4096,
      "source_memory": "dtcm"
    },
    {
      "id": "8",
      "memory": "dtcm",
      "offset": 4096,
      "role": "scratch",
      "size": 1024,
      "source_memory": "dtcm"
    },
    {
      "id": "9",
      "memory": "dtcm",
      "offset": 10608,
      "role": "constant",
      "size": 8,
      "source_memory": "dtcm"
    },
    {
      "id": "10",
      "memory": "dtcm",
      "offset": 4096,
      "role": "scratch",
      "size": 1024,
      "source_memory": "dtcm"
    },
    {
      "id": "11",
      "memory": "dtcm",
      "offset": 10624,
      "role": "constant",
      "size": 32768,
      "source_memory": "dtcm"
    },
    {
      "id": "12",
      "memory": "dtcm",
      "offset": 43392,
      "role": "constant",
      "size": 128,
      "source_memory": "dtcm"
    },
    {
      "id": "13",
      "memory": "dtcm",
      "offset": 43520,
      "role": "constant",
      "size": 128,
      "source_memory": "dtcm"
    },
    {
      "id": "14",
      "memory": "dtcm",
      "offset": 0,
      "role": "persistent",
      "size": 128,
      "source_memory": "dtcm"
    },
    {
      "id": "15",
      "memory": "dtcm",
      "offset": 0,
      "role": "scratch",
      "size": 32,
      "source_memory": "dtcm"
    },
    {
      "id": "16",
      "memory": "dtcm",
      "offset": 43648,
      "role": "constant",
      "size": 320,
      "source_memory": "dtcm"
    },
    {
      "id": "18",
      "memory": "dtcm",
      "offset": 32,
      "role": "scratch",
      "size": 10,
      "source_memory": "dtcm"
    },
    {
      "id": "19",
      "memory": "dtcm",
      "offset": 0,
      "role": "scratch",
      "size": 10,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_0_multiplier",
      "memory": "dtcm",
      "offset": 496,
      "role": "constant",
      "size": 64,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_0_scratch",
      "memory": "dtcm",
      "offset": 4864,
      "role": "scratch",
      "size": 128,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_0_shift",
      "memory": "dtcm",
      "offset": 560,
      "role": "constant",
      "size": 64,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_0_weight_sum",
      "memory": "dtcm",
      "offset": 432,
      "role": "constant",
      "size": 64,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_2_multiplier",
      "memory": "dtcm",
      "offset": 10096,
      "role": "constant",
      "size": 256,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_2_scratch",
      "memory": "dtcm",
      "offset": 4096,
      "role": "scratch",
      "size": 576,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_2_shift",
      "memory": "dtcm",
      "offset": 10352,
      "role": "constant",
      "size": 256,
      "source_memory": "dtcm"
    },
    {
      "id": "conv_2d_2_weight_sum",
      "memory": "dtcm",
      "offset": 9840,
      "role": "constant",
      "size": 256,
      "source_memory": "dtcm"
    },
    {
      "id": "fully_connected_6_multiplier",
      "memory": "dtcm",
      "offset": 44016,
      "role": "constant",
      "size": 40,
      "source_memory": "dtcm"
    },
    {
      "id": "fully_connected_6_shift",
      "memory": "dtcm",
      "offset": 44064,
      "role": "constant",
      "size": 40,
      "source_memory": "dtcm"
    },
    {
      "id": "fully_connected_6_weight_sum",
      "memory": "dtcm",
      "offset": 43968,
      "role": "constant",
      "size": 40,
      "source_memory": "dtcm"
    },
    {
      "id": "svdf_5_scratch_a",
      "memory": "dtcm",
      "offset": 32,
      "role": "scratch",
      "size": 128,
      "source_memory": "dtcm"
    },
    {
      "id": "svdf_5_scratch_b",
      "memory": "dtcm",
      "offset": 160,
      "role": "scratch",
      "size": 128,
      "source_memory": "dtcm"
    },
    {
      "id": "svdf_5_weight_sum",
      "memory": "dtcm",
      "offset": 128,
      "role": "persistent",
      "size": 128,
      "source_memory": "dtcm"
    }
  ]
}
```
