How amd/mini-isp works
1. What this repo is
Mini-ISP is a hardware-first image signal processor for AMD FPGA/SoC targets. The core product is synthesizable RTL, with a Python reference/modeling layer used for algorithm prototyping, coefficient generation, and verification.
2. Primary architectural boundary: Python vs RTL
The repository is split into two main implementation domains:
- rtl/: the synthesizable ISP and its support IP
- python/: software models, test harnesses, and tooling around the ISP
This separation is the key architecture boundary for any diagram.
3. Streaming image-processing datapath
The RTL core is built as a streaming pipeline around AXI4-Stream Video-style pixel flow. The top-level ISP assembly appears in rtl/isp.sv and is wrapped for integration by rtl/isp_top.v. The data path is designed for low-latency, fully pipelined operation with configurable pixel-per-clock throughput.
4. Implemented ISP stages
The core image-processing blocks in RTL include decompanding, black level correction, digital color gain, demosaic, color correction matrix, and gamma. Supporting RTL modules such as line buffers, LUTs, and histogram/contrast helpers exist to serve those stages and to support future/optional functionality.
5. Control plane and register interface
Configuration is separated from pixel data flow through an AXI4-Lite register interface implemented in rtl/axi_lite_register.sv. This is the control boundary for setting coefficients, mode bits, and runtime parameters without interrupting the streaming datapath.
6. Reusable RTL infrastructure
The rtl/ directory also contains reusable building blocks used across the pipeline: RAM/ROM wrappers, skid buffers, dividers, sqrt/log-style helpers, PRNG, and lookup-table support. These are not the ISP stages themselves, but the hardware primitives that make the streaming implementation practical and resource-efficient.
7. Python algorithm/model layer
python/mini_isp/ mirrors the ISP feature set in software. It contains modules for auto exposure, auto white balance, black level correction, color correction, color space conversion, decompanding, demosaic, gamma, lens shading, tone mapping, and statistics/percentile utilities. This layer is the reference side of the architecture.
8. Python’s role in the workflow
The Python scripts in python/ are used for calibration, coefficient derivation, scene handling, raw-file experimentation, and LUT export. In architecture terms, Python is the “analysis and preparation” layer that produces parameters and expected behavior consumed by RTL and tests.
9. Verification and simulation
The python/tb/ package contains focused test benches for individual RTL blocks and system-level ISP behavior. The repo’s test flow is centered on Verilator-based simulation, with Python tests in python/test/ covering pure software helpers and math utilities. This makes the Python layer both a reference model and a verification harness.
10. Build, synthesis, and packaging
The root Makefile, pyproject.toml, and vivado/package.tcl define the project’s build surfaces. The repo supports simulation, Python testing, synthesis, documentation generation, and Vivado packaging, so the architecture spans both software tooling and FPGA IP delivery.
11. Reproducible development environment
A Dockerfile, devcontainer config, and GitHub Actions workflows provide a controlled environment for linting, simulation, synthesis, Docker builds, and docs generation. This matters architecturally because the project is intended to be reproducible across development and CI, not just locally.
12. Documentation and external interface expectations
The docs/ tree documents the ISP pipeline and usage, while the README frames the intended external integration points: AXI4-Lite for control and AXI4-Stream Video for pixel ingress/egress. Any architecture diagram should show Mini-ISP as a streaming FPGA IP block surrounded by a software modeling/test toolchain.
Main entry points: isp.sv ISP core · mini_isp Python ISP · Makefile Build entry · isp_top.v ISP top
Components 19
RTL datapath
Synthesizable ISP pipeline and reusable hardware blocks.
- ISP top · Top-level integration wrapper for the streaming ISP block.
rtl/isp_top.v - ISP core · Main AXI4-Stream image-processing datapath assembly.
rtl/isp.sv - AXI-Lite reg · Register interface for configuration and runtime control.
rtl/axi_lite_register.sv - Front-end · Decompanding, black level correction, and digital color gain.
- Image core · Demosaic and color matrix conversion stages.
- Tone end · Gamma and contrast/histogram-based finishing stages.
- RTL utils · Line buffers, RAM/ROMs, LUTs, dividers, sqrt/log helpers, skid buffers, and PRNG.
- Bit math · Specialized bitlog/bitsqrt and related arithmetic support blocks.
rtl/bitlog.sv
Python layer
Reference models, calibration tools, and verification harnesses.
- Python ISP · Software mirror of the ISP feature set for prototyping and validation.
python/mini_isp - Calibration · Coefficient derivation, scene handling, raw experimentation, and LUT export.
python/find_coefficients.py - Py testbenches · Focused RTL test benches and Verilator-based system simulation support.
python/tb - Py unit tests · Pure Python tests for helper math and color conversion utilities.
python/test - Python tools · Standalone helpers for axis-video handling, raw-file testing, tone mapping, and color transforms.
python/axis_video.py
Tooling
Build, packaging, docs, CI, and reproducible development environment.
- Build entry · Root build surface for simulation, testing, synthesis, and docs workflows.
Makefile - Python pkg · Python project metadata and dependency specification.
pyproject.toml - Vivado pkg · Vivado packaging script for delivering the ISP as FPGA IP.
vivado/package.tcl - Docs · User and architecture documentation for the ISP pipeline and usage.
docs/isp.md - CI/CD · GitHub Actions workflows for linting, simulation, synthesis, Docker builds, and docs.
.github/workflows/cicd.yml - Dev env · Container and devcontainer setup for consistent local development.
docker/Dockerfile
Connections 25
- ISP top → ISP core: wraps · Integration wrapper instantiates the core pipeline.
- ISP core → AXI-Lite reg: configures · Registers provide runtime control of the streaming datapath.
- ISP core → Front-end: feeds · Front-end conditioning prepares raw pixels.
- ISP core → Image core: processes · Core color stages transform the image stream.
- ISP core → Tone end: finishes · Final stages shape output tone and contrast.
- Front-end → RTL utils: uses · Front-end stages rely on shared LUTs and arithmetic helpers.
- Image core → RTL utils: uses · Color pipeline stages use common RTL infrastructure.
- Tone end → RTL utils: uses · Tone and histogram logic reuse shared primitives.
- RTL utils → Bit math: includes · Utility layer includes specialized bit-level math blocks.
- Python ISP → Front-end: mirrors · Python models correspond to RTL front-end algorithms.
- Python ISP → Image core: mirrors · Python models correspond to color pipeline algorithms.
- Python ISP → Tone end: mirrors · Python models correspond to tone and gamma behavior.
- Calibration → Python ISP: produces · Calibration scripts derive coefficients and LUTs for the model and RTL.
- Calibration → Docs: informs · Analysis outputs support usage and pipeline documentation.
- Py testbenches → ISP core: verifies · Python testbenches exercise RTL blocks and system behavior.
- Py unit tests → Python ISP: checks · Unit tests validate pure Python helpers and math utilities.
- Python tools → Python ISP: supports · Standalone scripts provide analysis and conversion tooling around the models.
- Build entry → ISP top: builds · Make-driven flow drives RTL simulation and synthesis entry points.
- Build entry → Py unit tests: runs · Project build surface includes Python test execution.
- Python pkg → Python ISP: packages · Python project metadata packages the model/tooling layer.
- Vivado pkg → ISP top: packages · Vivado packaging targets the FPGA integration wrapper.
- CI/CD → Build entry: automates · CI orchestrates builds, tests, synthesis, and docs generation.
- CI/CD → Dev env: standardizes · CI is aligned with containerized development environments.
- Docs → ISP core: documents · Docs explain the streaming ISP pipeline and external interfaces.
- Dev env → Build entry: supports · Development container supports reproducible builds and verification.