# openxiangshan/ame_gem5 architecture

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

- Interactive diagram: https://gitdiagram.com/openxiangshan/ame_gem5
- Repository: https://github.com/openxiangshan/ame_gem5

## Overview

AME_gem5 is a gem5-based RISC-V simulation and validation environment for the AME Ztt v0.6 instruction set. The documented workflow is to configure/build gem5 with a RISC-V toolchain, run AME instruction or operator examples, and analyze functional and performance behavior. The README names AME instruction families, while the sampled sources mainly expose gem5’s general simulation, CPU, GPU-memory, and device mechanisms; they do not show the AME-specific execution implementation. Accordingly, AME capability coverage is documented, but detailed AME dispatch links are omitted.

Main entry points: [`src/python/m5/SimObject.py`](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/SimObject.py) (SimObject Model), [`src/arch/isa_parser/isa_parser.py`](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/arch/isa_parser/isa_parser.py) (AME Operations), [`src/gpu-compute/global_memory_pipeline.cc`](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/gpu-compute/global_memory_pipeline.cc) (GPU Global Memory), [`src/sim/main.cc`](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/sim/main.cc) (Simulator Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ame["AME Support"]
  node_ame_ops["AME Operations<br/>[isa_parser.py]"]
end

subgraph group_runtime["Simulation Runtime"]
  node_sim_entry["Simulator Entry<br/>[main.cc]"]
  node_sim_objects["SimObject Model<br/>[SimObject.py]"]
  node_sim_params["Parameter Types<br/>[__init__.py]"]
  node_proxy["Parameter Proxies<br/>[proxy.py]"]
  node_stats_storage[("Statistics Storage<br/>[storage.cc]")]
  node_cxx_config["C++ Configuration<br/>[cxx_manager.cc]"]
end

subgraph group_compute["Compute Models"]
  node_minor_cpu["Minor CPU Pipeline<br/>[pipeline.cc]"]
  node_gpu_global["GPU Global Memory"]
  node_gpu_scalar["GPU Scalar Memory"]
  node_ruby_controller["Ruby Controller"]
end

subgraph group_integration["System Integration"]
  node_sdma["GPU SDMA Engine<br/>[sdma_engine.cc]"]
  node_pci_copy["PCI Copy Engine<br/>[copy_engine.cc]"]
  node_systemc_objects["SystemC Objects"]
  node_mcpat_io["McPAT I/O Model<br/>[iocontrollers.cc]"]
  node_mcpat_cacti["CACTI Circuit Model<br/>[basic_circuit.h]"]
  node_testlib_runner["Test Library Runner<br/>[main.py]"]
  node_testlib_query["Test Queries<br/>[query.py]"]
end

node_user(("Engineer"))

node_user -.->|"selects operations"| node_ame_ops
node_ame_ops -.->|"runs in"| node_sim_entry
node_sim_objects -->|"uses parameters"| node_sim_params
node_sim_objects -->|"uses proxies"| node_proxy
node_minor_cpu -.->|"evaluated by"| node_sim_entry
node_gpu_global -.->|"coordinates with"| node_gpu_scalar
node_sdma -.->|"issues memory work"| node_gpu_global
node_pci_copy -.->|"records statistics"| node_stats_storage
node_ruby_controller -.->|"records statistics"| node_stats_storage
node_cxx_config -->|"configures objects"| node_sim_objects
node_systemc_objects -.->|"manages hierarchy"| node_sim_objects
node_mcpat_io -->|"uses circuit model"| node_mcpat_cacti
node_testlib_runner -->|"queries tests"| node_testlib_query

click node_ame_ops "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/arch/isa_parser/isa_parser.py"
click node_sim_entry "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/sim/main.cc"
click node_sim_objects "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/SimObject.py"
click node_sim_params "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/params/__init__.py"
click node_proxy "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/proxy.py"
click node_minor_cpu "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/cpu/minor/pipeline.cc"
click node_gpu_global "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/gpu-compute/global_memory_pipeline.cc"
click node_gpu_scalar "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/gpu-compute/scalar_memory_pipeline.cc"
click node_sdma "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/dev/amdgpu/sdma_engine.cc"
click node_pci_copy "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/dev/pci/copy_engine.cc"
click node_stats_storage "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/base/stats/storage.cc"
click node_ruby_controller "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/mem/ruby/slicc_interface/AbstractController.cc"
click node_cxx_config "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/sim/cxx_manager.cc"
click node_systemc_objects "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/systemc/src/sysc/kernel/sc_object_manager.cpp"
click node_mcpat_io "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/mcpat/iocontrollers.cc"
click node_mcpat_cacti "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/mcpat/cacti/basic_circuit.h"
click node_testlib_runner "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/testlib/main.py"
click node_testlib_query "https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/testlib/query.py"

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_ame_ops toneBlue
class node_sim_entry,node_sim_objects,node_sim_params,node_proxy,node_stats_storage,node_cxx_config toneAmber
class node_minor_cpu,node_gpu_global,node_gpu_scalar,node_ruby_controller toneMint
class node_sdma,node_pci_copy,node_systemc_objects,node_mcpat_io,node_mcpat_cacti,node_testlib_runner,node_testlib_query toneRose
class node_user toneIndigo
```

## Components

### AME Support

- [AME Operations](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/arch/isa_parser/isa_parser.py): `src/arch/isa_parser/isa_parser.py`

### Simulation Runtime

- [Simulator Entry](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/sim/main.cc): `src/sim/main.cc`
- [SimObject Model](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/SimObject.py): `src/python/m5/SimObject.py`
- [Parameter Types](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/params/__init__.py): `src/python/m5/params/__init__.py`
- [Parameter Proxies](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/python/m5/proxy.py): `src/python/m5/proxy.py`
- [Statistics Storage](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/base/stats/storage.cc): `src/base/stats/storage.cc`
- [C++ Configuration](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/sim/cxx_manager.cc): `src/sim/cxx_manager.cc`

### Compute Models

- [Minor CPU Pipeline](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/cpu/minor/pipeline.cc): `src/cpu/minor/pipeline.cc`
- [GPU Global Memory](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/gpu-compute/global_memory_pipeline.cc): `src/gpu-compute/global_memory_pipeline.cc`
- [GPU Scalar Memory](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/gpu-compute/scalar_memory_pipeline.cc): `src/gpu-compute/scalar_memory_pipeline.cc`
- [Ruby Controller](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/mem/ruby/slicc_interface/AbstractController.cc): `src/mem/ruby/slicc_interface/AbstractController.cc`

### System Integration

- [GPU SDMA Engine](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/dev/amdgpu/sdma_engine.cc): `src/dev/amdgpu/sdma_engine.cc`
- [PCI Copy Engine](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/src/dev/pci/copy_engine.cc): `src/dev/pci/copy_engine.cc`
- [SystemC Objects](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/systemc/src/sysc/kernel/sc_object_manager.cpp): `ext/systemc/src/sysc/kernel/sc_object_manager.cpp`
- [McPAT I/O Model](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/mcpat/iocontrollers.cc): `ext/mcpat/iocontrollers.cc`
- [CACTI Circuit Model](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/mcpat/cacti/basic_circuit.h): `ext/mcpat/cacti/basic_circuit.h`
- [Test Library Runner](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/testlib/main.py): `ext/testlib/main.py`
- [Test Queries](https://github.com/openxiangshan/ame_gem5/blob/ztt-v0.6-dev/ext/testlib/query.py): `ext/testlib/query.py`

### Other components

- **Engineer**

## Connections

- Engineer → AME Operations: selects operations
- AME Operations → Simulator Entry: runs in
- SimObject Model → Parameter Types: uses parameters (evidence: `src/python/m5/params/__init__.py`)
- SimObject Model → Parameter Proxies: uses proxies (evidence: `src/python/m5/proxy.py`)
- Minor CPU Pipeline → Simulator Entry: evaluated by
- GPU Global Memory → GPU Scalar Memory: coordinates with
- GPU SDMA Engine → GPU Global Memory: issues memory work
- PCI Copy Engine → Statistics Storage: records statistics
- Ruby Controller → Statistics Storage: records statistics
- C++ Configuration → SimObject Model: configures objects (evidence: `src/sim/cxx_manager.cc`)
- SystemC Objects → SimObject Model: manages hierarchy
- McPAT I/O Model → CACTI Circuit Model: uses circuit model (evidence: `ext/mcpat/iocontrollers.cc`)
- Test Library Runner → Test Queries: queries tests (evidence: `ext/testlib/main.py`)
