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_MACSand 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
- Set up Quartus 18.1 project with device
5CSEBA6U23I7 - Configure Platform Designer following
qsys/soc_system_setup.md - Compile and generate
.rbffile - Cross-compile
sw/accel_test.cfor ARM - 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
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support