# pulp-platform/ita architecture

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

- Interactive diagram: https://gitdiagram.com/pulp-platform/ita
- Repository: https://github.com/pulp-platform/ita

## Overview

##### Main Components
- Hardware RTL Modules: Represented by the files in the src directory. Within src, you have major subcomponents like control modules (e.g., ita_controller.sv), compute modules (e.g., ita_dotp.sv, ita_gelu.sv), and specialized blocks (e.g., ita_activation.sv, ita_softmax.sv) as well as other parts like register files and multiplexers.
- Testbenches: Found in src/tb and modelsim directories. These ensure verification and stimulus of the RTL design.
- Test Vector Generator: The PyITA directory and testGenerator.py script form the software front-end that generates ONNX graphs and test vectors.
- Simulation and Verification Infrastructure: Includes the ModelSim simulation scripts and Makefiles (in modelsim and top-level Makefile), along with Bender configuration files (Bender.yml, Bender.lock, etc.) to facilitate automated simulation runs.
- External Tools & Dependencies: Tools like ModelSim for RTL simulation, Bender for script generation, and Python libraries (see requirements.txt) that support test generation and verification.

##### Relationships and Interactions
- RTL Communication: Illustrate how various RTL modules interact. For example, the control unit coordinates with computation units (dot product, softmax, etc.), data buffers, and memory interfaces. Group these logical units together.
- Simulation Flow: Link the RTL modules with their respective testbenches (both in src/tb and modelsim). Indicate that the simulation scripts (e.g., Makefiles, shell scripts) trigger tests which run through the RTL design, leading to observable outputs (like power, performance, and correctness signals).

##### Architectural Patterns and Design Principles
- Modular Design: Emphasize the clear separation between functional RTL blocks (e.g., activation, accumulation, and weight control) and the corresponding testbenches. Show separate compartments or consolidation areas for each.
- Streaming and On-the-Fly Computation: Indicate the data streaming mode used by the softmax implementation, reducing data movement – a key architectural aspect.
- Verification and Automated Simulation: Show how the simulation environment (via Makefiles and Bender) automates the testing and validation of the RTL design.

- Software-side: Python for test vector generation, ONNX for representing neural network graphs, and integration with Netron for ONNX visualization.
- Hardware/RTL: SystemVerilog (with files in src/hwpe and other RTL files), and simulation tools like ModelSim.
- Build & Automation Tools: Bender (for simulation script generation), Makefiles, Git workflows, and CI/CD pipelines from .github/workflows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Test/Verification Layer
    subgraph "Test/Verification Layer"
        TVGen("Test Vector Generator / ONNX Graph"):::software
        SimInfra("Simulation & Verification Infrastructure"):::simTool
        CI("CI/CD Pipeline"):::automation
    end

    %% RTL / Hardware Core Layer
    subgraph "RTL / Hardware Core Layer"
        RTLMain("Main RTL Modules"):::hardware
        RTLHwpe("HWPE Blocks"):::hardware
        GenTB("General Testbenches"):::tb
        HWPETB("HWPE Testbench"):::tb
    end

    %% External Tools & Build Layer
    subgraph "External Tools & Build Layer"
        External("External Tools & Dependencies"):::external
        Build("Build & Automation Tools"):::automation
    end

    %% Connections between Layers
    TVGen -->|"generates"| SimInfra
    TVGen -->|"utilizes"| External

    SimInfra -->|"stimulates"| RTLMain
    SimInfra -->|"stimulates"| RTLHwpe
    SimInfra -->|"receives results"| RTLMain
    SimInfra -->|"receives results"| RTLHwpe
    GenTB -->|"drives"| RTLMain
    HWPETB -->|"drives"| RTLHwpe

    SimInfra -->|"controlledBy"| Build
    Build -->|"initiates"| CI
    Build -->|"integratedWith"| External

    %% Click Events
    click TVGen "https://github.com/pulp-platform/ita/blob/main/PyITA/testGenerator.py"
    click SimInfra "https://github.com/pulp-platform/ita/tree/main/modelsim"
    click RTLMain "https://github.com/pulp-platform/ita/tree/main/src"
    click RTLHwpe "https://github.com/pulp-platform/ita/tree/main/src/hwpe"
    click GenTB "https://github.com/pulp-platform/ita/tree/main/src/tb"
    click HWPETB "https://github.com/pulp-platform/ita/tree/main/src/hwpe/tb"
    click Build "https://github.com/pulp-platform/ita/tree/main/Makefile"
    click CI "https://github.com/pulp-platform/ita/tree/main/.github/workflows"

    %% Styles
    classDef hardware fill:#f9c,stroke:#333,stroke-width:2px;
    classDef software fill:#bbf,stroke:#333,stroke-width:2px;
    classDef simTool fill:#afa,stroke:#333,stroke-width:2px;
    classDef tb fill:#ff9,stroke:#333,stroke-width:2px;
    classDef external fill:#fcc,stroke:#333,stroke-width:2px;
    classDef automation fill:#cfc,stroke:#333,stroke-width:2px;
```
