# erwanregy/neural-network-on-an-fpga architecture

> Architecture diagram of the GitHub repository erwanregy/neural-network-on-an-fpga, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/erwanregy/neural-network-on-an-fpga
- Repository: https://github.com/erwanregy/neural-network-on-an-fpga

## Overview

This repository describes a parameterized feedforward neural network implemented in hardware. The principal workflow is input signals entering the network, passing through connected dense layers of neurons, and emerging as outputs when computation is ready. Each neuron multiplies inputs by weights, accumulates the products, applies an activation, and returns to waiting for the next input. The relationships shown are documented in the README; no source excerpts were available to verify further implementation details.

Main entry points: [`sources_1/new/neural_network.sv`](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neural_network.sv) (Neural network), [`sources_1/new/neuron.sv`](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv) (Multiply inputs), [`sources_1/new/dense_layer.sv`](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/dense_layer.sv) (Dense layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Network composition"]
  node_network["Neural network<br/>[neural_network.sv]"]
end

subgraph group_layer["Layer computation"]
  node_dense_layer["Dense layer<br/>[dense_layer.sv]"]
end

subgraph group_neuron["Neuron computation"]
  node_neuron["Neuron<br/>[neuron.sv]"]
  node_multiply["Multiply inputs<br/>[neuron.sv]"]
  node_accumulate["Accumulate products<br/>[neuron.sv]"]
  node_activate["Apply activation<br/>[neuron.sv]"]
  node_wait["Wait for input<br/>[neuron.sv]"]
end

node_input_source(("Input producer"))
node_output_consumer(("Output consumer"))
node_clock_reset(("Clock and reset"))

node_input_source -->|"provides inputs"| node_network
node_clock_reset -->|"provides control"| node_network
node_network -->|"instantiates layers"| node_dense_layer
node_dense_layer -->|"instantiates neurons"| node_neuron
node_neuron -->|"starts computation"| node_multiply
node_multiply -->|"passes products"| node_accumulate
node_accumulate -->|"passes sum"| node_activate
node_activate -->|"completes activation"| node_wait
node_wait -->|"restarts on ready"| node_multiply
node_network -->|"provides outputs"| node_output_consumer

click node_network "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neural_network.sv"
click node_dense_layer "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/dense_layer.sv"
click node_neuron "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv"
click node_multiply "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv"
click node_accumulate "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv"
click node_activate "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv"
click node_wait "https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv"

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_network toneBlue
class node_dense_layer toneAmber
class node_neuron,node_multiply,node_accumulate,node_activate,node_wait toneMint
class node_input_source,node_output_consumer,node_clock_reset toneIndigo
```

## Components

### Network composition

- [Neural network](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neural_network.sv): `sources_1/new/neural_network.sv`

### Layer computation

- [Dense layer](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/dense_layer.sv): `sources_1/new/dense_layer.sv`

### Neuron computation

- [Neuron](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv): `sources_1/new/neuron.sv`
- [Multiply inputs](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv): `sources_1/new/neuron.sv`
- [Accumulate products](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv): `sources_1/new/neuron.sv`
- [Apply activation](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv): `sources_1/new/neuron.sv`
- [Wait for input](https://github.com/erwanregy/neural-network-on-an-fpga/blob/main/sources_1/new/neuron.sv): `sources_1/new/neuron.sv`

### Other components

- **Input producer**
- **Output consumer**
- **Clock and reset**

## Connections

- Input producer → Neural network: provides inputs (evidence: `README.md`)
- Clock and reset → Neural network: provides control (evidence: `README.md`)
- Neural network → Dense layer: instantiates layers (evidence: `README.md`)
- Dense layer → Neuron: instantiates neurons (evidence: `README.md`)
- Neuron → Multiply inputs: starts computation (evidence: `README.md`)
- Multiply inputs → Accumulate products: passes products (evidence: `README.md`)
- Accumulate products → Apply activation: passes sum (evidence: `README.md`)
- Apply activation → Wait for input: completes activation (evidence: `README.md`)
- Wait for input → Multiply inputs: restarts on ready (evidence: `README.md`)
- Neural network → Output consumer: provides outputs (evidence: `README.md`)
