How suchuankai/cnn-hw-accelerator works
Project type and purpose
• This is a hardware-accelerated CNN inference project (a mixed-signal/software stack) that implements the first Conv-ReLU-MaxPool layer of a quantized Fashion-MNIST model in RTL, inspired by the Eyeriss architecture.
• Top-level folders:
• software – quantization, model prep, data generators
• hardware – RTL for “no_clock_gating” and “clock_gating” variants, simulation scripts, synthesis TCL
• unit test – isolated block-level verilog tests (e.g., PE_array, DualSram)
File structure
• hardware/… contains two major variants:
a) no_clock_gating
b) clock_gating
Within each:
• function_sim – behavioral Verilog + testbench + data files
• gate_sim – post-synthesis simulation files + SDF + testbench
• syn_file – synthesis constraints (Top.sdc, dc_syn.tcl, Top_syn.ddc)
• Major RTL submodules under function_sim:
• FIFO (handles 64-bit ifmap buffering)
• PE_array (9-PE systolic layout, each PE does MAC)
• psumBuf (accumulates partial sums, applies ReLU + right-shift quantization, does horizontal max-pool)
• convBuf (buffers two rows of 4-wide outputs, does vertical max-pool)
• weightBuf, biasBuf, controller, rowSelect, rowRf, demux1_3
• software/…:
• gen.py, padding.py, quantilize.ipynb produce padded ifmap, quantized weights, bias, model files (.txt, .dat)
README for additional insights
• Schedule chart: how many cycles per convolution window
Detail without over-fragmenting
• Nine RTL modules as distinct blocks
• Host-to-RTL interaction (data files → testbench)
• Cycle counts or quantization parameters near relevant blocks