# infineon/aurix_webassembly_aot architecture

> Architecture diagram of the GitHub repository infineon/aurix_webassembly_aot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/infineon/aurix_webassembly_aot
- Repository: https://github.com/infineon/aurix_webassembly_aot

## Overview

Aurix Wasm AOT translates a WebAssembly 1.0 binary into TriCore machine instructions, instantiates it in caller-provided runtime memory, then invokes an exported function. The documented workflow is to construct the runtime, instantiate the module (including initialization and any start function), and call an export. The graph separates module instantiation, translation, instruction representation, and runtime state. Source-index references and excerpts support the internal links; optional C and hardware integrations are not shown as connected because their wiring is not established by the evidence provided.

Main entry points: [`src/parse_and_translate.rs`](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs) (Module instantiation), [`src/translator.rs`](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator.rs) (Function translator), [`src/isa_model.rs`](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model.rs) (TriCore ISA model), [`src/translator/vb_resolution.rs`](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/vb_resolution.rs) (VB resolution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Runtime API"]
  node_runtime["WasmRuntime"]
  node_instantiate["Module instantiation"]
  node_export_call["Export invocation"]
end

subgraph group_translation["Translation"]
  node_translator["Function translator<br/>[translator.rs]"]
  node_vb["VB resolution<br/>[vb_resolution.rs]"]
  node_operator["Operator visitor<br/>[visit_operator.rs]"]
  node_registers["Register allocation"]
  node_memory_access["Linear memory access"]
  node_library_calls["Library functions"]
  node_ir["Valent Blocks<br/>[vb.rs]"]
end

subgraph group_codegen["Code generation"]
  node_isa["TriCore ISA model<br/>[isa_model.rs]"]
  node_machine_instr["Machine instructions"]
  node_binary_map["Instruction encoding"]
  node_misaligned["Misaligned access support"]
end

subgraph group_state["Runtime state"]
  node_linear["Linear memory"]
  node_globals["Global space"]
  node_table["Function table"]
  node_instructions["Instruction buffer"]
end

node_caller(("Application"))
node_wasm["Wasm binary"]
node_host(("Host functions"))
node_c_api["C API<br/>[lib.rs]"]

node_caller -->|"constructs"| node_runtime
node_caller -->|"provides"| node_wasm
node_runtime -->|"instantiates"| node_instantiate
node_wasm -->|"parses"| node_instantiate
node_instantiate -->|"translates functions"| node_translator
node_translator -->|"visits operators"| node_operator
node_translator -->|"resolves blocks"| node_vb
node_translator -->|"allocates registers"| node_registers
node_translator -->|"handles memory"| node_memory_access
node_translator -->|"generates calls"| node_library_calls
node_vb -->|"resolves"| node_ir
node_vb -->|"generates instructions"| node_isa
node_isa -->|"defines instructions"| node_machine_instr
node_isa -->|"exposes encoding"| node_binary_map
node_instantiate -->|"initializes"| node_linear
node_instantiate -->|"initializes"| node_globals
node_instantiate -->|"initializes"| node_table
node_instantiate -->|"compiles into"| node_instructions
node_caller -->|"calls export"| node_export_call
node_export_call -->|"executes code"| node_instructions
node_export_call -.->|"may call"| node_host
node_export_call -.->|"may use"| node_c_api
node_isa -.->|"may use"| node_misaligned

click node_runtime "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_instantiate "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_export_call "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_translator "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator.rs"
click node_vb "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/vb_resolution.rs"
click node_operator "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/visit_operator.rs"
click node_registers "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/register_allocation.rs"
click node_memory_access "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/linear_memory_access.rs"
click node_library_calls "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/library_function.rs"
click node_ir "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/vb.rs"
click node_isa "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model.rs"
click node_machine_instr "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model/machine_instructions.rs"
click node_binary_map "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model/map_instr_to_bin.rs"
click node_misaligned "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/handle_misaligned_load_store.rs"
click node_linear "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_globals "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_table "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_instructions "https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs"
click node_c_api "https://github.com/infineon/aurix_webassembly_aot/blob/master/aot-wasm-c-api/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_instantiate,node_export_call toneBlue
class node_translator,node_vb,node_operator,node_registers,node_memory_access,node_library_calls,node_ir toneAmber
class node_isa,node_machine_instr,node_binary_map,node_misaligned,node_c_api toneMint
class node_linear,node_globals,node_table,node_instructions toneRose
class node_caller,node_wasm,node_host toneIndigo
```

## Components

### Runtime API

- [WasmRuntime](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`
- [Module instantiation](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`
- [Export invocation](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`

### Translation

- [Function translator](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator.rs): `src/translator.rs`
- [VB resolution](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/vb_resolution.rs): `src/translator/vb_resolution.rs`
- [Operator visitor](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/visit_operator.rs): `src/translator/visit_operator.rs`
- [Register allocation](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/register_allocation.rs): `src/translator/register_allocation.rs`
- [Linear memory access](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/linear_memory_access.rs): `src/translator/linear_memory_access.rs`
- [Library functions](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/translator/library_function.rs): `src/translator/library_function.rs`
- [Valent Blocks](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/vb.rs): `src/vb.rs`

### Code generation

- [TriCore ISA model](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model.rs): `src/isa_model.rs`
- [Machine instructions](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model/machine_instructions.rs): `src/isa_model/machine_instructions.rs`
- [Instruction encoding](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/isa_model/map_instr_to_bin.rs): `src/isa_model/map_instr_to_bin.rs`
- [Misaligned access support](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/handle_misaligned_load_store.rs): `src/handle_misaligned_load_store.rs`

### Runtime state

- [Linear memory](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`
- [Global space](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`
- [Function table](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`
- [Instruction buffer](https://github.com/infineon/aurix_webassembly_aot/blob/master/src/parse_and_translate.rs): `src/parse_and_translate.rs`

### Other components

- **Application**
- **Wasm binary**
- **Host functions**
- [C API](https://github.com/infineon/aurix_webassembly_aot/blob/master/aot-wasm-c-api/src/lib.rs): `aot-wasm-c-api/src/lib.rs`

## Connections

- Application → WasmRuntime: constructs
- Application → Wasm binary: provides
- WasmRuntime → Module instantiation: instantiates (evidence: `src/parse_and_translate.rs`)
- Wasm binary → Module instantiation: parses
- Module instantiation → Function translator: translates functions (evidence: `src/parse_and_translate.rs`)
- Function translator → Operator visitor: visits operators (evidence: `src/translator.rs`)
- Function translator → VB resolution: resolves blocks (evidence: `src/translator.rs`)
- Function translator → Register allocation: allocates registers (evidence: `src/translator.rs`)
- Function translator → Linear memory access: handles memory (evidence: `src/translator.rs`)
- Function translator → Library functions: generates calls (evidence: `src/translator.rs`)
- VB resolution → Valent Blocks: resolves (evidence: `src/translator/vb_resolution.rs`)
- VB resolution → TriCore ISA model: generates instructions (evidence: `src/translator/vb_resolution.rs`)
- TriCore ISA model → Machine instructions: defines instructions (evidence: `src/isa_model.rs`)
- TriCore ISA model → Instruction encoding: exposes encoding (evidence: `src/isa_model.rs`)
- Module instantiation → Linear memory: initializes (evidence: `src/parse_and_translate.rs`)
- Module instantiation → Global space: initializes (evidence: `src/parse_and_translate.rs`)
- Module instantiation → Function table: initializes (evidence: `src/parse_and_translate.rs`)
- Module instantiation → Instruction buffer: compiles into (evidence: `src/parse_and_translate.rs`)
- Application → Export invocation: calls export
- Export invocation → Instruction buffer: executes code (evidence: `src/parse_and_translate.rs`)
- Export invocation → Host functions: may call
- Export invocation → C API: may use
- TriCore ISA model → Misaligned access support: may use
