Version: 1.0.0
Date: 2025-08-03T03:00:00Z
Author: Vyges Team
License: Apache-2.0
The MLow Audio Codec IP is a high-performance, low-complexity audio compression solution designed for real-time communication (RTC) applications. Based on Meta's MLow codec technology, this IP delivers superior audio quality at very low bitrates while maintaining computational efficiency suitable for resource-constrained devices.
- 2x Better Quality than Opus at 6kbps (POLQA MOS 3.9 vs 1.89)
- 10% Lower Complexity than Opus for reduced power consumption
- Ultra-Low Latency with ≤35ms end-to-end processing time
- Split-Band CELP Architecture with SuperWideBand support
- Range Encoding for optimal bitstream compression
- Forward Error Correction support for packet loss resilience
- Dual Implementation Strategy with full and simplified versions
- FPGA Implementation with open-source toolchain support
- Comprehensive Test Coverage with 12 test categories and 25+ test scenarios
- Formal Verification with frame integrity and handshake protocol checks
- Enhanced Frame Buffering with full frame interface support
Bitrate | POLQA MOS | Bandwidth | Use Case |
---|---|---|---|
6 kbps | 3.9 | NB/WB | Emergency calls |
8 kbps | 4.1 | WB | Basic voice calls |
12 kbps | 4.3 | WB | Standard calls |
16 kbps | 4.5 | WB/SWB | High-quality calls |
24 kbps | 4.7 | SWB | Premium calls |
32 kbps | 4.8 | SWB | Studio quality |
- ✅ Audio Interface - Enhanced frame buffering with full frame bus interface
- ✅ MLow Codec Core - Integrated processing pipeline with blackbox modules
- ✅ Blackbox Modules - Placeholder implementations for encoder, decoder, and packet framer
- ✅ Signal Naming Consistency - Consistent
*_i/*_o
suffixes andint_
prefixes
- ✅ Comprehensive Testbench - 12 test categories with enhanced frame buffering tests
- ✅ 16-Sample Frame Testing - Quick simulation with reduced frame sizes
- ✅ Frame Buffering Verification - Complete frame collection, partial frame handling, boundary detection
- ✅ Full Frame Interface Testing - New bus interface with dedicated handshake signals
- ✅ Multi-Simulator Support - Icarus Verilog and Verilator compatibility
- ✅ Formal Verification - Basic assertions for frame integrity and handshake protocols
- ✅ Yosys Synthesis - Open-source synthesis flow
- ✅ NextPNR Implementation - Place and route for iCE40 FPGAs
- ✅ Gate Analysis - Comprehensive resource and timing analysis
- ✅ Automated Build Scripts -
run_ubuntu.sh
for complete test and synthesis flow
- ✅ Enhanced Makefile - Comprehensive targets for simulation, synthesis, and verification
- ✅ Dependency Checking - Automatic tool verification
- ✅ Formal Verification Targets -
formal-verify
,formal-frame-integrity
,formal-handshake-protocols
- ✅ FPGA Flow Targets - Complete synthesis to bitstream generation
- 🔄 Enhanced Formal Verification - More comprehensive SVA assertions
- 🔄 Coverage-Driven Testing - Advanced coverage metrics
- 🔄 Performance Benchmarking - Detailed latency and throughput analysis
- 🔄 Blackbox Module Implementation - Full encoder/decoder/packet framer logic
- 🔄 Advanced Error Handling - Enhanced error detection and recovery
- 🔄 Power Optimization - Low-power design techniques
Recommended for: Open-source development, educational purposes, FPGA implementation
Features:
- ✅ Icarus Verilog Compatible - Works with open-source tools
- ✅ Verilator Compatible - Advanced simulation support
- ✅ Simplified Architecture - Easy to understand and modify
- ✅ Core Functionality - Essential MLow codec features
- ✅ FPGA Ready - Suitable for synthesis and implementation
- ✅ Yosys Synthesis - Open-source synthesis flow
- ✅ Enhanced Testing - 12 test categories with frame buffering verification
- ✅ Formal Verification - Basic assertion-based verification
- ✅ Blackbox Modules - Placeholder implementations for future enhancement
Core Modules:
- Audio Interface (
audio_interface.sv
) - Enhanced PCM audio handling with frame buffering - MLow Codec Core (
mlow_codec.sv
) - Integrated processing pipeline - Blackbox Modules:
mlow_encoder.sv
- Placeholder encoder implementationmlow_decoder.sv
- Placeholder decoder implementationpacket_framer.sv
- Placeholder packet framing implementation
- Formal Verification:
verification_checks.sv
- Basic assertion-based verificationformal_testbench.sv
- Formal verification testbench
Recommended for: Commercial development, advanced verification, ASIC implementation
Features:
- 🔄 Complete Feature Set - All MLow codec algorithms
- 🔄 Advanced Verification - SystemVerilog assertions and coverage
- 🔄 Commercial Tools - Optimized for ModelSim, VCS, Xcelium
- 🔄 High Performance - Optimized for ASIC implementation
Core Modules:
- Audio Interface (
audio_interface.sv
) - Advanced PCM audio handling - Split-Band Processor (
split_band_processor.sv
) - Frequency domain processing - CELP Encoder (
celp_encoder.sv
) - Advanced linear prediction encoding - CELP Decoder (
celp_decoder.sv
) - Audio reconstruction and synthesis - Range Codec (
range_codec.sv
) - Arithmetic coding for compression
The MLow codec uses a comprehensive, robust Makefile infrastructure for simulation, testing, and synthesis:
- Simple Commands:
make run
,make wave
,make test
- Multi-Simulator Support: Icarus Verilog and Verilator
- Dependency Checking: Automatic tool verification
- Clean Output: Clear success/failure indicators
- Waveform Generation: Easy VCD file creation
- Formal Verification: Basic assertion-based verification
- FPGA Synthesis: Complete synthesis to bitstream flow
# Basic Simulation
make run # Run simulation with default simulator
make SIM=iverilog run # Run with Icarus Verilog
make SIM=verilator run # Run with Verilator
make wave # Generate waveforms
# Testing
make test # Run all tests
make test-basic # Run basic functionality tests
make test-comprehensive # Run comprehensive test suite
# Formal Verification
make formal-verify # Run all formal verification checks
make formal-frame-integrity # Run frame integrity checks
make formal-handshake-protocols # Run handshake protocol checks
# FPGA Implementation
make fpga-synth # Run FPGA synthesis
make fpga-impl # Run FPGA implementation
make fpga-bitstream # Generate FPGA bitstream
make fpga-all # Complete FPGA flow
make fpga-report # Generate FPGA reports
make fpga-clean # Clean FPGA build artifacts
# Utilities
make clean # Clean simulation artifacts
make check-deps # Check tool dependencies
make help # Show help
The MLow codec includes an extensive test suite with 12 test categories and 25+ individual tests:
- Basic Functionality (3 tests) - Core encoding/decoding and mode switching
- Bitrate Coverage (8 tests) - All supported bitrates (6-32 kbps)
- Bandwidth Coverage (3 tests) - NarrowBand, WideBand, SuperWideBand
- Audio Patterns (5 tests) - Sine waves, noise, silence, impulse, chirp
- Performance Tests (1 test) - Latency and throughput measurement
- Error Conditions (1 test) - Invalid parameter handling
- Backpressure Handling (1 test) - Flow control verification
- Continuous Operation (1 test) - Extended operation stability
- Edge Cases (1 test) - Boundary condition testing
- Quality Metrics (1 test) - Audio quality assessment
- Frame Buffering Verification (1 test) - Enhanced frame buffering tests
- Full Frame Interface Verification (1 test) - New bus interface tests
- Complete Frame Collection - Verify proper frame assembly
- Partial Frame Handling - Test incomplete frame scenarios
- Frame Boundary Detection - Validate frame boundary logic
- Full Frame Bus Interface - Test new frame bus with handshake signals
- 20 test vectors with diverse audio patterns
- 5 audio pattern types: Sine waves, white noise, silence, impulse, frequency sweep
- Variable frequencies: 100Hz to 20kHz coverage
- Amplitude variations: Full dynamic range testing
- 16-sample frames for quick simulation testing
- Latency measurement for encoding and decoding
- Throughput analysis for continuous operation
- Quality metrics collection and reporting
- Error statistics tracking and reporting
- Frame buffering performance analysis
The MLow codec includes a comprehensive formal verification framework using basic assertions compatible with both Icarus Verilog and Verilator:
- Verification Checks (
formal/verification_checks.sv
) - Core assertion logic - Formal Testbench (
formal/formal_testbench.sv
) - Integration testbench - Formal Main (
formal/formal_main.cpp
) - Verilator compatibility
- Frame Data Consistency - Verify frame data across outputs
- Frame Buffer Overflow Prevention - Prevent buffer overflow conditions
- Frame Completion Validation - Ensure proper frame completion
- Frame Data Validity - Validate frame data integrity
- Audio Interface Handshake - Validate audio interface protocols
- Frame Bus Handshake - Verify frame bus handshake signals
- Packet Interface Handshake - Check packet interface protocols
- Packet Start/End Consistency - Validate packet boundary signals
- Error Signal Consistency - Monitor error condition handling
- Quality Metric Validity - Validate quality metric ranges
- Busy Signal Consistency - Verify busy signal behavior
- Backpressure Propagation - Monitor backpressure handling
- Deadlock Prevention - Prevent deadlock conditions
- Frame Transfer Coverage - Track frame transfer events
- Audio Backpressure Coverage - Monitor backpressure scenarios
- Error Condition Coverage - Track error occurrences
- Packet Transfer Coverage - Monitor packet transfer events
# Run all formal verification checks
make formal-verify
# Run specific verification categories
make formal-frame-integrity
make formal-handshake-protocols
# View verification results
cat logs/formal_verification.log
The MLow codec includes complete FPGA implementation support using open-source tools:
- Yosys + NextPNR + Icepack - Complete iCE40 implementation
- Yosys Only - Synthesis-only flow (when NextPNR unavailable)
- OpenFPGA + VPR - Advanced FPGA architecture support
- Vivado - Xilinx FPGA support
# Navigate to FPGA directory
cd flow/fpga
# Yosys-only synthesis (recommended for development)
make all TOOL=yosys_only
# Complete FPGA implementation (requires NextPNR/Icepack)
make all TOOL=yosys_nextpnr
# OpenFPGA implementation
make all TOOL=openfpga
# Generate reports
make report
# Clean build artifacts
make clean
# Run complete test and synthesis flow
./run_ubuntu.sh
# This script performs:
# 1. Dependency checking
# 2. Basic simulation tests
# 3. Comprehensive test suite
# 4. FPGA synthesis and implementation
# 5. Gate analysis and reporting
# 6. Report generation
- Synthesized Netlist:
build/mlow_codec.v
(43KB) - JSON Netlist:
build/mlow_codec.json
(460KB) - Synthesis Script:
build/mlow_codec_synth.ys
- FPGA Report:
reports/fpga_report.txt
- Gate Analysis:
reports/gate_analysis_report.txt
- iCE40 - Lattice Semiconductor (primary target)
- ECP5 - Lattice Semiconductor
- Custom - OpenFPGA architectures
Encoding Path:
PCM Audio → Frame Buffer → Split-Band → CELP Encoder → Range Encoder → Packet Output
Decoding Path:
Packet Input → Range Decoder → CELP Decoder → Band Synthesis → Audio Output
The enhanced audio interface includes:
- Array-based Frame Buffer -
frame_buffer[0:FRAME_SIZE-1]
for complete frame storage - Full Frame Bus Interface -
frame_data_bus_o[0:FRAME_SIZE-1]
for parallel frame access - Frame Handshake Protocol -
frame_bus_valid_o
andframe_bus_ready_i
for flow control - Backward Compatibility -
frame_data_o
maintains compatibility with existing interfaces
- Icarus Verilog (open-source)
- Verilator (optional, for advanced simulation)
- Yosys (for synthesis)
- Make build system
- Commercial SystemVerilog simulator (ModelSim, VCS, Xcelium)
- Python 3.8+ with cocotb (for verification)
- Advanced verification tools
# Clone the repository
git clone https://github.com/vyges/mlow
cd mlow
# Check dependencies
make check-deps
# Run basic simulation
make run
# Run with specific simulator
make SIM=iverilog run
make SIM=verilator run
# Generate waveforms
make wave
# Run all tests
make test
# Run comprehensive test suite
make test-comprehensive
# Run formal verification
make formal-verify
# FPGA synthesis
cd flow/fpga
make all TOOL=yosys_only
# Complete automated flow
./run_ubuntu.sh
# Basic simulation
make run
# With waveform generation
make wave
# Run all tests
make test
# Run comprehensive test suite
make test-comprehensive
# Run formal verification
make formal-verify
# Clean up
make clean
#### FPGA Implementation
```bash
# Navigate to FPGA directory
cd flow/fpga
# Yosys synthesis only
make synth TOOL=yosys_only
# Complete FPGA implementation
make all TOOL=yosys_nextpnr
# Generate timing and resource reports
make timing
make resources
# View generated reports
cat reports/fpga_report.txt
cat reports/gate_analysis_report.txt
// Instantiate the codec
mlow_codec #(
.SAMPLE_RATE(48000),
.FRAME_SIZE(16), // 16-sample frames for quick testing
.MAX_BITRATE(32000),
.LPC_ORDER(16),
.SUBBAND_COUNT(2)
) codec_inst (
.clk_i(clk),
.reset_n_i(reset_n),
// Audio interface
.audio_data_i(pcm_input),
.audio_valid_i(input_valid),
.audio_ready_o(input_ready),
.audio_data_o(pcm_output),
.audio_valid_o(output_valid),
.audio_ready_i(output_ready),
// Control interface
.encode_mode_i(1'b1), // 1=encode, 0=decode
.bitrate_sel_i(4'h0), // 6 kbps
.bandwidth_sel_i(2'b01), // WideBand
// Packet interface
.packet_data_io(packet_data),
.packet_valid_o(packet_valid),
.packet_ready_i(packet_ready),
.packet_start_o(packet_start),
.packet_end_o(packet_end),
// Status interface
.busy_o(busy),
.error_o(error),
.quality_metric_o(quality)
);
- Data Width: 16-bit signed PCM
- Sample Rates: 8kHz, 16kHz, 32kHz, 48kHz
- Flow Control: Ready/valid handshaking
- Frame Size: Configurable (16-960 samples, 16 for quick testing)
- Frame Buffer: Array-based storage with full frame bus interface
- Frame Handshake: Dedicated bus valid/ready signals
- Encode/Decode Mode: Single bit control
- Bitrate Selection: 4-bit field (6-32 kbps)
- Bandwidth Selection: 2-bit field (NB/WB/SWB)
- Data Width: 8-bit packet data
- Flow Control: Ready/valid handshaking
- Packet Markers: Start/end indicators
- SystemVerilog Testbench (
tb/sv_tb/tb_mlow_codec.sv
) - Comprehensive Testbench (
tb/sv_tb/tb_mlow_codec_comprehensive.sv
) - Enhanced with frame buffering tests - Verilator Testbench (
tb/sv_tb/tb_mlow_codec_verilator.sv
) - Formal Verification (
formal/verification_checks.sv
,formal/formal_testbench.sv
) - Coverage Analysis with functional and code coverage
- Performance Testing with latency and throughput measurement
-
Functional Tests
- Encoding/decoding at all supported bitrates
- All bandwidth modes (NB/WB/SWB)
- Frame boundary conditions
- Error handling and recovery
-
Enhanced Frame Tests
- Complete frame collection verification
- Partial frame handling verification
- Frame boundary detection verification
- Full frame bus interface testing
-
Performance Tests
- Latency measurements
- Throughput verification
- Quality metrics validation
- Resource utilization
-
Formal Verification Tests
- Frame integrity assertions
- Handshake protocol verification
- Error condition monitoring
- Flow control validation
-
Stress Tests
- Maximum bitrate operation
- Packet loss scenarios
- Continuous operation
- Power consumption
# Run SystemVerilog tests
make sim
# Run comprehensive test suite
make test-comprehensive
# Run formal verification
make formal-verify
# Run specific verification categories
make formal-frame-integrity
make formal-handshake-protocols
# Run all tests with coverage
make test COVERAGE=1
# Generate test report
make report
- Logic Gates: ~50,000 gates
- Memory: 8KB RAM, 4KB ROM
- Power: 5mW typical, 15mW maximum
- Area: ~0.1mm² at 28nm
- Encoding Latency: ≤ 20ms
- Decoding Latency: ≤ 15ms
- End-to-End Latency: ≤ 35ms
- Maximum Sample Rate: 48kHz
- Maximum Bitrate: 32 kbps
- Frame Processing: 16-sample frames for quick testing
- Clock Domain: Single clock domain design
- Reset: Active-low asynchronous reset
- Interfaces: Standard ready/valid handshaking
- Configuration: Runtime parameter selection
- Frame Buffering: Enhanced array-based frame storage
- Synthesis: Yosys, Design Compiler
- Simulation: Verilator, Icarus Verilog, ModelSim
- Formal Verification: Basic assertion-based verification
- Linting: Verible, SpyGlass
- FPGA: NextPNR, Icepack, OpenFPGA
# Synthesis
make synth
# Simulation
make sim
# FPGA implementation
cd flow/fpga && make all
# Formal verification
make formal-verify
# Linting
make lint
# Complete automated flow
./run_ubuntu.sh
- Architecture Specification - Detailed design specification
- Interface Guide - Interface definitions and protocols
- Integration Guide - System integration instructions
- Testbench Guide - Verification methodology
- Module Reference - Complete module documentation
- Parameter Guide - Configuration parameters
- Performance Guide - Performance characteristics
- Audio Quality: POLQA MOS measurement and validation
- Bit-Exact Verification: Against reference implementation
- Regression Testing: Automated test suite execution
- Coverage Analysis: Functional and code coverage metrics
- Formal Verification: Basic assertion-based verification
- Functional Verification: All bitrates, bandwidths, and frame sizes
- Performance Verification: Latency, throughput, and quality metrics
- Stress Verification: Maximum load and error conditions
- Interoperability: Compatibility with other codecs
- Frame Buffering Verification: Enhanced frame handling tests
- Formal Verification: Basic assertion-based verification
- Enhanced FEC algorithms
- Additional bandwidth modes
- Improved power management
- Extended test coverage
- Advanced formal verification
- Multi-channel support
- Advanced post-processing
- Hardware acceleration features
- Performance optimizations
- Complete blackbox module implementation
- Machine learning integration
- Adaptive quality control
- Extended bitrate range
- Advanced error concealment
- Advanced SystemVerilog assertions
- Follow Vyges coding conventions
- Use SystemVerilog for RTL implementation
- Include comprehensive testbenches
- Maintain documentation standards
- Follow verification best practices
- Include formal verification assertions
- Naming: snake_case for modules, signals, and files
- Comments: Comprehensive header documentation
- Structure: Modular design with clear interfaces
- Verification: Assertions and coverage for all modules
- Signal Naming: Consistent
*_i/*_o
suffixes andint_
prefixes
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
- Developer Guide - Complete development guide
- Installation Guide - Tool installation instructions
- API Reference - Complete API documentation
- Issues: Report bugs and request features via GitHub issues
- Discussions: Join community discussions
- Contributions: Submit pull requests for improvements
- Email: [email protected]
- GitHub: vyges/mlow
- Website: https://vyges.com
The MLow Audio Codec IP represents a significant advancement in low-bitrate audio compression, delivering superior quality and efficiency for modern communication systems. The enhanced implementation includes comprehensive testing, formal verification, and FPGA support for complete development workflows.