How omarelhedaby/cnn-fpga works
This repository implements a handwritten-digit CNN for Zynq FPGA in Verilog. The documented user-to-result flow is MNIST image data through three convolution/activation stages, two pooling stages, then a fully connected classifier and Softmax scores. The README establishes the network order; source excerpts are limited to Python reference/testing code, so internal RTL calls and parameter wiring are not verified and are not inferred here.
Main entry points: ANNfull.v CNN integration · convLayerMulti.v Convolution 1 · HyperBolicTangent.v Tanh 1 · AvgPoolMulti.v Average pool 1
Components 17
Network integration
- CNN integration
Final Code Files/Part 5- Integration/ANNfull.v
Feature extraction
- Convolution 1
Final Code Files/Part 1- Convolution/convLayerMulti.v - Tanh 1
Final Code Files/Part 5- Integration/HyperBolicTangent.v - Average pool 1
Final Code Files/Part 4- Average Pooling/AvgPoolMulti.v - Convolution 2
Final Code Files/Part 5- Integration/IntegrationConvPart.v - Tanh 2
Final Code Files/Part 5- Integration/HyperBolicTangent.v - Average pool 2
Final Code Files/Part 4- Average Pooling/AvgPoolMulti.v - Convolution 3
Final Code Files/Part 5- Integration/IntegrationConvPart.v - Tanh 3
Final Code Files/Part 5- Integration/HyperBolicTangent.v
Classification
- Fully connected 1
Final Code Files/Part 5- Integration/InegrationFCpart.v - ReLU
Final Code Files/Part 5- Integration/activationFunction.v - Fully connected 2
Final Code Files/Part 5- Integration/InegrationFCpart.v - SoftMax scores
Final Code Files/Part 3- SoftMax activation/softmax.v
Numeric primitives
- Convolution unit
Final Code Files/Part 1- Convolution/convUnit.v - Processing element
Final Code Files/Part 1- Convolution/processingElement.v - Model parameters
Weight Files
Other components
- MNIST image
Connections 13
- MNIST image → CNN integration: input
- CNN integration → Convolution 1: runs
- Convolution 1 → Tanh 1: convolves then activates
README.md - Tanh 1 → Average pool 1: feeds
README.md - Average pool 1 → Convolution 2: feeds
README.md - Convolution 2 → Tanh 2: convolves then activates
README.md - Tanh 2 → Average pool 2: feeds
README.md - Average pool 2 → Convolution 3: feeds
README.md - Convolution 3 → Tanh 3: convolves then activates
README.md - Tanh 3 → Fully connected 1: feeds
README.md - Fully connected 1 → ReLU: feeds
README.md - ReLU → Fully connected 2: feeds
README.md - Fully connected 2 → SoftMax scores: feeds
README.md