Skip to main content

DVI and RGB modules for cocotb

Project description

DVI and RGB interface modules for Cocotb

Build Status PyPI version Downloads

GitHub repository: https://github.com/daxzio/cocotbext-dvi

Introduction

DVI and RGB simulation models for cocotb.

Installation

Installation from pip (release version, stable):

$ pip install cocotbext-dvi

Installation from git (latest development version, potentially unstable):

$ pip install https://github.com/daxzio/cocotbext-dvi/archive/master.zip

Installation for active development:

$ git clone https://github.com/daxzio/cocotbext-dvi
$ pip install -e cocotbext-dvi

Documentation and usage examples

See the tests directory for complete testbenches using these modules.

RGB

It is important to understand that DVI is a serially encoded version of 24-bit RGB or sometimes called RGB888.

RGB888 is a color encoding system that represents colors using a combination of red, green, and blue components, each of which has 8 bits of information. This means that there are 256 possible values for each component, resulting in a total of 16,777,216 possible color combinations.

Typically, due to the high speed of DVI, most digitial designs will convert to 24 bit RGB to use internally, or if transmitting generte images as RGB before being converted to DVI on the TX pins.

As such there is a fully functionally RGB interfaces (Driver and Sink) in this module. They are actually used by the module to generate the DVI Driver and Sink too.

RGB Bus

The RGBBus is used to map to a RGB interface on the dut. These hold instances of bus objects for the individual channels, which are currently extensions of cocotb_bus.bus.Bus. Class methods from_entity and from_prefix are provided to facilitate signal default name matching.

Required:

  • vsync
  • hsync
  • de
  • data

Optional:

  • vblank
  • hblank
  • field_id

Example

    from cocotbext.dvi import RGBBus
    rgb_in_bus = RGBBus.from_prefix(dut, prefix="vid_in")

or

    signals_in = {
        "vsync": "vid_in_vsync",
        "hsync": "vid_in_hsync",
        "de": "vid_in_de",
        "data": "vid_in_data",
    }
    rgb_in_bus = RGBBus(dut, signals=signals_in)

RGB Driver

The RGBDriver class implement a RGB driver and is capable of generating RGB888 signals to be supplied to a RGB input.

    from cocotbext.dvi import RGBBus, RGBDriver
    rgb_in_bus = RGBBus.from_prefix(dut, prefix="vid_in")
    rgb_in = RGBDriver(
        dut.clk,
        rgb_in_bus,
        image_file="./images/320x240.bmp",
    )
  • frequency: Frame frequency images, default 60 Hz
  • height: Truncated image height, use this height instead if image height is positive, default -1
  • width: Truncated image width, use this width instead if image width is positive, default -1
  • logging_enabled: Logging enable, default True

Methods

  • await_start(): Return when an image has begun (if already begun return immediatly)
  • await_image(num): Return then a full number of image, num, image, frames, has been complete. num default 1

RGB Sink

The RGBSink class implement a RGB sink and is capable of receiving RGB888 signals, decoding it to image data, vsync, hsync and comparing it against a supplied image, image_file.

    from cocotbext.dvi import RGBBus, RGBSink
    rgb_out_bus = RGBBus.from_prefix(dut, prefix="vid_out")
    rgb_out = RGBSink(
        dut.clk,
        rgb_out_bus,
        image_file="./images/320x240.bmp",
    )
  • image_file: Image to compare receoved against. Raise error is there is a mismatch in image content but also column and row counts, default None (no comparison)
  • expected_frequency: Frame frequency images, default 60 Hz
  • height: Truncated image height, use this height instead if image height is positive, default -1
  • width: Truncated image width, use this width instead if image width is positive, default -1
  • logging_enabled: Logging enable, default True
  • clk_freq: Test receveied clock frequency, default 25.0 Mhz

Methods

  • frame_finished(num): Return then a full number of image, num, image, frames, has been received. num default 1

DVI

DVI Bus

The DVIBus is used to map to a DVI interface on the dut. These hold instances of bus objects for the individual channels, which are currently extensions of cocotb_bus.bus.Bus. Class methods from_entity and from_prefix are provided to facilitate signal default name matching.

Required:

  • clk_p
  • data_p

Optional:

  • clk_n
  • data_n

Example

    dvi_in_bus = DVIBus.from_prefix(dut, prefix="tmds_in")

or

    signals_in = {
        "clk_p": "tmds_in_clk_p",
        "clk_n": "tmds_in_clk_n",
        "data_p": "tmds_in_data_p",
        "data_n": "tmds_in_data_n",
    }
    dvi_in_bus = DVIBus(dut, signals=signals_in)

DVI

Project 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_dvi-0.4.0.tar.gz (18.6 kB view details)

Uploaded Source

File details

Details for the file cocotbext_dvi-0.4.0.tar.gz.

File metadata

  • Download URL: cocotbext_dvi-0.4.0.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cocotbext_dvi-0.4.0.tar.gz
Algorithm Hash digest
SHA256 299505af1f011dd9613b38149ee88c2c842c437a9f6a6b883685a65f03852856
MD5 eb53646b812db5455aada88576969af0
BLAKE2b-256 8eb81e7c79c280c1836657d57ee654c3da48cb4806a80e237ad54915c13c07d7

See more details on using hashes here.

Supported by

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