This repository provides a reference RTL implementation of a stereo fixed-point gain stage implemented in Verilog and integrated with AXI-Stream and AXI-Lite.
Target platform: AMD Kria KV260
Focus: RTL architecture, fixed-point DSP decisions, and AXI correctness
This module implements:
- Function: Per-sample amplitude scaling (gain control)
- Data type: Fixed-point Q4.12
- Scope: Minimal, single-purpose DSP building block
The design is intentionally not generic and not feature-rich.
It exists to demonstrate how a gain stage is implemented in hardware, not to provide a turnkey audio solution.
- RTL written in Verilog
- AXI-Stream data interface (audio path)
- AXI-Lite control interface (gain & enable)
- Fixed-point arithmetic with explicit bit-width control
- Deterministic, cycle-accurate behavior
- Designed and verified for real-time audio streaming
- No software runtime included
High-level structure:
AXI-Stream In (Stereo)
|
v
+----------------------+
| Gain Core |
| - Fixed-point mult |
| - Scaling (Q4.12) |
| - Saturation |
+----------------------+
|
v
AXI-Stream Out (Stereo)
Design notes:
- Processing is fully synchronous
- Gain arithmetic is isolated in a dedicated core (
gain_core) - AXI protocol handling is separated in a wrapper (
gain_axis_wrapper) - No hidden state outside the RTL
- AXI-Stream width: 32-bit
- Audio samples:
- Signed 16-bit
- Stereo, interleaved:
[15:0]→ Left[31:16]→ Right
- Gain format:
- Signed fixed-point Q4.12
- Stored in AXI-Lite registers
- Fixed processing latency: 2 clock cycles
- 1 cycle: gain core
- 1 cycle: AXI-Stream pipeline register
Latency is:
- deterministic
- independent of input signal
- independent of gain value
This behavior is intentional and suitable for streaming DSP pipelines.
The control interface exposes three registers:
| Offset | Register | Description |
|---|---|---|
| 0x00 | CONTROL | Enable / bypass |
| 0x04 | GAIN_L | Left-channel gain |
| 0x08 | GAIN_R | Right-channel gain |
ENABLE = 0→ bypass mode (output = input)- Gain registers use Q4.12 format
- Upper bits of 32-bit registers are ignored
Detailed documentation is available in /docs/address_map.md.
Verification was performed at two levels:
Dedicated SystemVerilog testbenches verify:
- Fixed-point arithmetic correctness
- Saturation and clipping behavior
- Clock enable (CE) handling
- AXI-Stream handshake correctness
- AXI-Lite register access
Simulation results are provided as CSV files and plotted waveforms
(see /results).
The design was tested on real FPGA hardware.
Tested on FPGA hardware via PYNQ overlay
PYNQ was used only as:
- signal stimulus
- observability tool
Python scripts, bitstreams, and hardware handoff files are intentionally not published to keep the repository focused on RTL architecture.
Key design decisions:
- Fixed-point Q4.12 chosen for predictable scaling and saturation
- Explicit bypass mode instead of gain = 1.0
- Saturation applied after scaling to prevent wraparound
- Minimal register set to avoid unnecessary control complexity
- No dynamic reconfiguration or smoothing logic
These decisions reflect engineering trade-offs, not missing features.
More detailed explanations are available in /docs/design_rationale.md.
- A clean RTL reference
- A demonstration of:
- fixed-point DSP reasoning
- saturation-safe arithmetic
- AXI-Stream and AXI-Lite integration
- A reusable building block for larger FPGA audio pipelines
- ❌ A complete audio processing system
- ❌ A feature-rich or generic IP core
- ❌ A software-driven demo
- ❌ A drop-in commercial product
The scope is intentionally constrained.
This repository is considered complete.
- RTL is stable
- Simulation coverage is sufficient
- Hardware validation has been performed
- No further feature development is planned
The design is published as a reference implementation.
Additional documentation is available in /docs:
address_map.mdbuild_overview.mddesign_rationale.mdlatency_and_data_format.mdvalidation_notes.md
Licensed under the MIT License.
Provided as-is, without warranty.
This repository demonstrates design decisions, not design possibilities.