DVI and RGB interface modules for Cocotb
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
60Hz - 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.numdefault1
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
60Hz - 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.0Mhz
Methods
frame_finished(num): Return then a full number of image,num, image, frames, has been received.numdefault1
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
Metadata
Release files for cocotbext-dvi 0.5.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 | Provenance | Actions |
|---|---|---|---|---|
| cocotbext_dvi-0.5.0.tar.gz | 18.6 kB | Without provenance | Details for cocotbext_dvi-0.5.0.tar.gz |
Release files / cocotbext_dvi-0.5.0.tar.gz
| Download URL | cocotbext_dvi-0.5.0.tar.gz |
|---|---|
| Size | 18.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01c5f201f6d94d2fa5f407ae7e1ca6c4b4aaef1443a934d4dc909aacf6c1965a
|
|
BLAKE2b-256 checksum How to use checksums |
095542b1716cab1d266a88d18f0427258d6ea3d63a669eec0ca4bf54feb15acb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for cocotbext-dvi 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.