Academic

Hardware acceleration of a CNN on FPGA with high-level synthesis

ENSEEIHT · Three-person project · M2 · 2024 – 2025

Full hardware acceleration flow for CNN on Zynq-7000 SoC: C++ → SystemC → Catapult HLS → VHDL RTL → Vivado IP → Vitis. ×2.6 speedup on Conv2D.

×2.6
Conv2D speedup
455 µs
Per filter
20 ns
Adder pipelined

01Context

Three-person project in my final year at ENSEEIHT. Exploration of the full design flow for hardware CNN acceleration: from the C++ implementation to validation on an FPGA board driven by the ARM core.

02Technical pipeline

  1. C++ CNN (all layers)
  2. SystemC testbench
  3. Catapult HLS (Unroll+Pipeline)
  4. Generated VHDL RTL
  5. Vivado IP + AXI
  6. ARM Vitis validation

03What I did

  1. C++ implementation of all CNN layers: Conv2D (zero-padding, multi-filter, multi-channel), MaxPool (sliding window), Flatten, ReLU, Softmax. Rewritten with buffers (copyCenteredWindow) to reduce memory footprint.

  2. SystemC modeling of Conv2D: SC_MODULE, sc_in/sc_out ports, conv2D.process() process, outFmapCpt counter, JSON weight/bias loading. Measured time ≈ 200 ms.

  3. HLS Catapult constraint exploration on Adder: unconstrained (80 ns) → Pipeline=2 (40 ns) → Pipeline=1 (20 ns, optimal area 1048 vs 1462).

  4. HLS Conv2D optimization: unconstrained (1178 µs/filter) → 4 Unrolls (519 µs) → Pipeline=2 inner loops (455 µs, ×2.6 vs baseline).

  5. Vivado: Adder and Conv2D IP packaging, block design with AXI-Stream FIFO + AXI Interconnect + Zynq-7000, 100 MHz PLL, bitstream generation.

  6. Vitis: adder validated on the Zybo (FIFO init, fill, send, receive, compare — correct sums, UART OK). Conv2D: IP integrated in the block design, on-board validation left partial (memory addressing on the Vitis side).

04Measured results

×2.6
Conv2D speedup
455 µs
Optimized time/filter
20 ns
Adder Pipeline=1
1048
Opt. Adder resources
1178→455 µs
Total HLS gain

05Challenges

  • HLS optimization limited by FIFO structure: outer loops blocked at Pipeline ≥ 10
  • Counter-intuitive trade-off: Pipeline=1 on Adder is faster AND more compact (1048 vs 1462)
  • Static shared memory in Vitis: move to dynamic allocation; full on-board validation of Conv2D remained open
  • Heterogeneous flow: VSCode, Catapult, Vivado, Vitis, .xsa/bitstream/IP formats

Want to talk it through?

Happy to go into the technical choices, the measurements and what I would do differently.

Get in touch