Skip to main content

MIPI CSI-2 simulation framework for Cocotb

Regression Tests codecov PyPI version Downloads

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:

  1. Enhanced Testing Capabilities - Comprehensive test coverage for all data types and configurations
  2. Data Type Transition Tests - Frame transitions, Virtual Channel interleave, Data Type interleave testing
  3. Complete C-PHY Support - Full C-PHY implementation with comprehensive testing
  4. Advanced Error Correction - ECC error correction capabilities
  5. Performance Optimization - Improved throughput and timing accuracy

License

This project is licensed under the MIT License - see the LICENSE file for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cocotbext_mipi_csi2-0.2.0.tar.gz (56.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cocotbext_mipi_csi2-0.2.0-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file cocotbext_mipi_csi2-0.2.0.tar.gz.

File metadata

  • Download URL: cocotbext_mipi_csi2-0.2.0.tar.gz
  • Upload date:
  • Size: 56.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cocotbext_mipi_csi2-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9be545f2933279bc75297e12be2053e6d16cfb8b6ca94baefbf28e792e80e642
MD5 b4250b4448e801a94908d9027e3301d4
BLAKE2b-256 89b1209e7a9b4db5eb5897056be610a401c8b593c8ecef6586c111b696b784c6

See more details on using hashes here.

File details

Details for the file cocotbext_mipi_csi2-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cocotbext_mipi_csi2-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4085b7570b23dcfa2e64c2a0019bc4ad8fe23121e9ddffe35201be752a01696e
MD5 dc607ef47d935c19f0675f57d22c00ca
BLAKE2b-256 dbd71ea179103d0900b988d7f3feec10410903f6a7be33a65e2400d645910420

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page