How cedard234/accelenetor works
Project Type and Purpose
• This is a hardware accelerator project, specifically a simplified LeNet-5 Convolutional Neural Network (CNN) implemented in SystemVerilog.
• Its purpose is to accelerate MNIST digit recognition, and the accelerator is synthesized on a Cyclone V FPGA.
• The README emphasizes that the loops in the network’s layers (convolution, activation, pooling, fully-connected) have been completely unrolled, leading to high resource usage.
Analyzing the File Structure
• Top-level organization:
• Directories like “src” contain most hardware RTL components, broken out into files for each layer (convolution layers, activation layers, max pooling layers, fully connected layer).
• The “kernal_trained” directory holds pre-trained weights or matrix representations used by the accelerator.
• “testbenches” include simulation/test modules for verifying individual components and the whole accelerator.
• “test_images” provides sample inputs used during testing.
• The structure reflects a modular design where each layer or accelerator component is in its own file, making it straightforward to show individual blocks and their interactions.
Key Components
• Input/Preprocessing:
• Test images or input module (data captured and fed from the “test_images” set).
• CNN Accelerator Blocks:
• Convolutional Layers: Files like conv_layer_1.sv, conv_layer_2.sv, conv_layer_3.sv.
• Activation Layers: activation_layer_1.sv, activation_layer_2.sv, activation_layer_3.sv.
• Pooling Layers: maxpooling_1.sv and maxpooling_2.sv.
• Fully Connected Layer: fully_connect_layer.sv.
• Supporting Components: convolution_point.sv and kernel_and_matrix.sv are likely used to implement the convolution arithmetic along with integration of kernel values.
• Top-level Accelerator Modules: AcceLeNetor.sv and Lenet_accelerator.sv connect the individual layers.
• Kernel Data:
• Files in the “kernal_trained” directory represent pre-trained kernel and matrix definitions (with variations in bit width—8 bits and 16 bits). These should be shown as data sources feeding the convolution blocks.
• Testbenches:
• Although not part of the operational hardware, indicate that these exist to verify functionality. They illustrate simulation and verification paths.
Relationships and Interactions
• A sequential data flow through the accelerator:
Input Image → Conv Layer 1 → Activation Layer 1 → Maxpooling 1 → Conv Layer 2 → Activation Layer 2 → Maxpooling 2 → Conv Layer 3 → Activation Layer 3 → Fully Connected Layer → Output (digit classification)
• Use of pre-trained kernel data (from the “kernal_trained” files) feeding into the convolution blocks.
• Denote how the top-level modules (AcceLeNetor.sv and Lenet_accelerator.sv) instantiate and coordinate all the lower-level modules.
Architectural Patterns and Design Principles
• Unrolled Loops:
• That the loops are fully unrolled for each layer. This means that pipeline concurrency is high and that each operation is instantiated separately.
• Modular and Hierarchical Structure:
• Each major CNN component is implemented as a separate module for clarity and reusability.
• Data Flow:
• FPGA-Specific Implementation:
• That the system interfaces with an FPGA (Cyclone V) and may include specific clock domains, reset controllers, and possibly I/O mapping (though not explicitly in the file structure). You might want to include these as context blocks if found elsewhere in your design docs.