# freecores/dma_axi architecture

> Architecture diagram of the GitHub repository freecores/dma_axi, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/freecores/dma_axi
- Repository: https://github.com/freecores/dma_axi

## Overview

##### Project type and purpose
- This is an open‑source hardware IP core written in Verilog.
- It implements a dual‑core, generic AXI DMA engine in two versions: a 32‑bit data‑width build (dma_axi32) and a 64‑bit build (dma_axi64).
- Its primary role is to move data between memory and peripheral domains over AXI4 interfaces, with an APB register interface for configuration and status.

##### File structure
- Top‑level directories:
– src/dma_axi32/ (32‑bit version)
– src/dma_axi64/ (64‑bit version)
- Each version contains:
– dma_axiXX.v: top‑level wrapper
– dma_axiXX_apb_mux.v: APB‐to‑register‑core multiplexer
– dma_axiXX_dual_core.v: instantiates two channel cores
– dma_axiXX_core0_*.v: the detailed submodules for channel 0 (arbiter, AXI command, data FIFOs, register files, scatter/gather, address & size calculators, watchdog)
– dma_axiXX_core0_top.v: submodule interconnections for core0
– dma_axiXX_reg*.v: register design files
– prgen_*.v: small reusable “pattern‑generator” primitives (fifos, muxes, stalling logic)
- doc/ contains a PDF spec.

##### Relationships and data flow
- Control path: CPU → APB bus → APB‑mux → Register Files → Channel Control FSM
- Data path:
– For MM2S (Memory‑to‑Stream): AXI Read Master → FIFO → Stream Out/peripheral
– For S2MM (Stream‑to‑Memory): Stream In/peripheral → FIFO → AXI Write Master
- Within each core:
– Descriptor fetch (via AXI reads) → address/size calculation → scatter gather chaining → data transfer bursts → descriptor update (via AXI writes)
- Dual‑core arbitration if both cores share a single APB or shared AXI ports

##### Architectural patterns
- Modular sub‑block design: each functional unit (arbiter, FIFO, reg, scatter/gather) is its own Verilog file.
- Parameterized data path width (32 vs 64 bits).
- Common “prgen” library for small reusable primitives.
- Decoupled control vs data path through FIFOs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "32-bit Version"
        W32["dma_axi32.v"]:::top
        APB32["dma_axi32_apb_mux.v"]:::ctrl
        D32["dma_axi32_dual_core.v"]:::core
        C0_32["dma_axi32_core0_top.v"]:::sub
        W32 -->|"APB control"| APB32
        W32 -->|"instantiate dual core"| D32
        D32 -->|"includes core0"| C0_32
    end

    subgraph "64-bit Version"
        W64["dma_axi64.v"]:::top
        APB64["dma_axi64_apb_mux.v"]:::ctrl
        D64["dma_axi64_dual_core.v"]:::core
        C0_64["dma_axi64_core0_top.v"]:::sub
        W64 -->|"APB control"| APB64
        W64 -->|"instantiate dual core"| D64
        D64 -->|"includes core0"| C0_64
    end

    Doc["PR200_trm_rev1.6.pdf"]:::doc
    W32 -->|"spec reference"| Doc
    W64 -->|"spec reference"| Doc

    click W32 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi32/dma_axi32.v"
    click APB32 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi32/dma_axi32_apb_mux.v"
    click D32 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi32/dma_axi32_dual_core.v"
    click C0_32 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi32/dma_axi32_core0_top.v"

    click W64 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi64/dma_axi64.v"
    click APB64 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi64/dma_axi64_apb_mux.v"
    click D64 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi64/dma_axi64_dual_core.v"
    click C0_64 "https://github.com/freecores/dma_axi/blob/master/src/dma_axi64/dma_axi64_core0_top.v"

    click Doc "https://github.com/freecores/dma_axi/blob/master/doc/PR200_trm_rev1.6.pdf"

    classDef top fill:#f9f,stroke:#333,stroke-width:2px
    classDef ctrl fill:#bbf,stroke:#333,stroke-dasharray:5 5
    classDef core fill:#bfb,stroke:#333
    classDef sub fill:#ffb,stroke:#333
    classDef doc fill:#eee,stroke:#333,stroke-width:1px,font-style:italic
```
