# alexmontgomerie/fpgaconvnet-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/alexmontgomerie/fpgaconvnet-tutorial
- Repository: https://github.com/alexmontgomerie/fpgaconvnet-tutorial

## Overview

##### Project type and purpose
- This is not a web app but an automated toolflow (fpgaConvNet) for compiling CNN models (PyTorch/ONNX) into optimized FPGA accelerators.
- The tutorial repository you have contains interactive Jupyter notebooks demonstrating each stage of the toolflow: getting started, end-to-end example, model parsing, optimisation, HLS code generation, and SDK host integration.

##### File structure
- Top-level contains only project metadata (LICENSE, README, submodule references) and a single directory “tutorial.”
- “tutorial” is subdivided into numbered steps (0 to 7), each containing Jupyter notebooks (RUNME.ipynb) or shell scripts showing how to invoke the four core fpgaConvNet components:
- fpgaconvnet-torch (model zoo, optional)
- fpgaconvnet-model (ONNX parser → JSON accelerator config)
- fpgaconvnet-optimiser (Design Space Exploration)
- fpgaconvnet-hls (HLS code generation → bitstream)
- There are no service or server directories—this is a command-line/API-driven pipeline.

##### README insights
- Each tutorial section incrementally exercises one toolflow stage, culminating in an FPGA bitstream.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User layer
    UserEnv["User Environment<br/>(Shell or Jupyter Client)"]:::orange
    Tutorial["Tutorial Scripts/Notebooks<br/>(Invocation Layer)"]:::orange

    %% API layer
    API["fpgaConvNet API / CLI"]:::blue

    %% Optional model provider
    Torch["fpgaconvnet-torch<br/>(Model Zoo & PyTorch export)"]:::grey

    %% Core pipeline
    subgraph "Model Parsing & Config"
        Model["fpgaconvnet-model<br/>(ONNX Parser & JSON Config)"]:::blue
    end
    JSON[(JSON Config)]:::artifact

    subgraph "Design Space Exploration"
        Optimiser["fpgaconvnet-optimiser<br/>(DSE Engine)"]:::blue
    end
    OptimizedConfig[(Optimized Config)]:::artifact

    subgraph "HLS Generation"
        HLS["fpgaconvnet-hls<br/>(HLS Code Generation)"]:::blue
    end
    HLSsources[(HLS Sources)]:::artifact

    %% SDK & example assets
    SDK["SDK Host Integration<br/>(Post-synthesis Host Code)"]:::blue
    ExampleAssets["Example Host Code Assets"]:::blue

    %% Hardware layer
    Vivado["FPGA Toolchain<br/>(Vivado HLS & Synthesis)"]:::green
    Bitstream[(FPGA Bitstream)]:::artifact
    FPGA["Target FPGA Device"]:::green

    %% Metadata
    README["README & Metadata"]:::blue

    %% Flow
    UserEnv -->|"launch notebooks"| Tutorial
    Tutorial -->|"invoke CLI"| API
    API -->|"export ONNX model"| Torch
    Torch -->|ONNX Model| ONNXModel((ONNX Model)):::artifact
    API -->|"consume ONNX"| Model
    Model -->|JSON Config| JSON
    JSON -->|"config input"| Optimiser
    Optimiser -->|Optimized Config| OptimizedConfig
    OptimizedConfig -->|"generate HLS code"| HLS
    HLS -->|HLS Sources| HLSsources
    HLSsources -->|synthesis| Vivado
    Vivado -->|bitstream| Bitstream
    Bitstream -->|flash| FPGA

    %% Example & SDK flows
    Tutorial -->|"demo assets"| ExampleAssets
    Tutorial -->|"post bitstream host code"| SDK

    %% Metadata link
    Tutorial --- README

    %% Click Events
    click UserEnv "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/0_get_started/notebook_shell.sh"
    click Tutorial "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/1_simple_end_to_end/RUNME.ipynb"
    click Torch "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/2.1_torch_model_zoo/RUNME.ipynb"
    click Model "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/3.1_model_onnx_parser/RUNME.ipynb"
    click Optimiser "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/4.1_optimiser_transform/RUNME.ipynb"
    click HLS "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/5_hls/RUNME.ipynb"
    click SDK "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/tutorial/6_sdk_host/Tutorial.ipynb"
    click ExampleAssets "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/tree/main/tutorial/1_simple_end_to_end/hardware-tutorial-assets/host-code"
    click README "https://github.com/alexmontgomerie/fpgaconvnet-tutorial/blob/main/README.md"

    %% Styles
    classDef orange fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef blue fill:#1E90FF,stroke:#333,stroke-width:1px;
    classDef grey fill:#A9A9A9,stroke:#333,stroke-width:1px;
    classDef green fill:#32CD32,stroke:#333,stroke-width:1px;
    classDef artifact fill:#FFFACD,stroke:#333,stroke-width:1px,shape:cylinder;
    class ONNXModel,JSON,OptimizedConfig,HLSsources,Bitstream artifact
```
