How rohankiani/risc-v-tinyml-accelerator works
This repository implements an FPGA TinyML inference system: a RISC-V processor starts and waits for a serialized INT8 MLP accelerator, which uses on-chip parameter and input memories. The software model provides quantized reference inference and hardware initialization data. The README documents the main integration and dataflow; RTL excerpts were not provided, so internal hardware-module connections are not asserted.
Main entry points: MLP_top.sv MLP controller · python_model.py Quantized model · risc_v_processor.sv Processor integration · instruction_decoder.sv Instruction decode
Components 16
Model and reference
- Quantized model
software/python_model.py
RISC-V processor
- Processor integration
rtl/top/risc_v_processor.sv - Instruction decode
rtl/risc-v/instruction_decoder.sv - Pipeline control
rtl/risc-v/control_unit.sv - ALU datapath
rtl/risc-v/ALU.sv - Register file
rtl/risc-v/register_file.sv - Instruction execution
rtl/risc-v/instruction_mem.sv
TinyML accelerator
- MLP controller
rtl/accelerator/MLP_top.sv - Address generation
rtl/accelerator/addr_gen.sv - INT8 MAC
rtl/accelerator/MAC_unit.sv - Requantization
rtl/accelerator/requantizer.sv
On-chip memories
- Input BRAM
ip/input_bram/input_bram.xci - Weight BRAM
ip/weights_bram/weights_bram.xci - Bias BRAM
ip/bias_bram/bias_bram.xci
Other components
- System user
- UCI-HAR data
dataset/UCI-HAR_dataset/train.csv
Connections 14
- System user → Quantized model: prepares model
README.md - UCI-HAR data → Quantized model: trains and evaluates
README.md - Quantized model → Input BRAM: exports input data
README.md - Quantized model → Weight BRAM: exports weights
README.md - Quantized model → Bias BRAM: exports biases
README.md - Instruction execution → Instruction decode: fetches instructions
README.md - Instruction decode → MLP controller: starts on custom instruction
README.md - Pipeline control → Processor integration: stalls during execution
README.md - MLP controller → Input BRAM: reads input
README.md - MLP controller → Weight BRAM: reads weights
README.md - MLP controller → Bias BRAM: reads biases
README.md - MLP controller → Processor integration: signals completion and result
README.md - Processor integration → ALU datapath: selects accelerator result
README.md - ALU datapath → Register file: writes back result
README.md