# sfu-hiaccel/syncnn architecture

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

- Interactive diagram: https://gitdiagram.com/sfu-hiaccel/syncnn
- Repository: https://github.com/sfu-hiaccel/syncnn

## Overview

SyncNN is an SNN image-classification framework for Xilinx ARM-FPGA SoCs, with LeNet, NiN, and VGG-13 implementations. Its documented workflow trains CNNs, converts and quantizes weights, configures a network and dataset, then runs classification in software or on FPGA. The graph preserves the three model variants and preparation stages. Runtime call relationships are shown where the sampled testbench invokes the network; other workflow links follow README instructions, since notebook and most implementation bodies were not sampled.

Main entry points: [`quantize`](https://github.com/sfu-hiaccel/syncnn/tree/main/quantize) (Quantize weights), [`convert_h`](https://github.com/sfu-hiaccel/syncnn/tree/main/convert_h) (Convert weights), [`train/mnist_lenet.ipynb`](https://github.com/sfu-hiaccel/syncnn/blob/main/train/mnist_lenet.ipynb) (Train LeNet), [`train/cifar10_nin.ipynb`](https://github.com/sfu-hiaccel/syncnn/blob/main/train/cifar10_nin.ipynb) (Train NiN)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_preparation["Model preparation"]
  node_train_lenet["Train LeNet<br/>[mnist_lenet.ipynb]"]
  node_train_nin["Train NiN<br/>[cifar10_nin.ipynb]"]
  node_train_vgg["Train VGG<br/>[cifar10_vgg.ipynb]"]
  node_convert_weights["Convert weights"]
  node_quantize_weights["Quantize weights"]
end

subgraph group_configuration["Design configuration"]
  node_lenet_config["LeNet configuration<br/>[mnist_2.h]"]
  node_nin_config["NiN configuration<br/>[cifar10_1.h]"]
  node_vgg_config["VGG configuration<br/>[cifar10_2.h]"]
  node_dataset["Image and label data"]
end

subgraph group_runtime["Inference runtime"]
  node_lenet_testbench["LeNet testbench<br/>[tb.cpp]"]
  node_nin_testbench["NiN testbench<br/>[tb.cpp]"]
  node_vgg_testbench["VGG testbench<br/>[tb.cpp]"]
  node_lenet_network["LeNet SNN<br/>[src.cpp]"]
  node_nin_network["NiN SNN<br/>[src.cpp]"]
  node_vgg_network["VGG SNN<br/>[src.cpp]"]
end

subgraph group_platform["Execution platform"]
  node_fpga["Xilinx SoC FPGA"]
end

node_researcher(("Researcher"))

node_researcher -->|"trains"| node_train_lenet
node_researcher -->|"trains"| node_train_nin
node_researcher -->|"trains"| node_train_vgg
node_train_lenet -->|"provides model"| node_convert_weights
node_train_nin -->|"provides model"| node_convert_weights
node_train_vgg -->|"provides model"| node_convert_weights
node_convert_weights -->|"exports weights"| node_quantize_weights
node_quantize_weights -->|"informs scaling"| node_lenet_config
node_quantize_weights -->|"informs scaling"| node_nin_config
node_quantize_weights -->|"informs scaling"| node_vgg_config
node_researcher -->|"chooses data"| node_dataset
node_dataset -->|"loads samples"| node_lenet_testbench
node_dataset -->|"loads samples"| node_nin_testbench
node_dataset -->|"loads samples"| node_vgg_testbench
node_lenet_testbench -->|"calls network"| node_lenet_network
node_nin_testbench -->|"calls network"| node_nin_network
node_vgg_testbench -->|"calls network"| node_vgg_network
node_lenet_network -->|"runs on"| node_fpga
node_nin_network -->|"runs on"| node_fpga
node_vgg_network -->|"runs on"| node_fpga

click node_train_lenet "https://github.com/sfu-hiaccel/syncnn/blob/main/train/mnist_lenet.ipynb"
click node_train_nin "https://github.com/sfu-hiaccel/syncnn/blob/main/train/cifar10_nin.ipynb"
click node_train_vgg "https://github.com/sfu-hiaccel/syncnn/blob/main/train/cifar10_vgg.ipynb"
click node_convert_weights "https://github.com/sfu-hiaccel/syncnn/tree/main/convert_h"
click node_quantize_weights "https://github.com/sfu-hiaccel/syncnn/tree/main/quantize"
click node_lenet_config "https://github.com/sfu-hiaccel/syncnn/blob/main/design/LeNet/includes/mnist_2.h"
click node_nin_config "https://github.com/sfu-hiaccel/syncnn/blob/main/design/NiN/includes/cifar10_1.h"
click node_vgg_config "https://github.com/sfu-hiaccel/syncnn/blob/main/design/VGG13/includes/cifar10_2.h"
click node_lenet_testbench "https://github.com/sfu-hiaccel/syncnn/blob/main/design/LeNet/tb.cpp"
click node_nin_testbench "https://github.com/sfu-hiaccel/syncnn/blob/main/design/NiN/tb.cpp"
click node_vgg_testbench "https://github.com/sfu-hiaccel/syncnn/blob/main/design/VGG13/tb.cpp"
click node_lenet_network "https://github.com/sfu-hiaccel/syncnn/blob/main/design/LeNet/src.cpp"
click node_nin_network "https://github.com/sfu-hiaccel/syncnn/blob/main/design/NiN/src.cpp"
click node_vgg_network "https://github.com/sfu-hiaccel/syncnn/blob/main/design/VGG13/src.cpp"

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_train_lenet,node_train_nin,node_train_vgg,node_convert_weights,node_quantize_weights toneBlue
class node_lenet_config,node_nin_config,node_vgg_config,node_dataset toneAmber
class node_lenet_testbench,node_nin_testbench,node_vgg_testbench,node_lenet_network,node_nin_network,node_vgg_network toneMint
class node_fpga toneRose
class node_researcher toneIndigo
```

## Components

### Model preparation

- [Train LeNet](https://github.com/sfu-hiaccel/syncnn/blob/main/train/mnist_lenet.ipynb): `train/mnist_lenet.ipynb`
- [Train NiN](https://github.com/sfu-hiaccel/syncnn/blob/main/train/cifar10_nin.ipynb): `train/cifar10_nin.ipynb`
- [Train VGG](https://github.com/sfu-hiaccel/syncnn/blob/main/train/cifar10_vgg.ipynb): `train/cifar10_vgg.ipynb`
- [Convert weights](https://github.com/sfu-hiaccel/syncnn/tree/main/convert_h): `convert_h`
- [Quantize weights](https://github.com/sfu-hiaccel/syncnn/tree/main/quantize): `quantize`

### Design configuration

- [LeNet configuration](https://github.com/sfu-hiaccel/syncnn/blob/main/design/LeNet/includes/mnist_2.h): `design/LeNet/includes/mnist_2.h`
- [NiN configuration](https://github.com/sfu-hiaccel/syncnn/blob/main/design/NiN/includes/cifar10_1.h): `design/NiN/includes/cifar10_1.h`
- [VGG configuration](https://github.com/sfu-hiaccel/syncnn/blob/main/design/VGG13/includes/cifar10_2.h): `design/VGG13/includes/cifar10_2.h`
- **Image and label data**

### Inference runtime

- [LeNet testbench](https://github.com/sfu-hiaccel/syncnn/blob/main/design/LeNet/tb.cpp): `design/LeNet/tb.cpp`
- [NiN testbench](https://github.com/sfu-hiaccel/syncnn/blob/main/design/NiN/tb.cpp): `design/NiN/tb.cpp`
- [VGG testbench](https://github.com/sfu-hiaccel/syncnn/blob/main/design/VGG13/tb.cpp): `design/VGG13/tb.cpp`
- [LeNet SNN](https://github.com/sfu-hiaccel/syncnn/blob/main/design/LeNet/src.cpp): `design/LeNet/src.cpp`
- [NiN SNN](https://github.com/sfu-hiaccel/syncnn/blob/main/design/NiN/src.cpp): `design/NiN/src.cpp`
- [VGG SNN](https://github.com/sfu-hiaccel/syncnn/blob/main/design/VGG13/src.cpp): `design/VGG13/src.cpp`

### Execution platform

- **Xilinx SoC FPGA**

### Other components

- **Researcher**

## Connections

- Researcher → Train LeNet: trains (evidence: `README.md`)
- Researcher → Train NiN: trains (evidence: `README.md`)
- Researcher → Train VGG: trains (evidence: `README.md`)
- Train LeNet → Convert weights: provides model (evidence: `README.md`)
- Train NiN → Convert weights: provides model (evidence: `README.md`)
- Train VGG → Convert weights: provides model (evidence: `README.md`)
- Convert weights → Quantize weights: exports weights (evidence: `README.md`)
- Quantize weights → LeNet configuration: informs scaling (evidence: `README.md`)
- Quantize weights → NiN configuration: informs scaling (evidence: `README.md`)
- Quantize weights → VGG configuration: informs scaling (evidence: `README.md`)
- Researcher → Image and label data: chooses data (evidence: `README.md`)
- Image and label data → LeNet testbench: loads samples (evidence: `README.md`)
- Image and label data → NiN testbench: loads samples (evidence: `README.md`)
- Image and label data → VGG testbench: loads samples (evidence: `README.md`)
- LeNet testbench → LeNet SNN: calls network (evidence: `design/LeNet/tb.cpp`)
- NiN testbench → NiN SNN: calls network (evidence: `design/NiN/tb.cpp`)
- VGG testbench → VGG SNN: calls network (evidence: `design/VGG13/tb.cpp`)
- LeNet SNN → Xilinx SoC FPGA: runs on (evidence: `README.md`)
- NiN SNN → Xilinx SoC FPGA: runs on (evidence: `README.md`)
- VGG SNN → Xilinx SoC FPGA: runs on (evidence: `README.md`)
