Skip to content

About

Multi-purpose reprogrammable CNN Inference Accelerator targetting FPGA (WIP)

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

85 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Entropic-NPU

Hand-written RTL for a 50×50 CNN. Weights stream in over UART at runtime, so one bitstream runs any model that fits the format.

Status

15 of 17 RTL modules written. 15 have testbenches. 3 modules left to verify or write.


Compute (7/7)

  • mac.sv — 8×8 signed multiply-accumulate, sign-extended to 17 bits
  • adder_tree.sv — 9-input registered adder tree
  • pe_array.sv — 9 taps × 4 lanes = 36 MACs
  • requant.sv — bias → shift → round → clamp (this is also the ReLU)
  • pool.sv — 2×2 max pool, group tag g_out
  • gap.sv — 16-channel global average pool, >>7, saturate
  • argmax.sv — 3-state FSM, bias adder, 32 class slots

Memory (5/5)

  • line_buffer.sv — 3 rotating rows, 9 taps per clock, runtime width
  • featmap_bram.sv — ping-pong feature-map store, 2 × 5,120 words
  • weight_bram.sv — 2 banks × 128 beats × 288 bits
  • desc_ram.sv — 2 banks × 16 descriptors × 128 bits
  • bias_ram.sv — 2 banks × 64 words × 128 bits

IO (4/4)

  • uart_rx.sv — 8N1, 115200 baud @ 100 MHz, glitch and framing rejection
  • uart_tx.sv — 8N1 transmitter, busy handshake
  • crc32.sv — reflected CRC-32, one byte per clock
  • model_loader.sv — frame parser + validation + atomic bank swap

Top level (0/2)

  • npu_top.sv — descriptor sequencer (empty file)
  • basys3_top.sv — pins, PLL, 7-seg (empty file)

Verification

Every module is simulated with Verilator 5.032

module testbench checks status
mac tb_mac 23 pass
adder_tree tb_adder_tree 8 pass
pe_array tb_pe_array 77 pass
requant tb_requant 40 pass
pool tb_pool 29 pass
argmax tb_argmax 25 pass
gap tb_gap 126 pass
line_buffer tb_line_buffer 71,046 + 1,920 pass
featmap_bram tb_featmap_bram 33,804 pass
weight_bram tb_weight_bram 547 pass
uart_rx tb_uart_rx 16 pass
uart_tx tb_uart_tx 17 pass
crc32 tb_crc32 12 pass
desc_ram tb_desc_ram ~52 written, not re-run since the two-bank change
bias_ram tb_bias_ram ~196 written, not re-run since the two-bank change
model_loader — — no testbench yet

All RTL modules are -Wall clean under verilator --lint-only.


Not started

RTL

  • npu_top — walks the descriptor table, drives conv / pool / gap / fc jobs
  • basys3_top — PLL, UART pins, 7-seg output, debounce

Verification

  • tb_model_loader — good frame, bad magic, wrong length, CRC mismatch, truncated frame, oversized model, load-while-busy
  • tb_desc_ram / tb_bias_ram re-run after adding bank bits
  • Full-network simulation: frame in over UART → digit out

Synthesis

  • Confirm RAM inference (ram_style attributes added, not yet checked)
  • synth_design on each module, then the whole design
  • Timing closure at 100 MHz
  • Resource check: expect ~10 BRAM36 for feature maps, 8 for weights

Host / training side

  • training/export_model.py — PyTorch → INT8 → frame bytes
  • host/send_model.py — frame the payload, stream over serial, check the reply
  • vectors/ — golden input images and expected class per model
  • golden/ — per-layer reference activations for bit-exact checking

Documentation

  • docs/DECISIONS.md — ADR-007 (ping-pong banks, packed addressing)
  • docs/DECISIONS.md — ADR-008 (all three memories banked, one flip

About

Multi-purpose reprogrammable CNN Inference Accelerator targetting FPGA (WIP)

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages