YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

DE10-Nano MAC Accelerator β€” FPGA + HPS Dot-Product Engine

A complete FPGA accelerator project for the Terasic DE10-Nano (Intel Cyclone V SoC) that implements a 16-unit parallel MAC (Multiply-Accumulate) array with DMA-based DDR3 data movement, controlled from Linux via memory-mapped registers.

System Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   HPS (ARM Cortex-A9)β”‚          β”‚      FPGA Fabric            β”‚
β”‚                     β”‚          β”‚                             β”‚
β”‚  Linux + C program  β”‚  LW H2F  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  mmap(/dev/mem)  ───┼──Bridge──┼───   mac_accelerator     β”‚  β”‚
β”‚                     β”‚          β”‚  β”‚  Registers + FSM +     β”‚  β”‚
β”‚  DDR3 (1GB)         β”‚ F2SDRAM  β”‚  β”‚  DMA + 16Γ— MAC +      β”‚  β”‚
β”‚  A[], B[] vectors ◄─┼──Bridge──┼───  BRAM + Reduce Tree   β”‚  β”‚
β”‚                     β”‚          β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Features

  • 16 parallel MAC units using Cyclone V DSP blocks (scalable to 48)
  • Burst DMA engine for efficient DDR3 data movement via F2SDRAM bridge
  • Dual BRAM buffers for active working data (1-cycle access)
  • Pipelined reduction tree (logβ‚‚(16) = 4 stages)
  • Memory-mapped CSR registers for HPS control via Lightweight bridge
  • 64-bit accumulation to prevent overflow on large vectors
  • Performance counters for profiling
  • Complete HPS C driver with mmap-based register access
  • Parameterized design β€” change NUM_MACS and everything adapts
  • Ready to evolve toward CSR/sparse matrix processing

File Structure

β”œβ”€β”€ rtl/
β”‚   β”œβ”€β”€ mac_unit.v              β€” Single MAC: multiply + accumulate (DSP inference)
β”‚   β”œβ”€β”€ mac_array.v             β€” Parameterized array of N MAC units
β”‚   β”œβ”€β”€ reduction_tree.v        β€” Pipelined adder tree for partial sum reduction
β”‚   β”œβ”€β”€ bram_buffer.v           β€” Dual-port BRAM wrapper (M10K inference)
β”‚   β”œβ”€β”€ accel_csr.v             β€” Avalon-MM slave: control/status register file
β”‚   β”œβ”€β”€ accel_dma.v             β€” Avalon-MM master: DDR3 burst read/write engine
β”‚   β”œβ”€β”€ accel_fsm.v             β€” Master FSM: orchestrates fetchβ†’computeβ†’reduce
β”‚   β”œβ”€β”€ mac_accelerator.v       β€” Top accelerator module (Platform Designer component)
β”‚   β”œβ”€β”€ de10nano_top.v          β€” Board top-level: HPS + accelerator
β”‚   └── tb_mac_accelerator.v    β€” Full testbench with mock DDR3
β”œβ”€β”€ sw/
β”‚   β”œβ”€β”€ accel_driver.h          β€” Register map + inline helper functions
β”‚   β”œβ”€β”€ accel_test.c            β€” HPS test program with verification & benchmarking
β”‚   └── Makefile                β€” Cross-compile for ARM Cortex-A9
β”œβ”€β”€ qsys/
β”‚   β”œβ”€β”€ mac_accelerator_hw.tcl  β€” Platform Designer component description
β”‚   └── soc_system_setup.md     β€” Step-by-step Qsys configuration guide
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ pin_assignments.tcl     β€” DE10-Nano FPGA pin assignments
β”‚   β”œβ”€β”€ de10nano_accel.sdc      β€” Timing constraints (50 MHz)
β”‚   └── program_fpga.sh         β€” Program FPGA from Linux
└── docs/
    β”œβ”€β”€ 00_ARCHITECTURE.md      β€” Full system architecture + dataflow
    β”œβ”€β”€ 01_QUARTUS_FLOW.md      β€” Complete build instructions
    └── 02_SCALING.md           β€” Scaling guide: more MACs, CSR/sparse

Register Map

Offset Name R/W Description
0x00 CTRL W Bit 0: START, Bit 1: RESET
0x04 STATUS R Bit 0: BUSY, Bit 1: DONE, Bit 2: ERROR
0x08 ADDR_A W DDR3 physical address of vector A
0x0C ADDR_B W DDR3 physical address of vector B
0x10 ADDR_RESULT W DDR3 address for result writeback
0x14 VEC_LEN W Number of elements
0x18 RESULT_LO R Result lower 32 bits
0x1C RESULT_HI R Result upper 32 bits
0x20 NUM_MACS R Number of MAC units (hardware discovery)
0x24 VERSION R IP version
0x28 CYCLE_COUNT R Cycles for last operation

Quick Start

  1. Set up Quartus 18.1 project with device 5CSEBA6U23I7
  2. Configure Platform Designer following qsys/soc_system_setup.md
  3. Compile and generate .rbf file
  4. Cross-compile sw/accel_test.c for ARM
  5. Program FPGA and run test β€” see docs/01_QUARTUS_FLOW.md

Scaling

Change one parameter to scale:

parameter NUM_MACS = 32   // in mac_accelerator.v

Everything adapts automatically. See docs/02_SCALING.md for CSR/sparse roadmap.

Resource Usage (16 MACs at 50 MHz)

Resource Used Available %
ALMs ~4,000 41,910 10%
DSP Blocks 32 112 29%
M10K Blocks 4 553 <1%

License

MIT

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support