MIPI CSI-2 simulation framework for Cocotb
GitHub repository: https://github.com/stonelyd/cocotbext-mipi-csi2
Introduction
MIPI CSI-2 (Camera Serial Interface 2) simulation framework for cocotb.
This package provides comprehensive simulation models for MIPI CSI-2 protocol, supporting both D-PHY and C-PHY physical layers. It includes transmitter and receiver models for testing CSI-2 implementations with extensive error injection and validation capabilities.
Features
Protocol Support
- CSI-2 v4.0.1 compliant implementation
- D-PHY physical layer support (1, 2, 4)
- Virtual Channel support (0-15)
- Multiple data types: RAW6/7/8/10/12/14/16/20, RGB444/555/565/666/888, YUV420/422, Generic packets
Packet Handling
- Short packets: Frame/Line Start/End, Generic short packets
- Long packets: Image data, Generic long packets
- Error Correction Code (ECC) generation and validation
- Checksum calculation and verification
- Lane distribution and merging for multi-lane configurations
Testing Capabilities
- Error injection: ECC errors, checksum errors, timing violations
- Frame assembly and validation
- Timing validation with configurable parameters
- Performance analysis and throughput measurement
- Pattern generation for testing (ramp, checkerboard, solid)
Current Development Status
- Basic CSI-2 functionality: Complete and tested
- D-PHY single-lane support: Implemented and tested
- C-PHY implementation: Future Work
- Testing Capabilities: Comming Soon
Installation
Installation from pip (release version, stable):
$ pip install cocotbext-mipi-csi2
Installation for active development:
$ git clone https://github.com/stonelyd/cocotbext-mipi-csi2
$ pip install -e cocotbext-mipi-csi2
Quick Start
import cocotb
from cocotbext.mipi_csi2 import (
Csi2TxModel, Csi2RxModel, Csi2Config,
PhyType, DataType, VirtualChannel
)
# Configure CSI-2 interface
config = Csi2Config(
phy_type=PhyType.DPHY,
lane_count=2,
bit_rate_mbps=800.0
)
# Create transmitter and receiver models
tx_model = Csi2TxModel(bus, config)
rx_model = Csi2RxModel(bus, config)
# Send a test frame
await tx_model.send_frame(
width=640, height=480,
data_type=DataType.RAW8,
virtual_channel=0
)
# Receive and validate frame
frame = await rx_model.get_next_frame()
Upcoming Features
The following features are planned for future releases:
- Enhanced Testing Capabilities - Comprehensive test coverage for all data types and configurations
- Data Type Transition Tests - Frame transitions, Virtual Channel interleave, Data Type interleave testing
- Complete C-PHY Support - Full C-PHY implementation with comprehensive testing
- Advanced Error Correction - ECC error correction capabilities
- Performance Optimization - Improved throughput and timing accuracy
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for cocotbext-mipi-csi2 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cocotbext_mipi_csi2-0.2.0.tar.gz | 56.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cocotbext_mipi_csi2-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.8 kB
Release files / cocotbext_mipi_csi2-0.2.0.tar.gz
| Download URL | cocotbext_mipi_csi2-0.2.0.tar.gz |
|---|---|
| Size | 56.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9be545f2933279bc75297e12be2053e6d16cfb8b6ca94baefbf28e792e80e642
|
|
BLAKE2b-256 checksum How to use checksums |
89b1209e7a9b4db5eb5897056be610a401c8b593c8ecef6586c111b696b784c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / cocotbext_mipi_csi2-0.2.0-py3-none-any.whl
| Download URL | cocotbext_mipi_csi2-0.2.0-py3-none-any.whl |
|---|---|
| Size | 48.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4085b7570b23dcfa2e64c2a0019bc4ad8fe23121e9ddffe35201be752a01696e
|
|
BLAKE2b-256 checksum How to use checksums |
dbd71ea179103d0900b988d7f3feec10410903f6a7be33a65e2400d645910420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|